Files
cydweb/lib/sensor-media.ts
DESKTOP-PUHFO60\dsx2016 b083da50b1 Add Hardware tab with sensor stills next to UI previews.
Map each firmware project to a Commons or original module photo for local catalog browsing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-23 16:09:20 +08:00

87 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Hardware / sensor stills shown in the preview “Hardware” tab.
* Prefer Wikimedia Commons (CC) or original studio stubs — see public/sensors/ATTRIBUTION.md
*/
export type SensorMedia = {
/** Short part name shown under the photo */
label: string;
/** Public URL under /sensors/… */
src: string;
};
/** Map firmware project folder name → sensor/module still. */
const BY_PROJECT: Record<string, SensorMedia> = {
temperature: {
label: "DHT11 / DHT22",
src: "/sensors/dht.jpg",
},
gy30test: {
label: "GY-30 / BH1750",
src: "/sensors/bh1750.jpg",
},
sgp30test: {
label: "SGP30",
src: "/sensors/sgp30.jpg",
},
ld2420test: {
label: "LD2420 mmWave",
src: "/sensors/ld2420.jpg",
},
phtotest: {
label: "microSD / TF",
src: "/sensors/microsd.jpg",
},
tftest: {
label: "Speaker (GPIO26)",
src: "/sensors/speaker.jpg",
},
activeBuzzerTest: {
label: "Active buzzer",
src: "/sensors/buzzer.jpg",
},
btntest: {
label: "Tactile button",
src: "/sensors/button.jpg",
},
touchbtntest: {
label: "TTP223 touch",
src: "/sensors/ttp223.jpg",
},
humanInfraredModuletest: {
label: "PIR SR505 / SR501",
src: "/sensors/pir.jpg",
},
voicechecktest: {
label: "Whistle / sound (digital)",
src: "/sensors/sound_sensor.jpg",
},
hw069digitdisplaytest: {
label: "HW-069 / TM1637",
src: "/sensors/tm1637.jpg",
},
hw269test: {
label: "HW-269 white LED",
src: "/sensors/white_led.jpg",
},
smdky009ledtest: {
label: "KY-009 RGB LED",
src: "/sensors/rgb.jpg",
},
lcd1602atest: {
label: "LCD1602A + PCF8574",
src: "/sensors/lcd1602.jpg",
},
bletest: {
label: "Onboard BLE (ESP32)",
src: "/sensors/bluetooth_icon.svg",
},
wifitest: {
label: "Onboard Wi‑Fi (ESP32)",
src: "/sensors/wifi_icon.svg",
},
};
export function sensorMediaForProject(project: string): SensorMedia | null {
return BY_PROJECT[project] ?? null;
}