/** Supported / planned hardware families for the flasher UI. */ export type BoardDefinition = { id: string; /** Match VERSION.txt / meta board strings (case-insensitive substring). */ match: string[]; /** Translation key under boards.items. */ labelKey: string; displayName: string; /** Short chip line shown on the chip */ chip: string; available: boolean; }; export const BOARDS: BoardDefinition[] = [ { id: "esp32-2432s028", match: ["2432s028", "esp32-2432s028"], labelKey: "cyd28", displayName: "CYD ESP32-2432S028", chip: "ESP32 · 2.8\"", available: true, }, { id: "esp32-2432s024", match: ["2432s024"], labelKey: "cyd24", displayName: "CYD ESP32-2432S024", chip: "ESP32 · 2.4\"", available: false, }, { id: "esp32-3248s035", match: ["3248s035", "cyd_35r"], labelKey: "cyd35", displayName: "CYD ESP32-3248S035", chip: "ESP32 · 3.5\"", available: true, }, { id: "esp32-s3-touch", match: ["esp32-s3", "s3-touch"], labelKey: "s3touch", displayName: "ESP32-S3 Touch", chip: "ESP32-S3", available: false, }, ]; export const DEFAULT_BOARD_ID = "esp32-2432s028"; export function resolveBoardId(boardField: string | null | undefined): string { const raw = (boardField || "").toLowerCase(); if (!raw) return DEFAULT_BOARD_ID; for (const b of BOARDS) { if (b.match.some((m) => raw.includes(m.toLowerCase()))) return b.id; } return DEFAULT_BOARD_ID; } export function getBoard(id: string): BoardDefinition | undefined { return BOARDS.find((b) => b.id === id); } /** Logical UI resolution used by HTML firmware previews (matches UX/UY). */ export function boardPreviewSize(boardId: string): { w: number; h: number } { if (boardId === "esp32-3248s035") return { w: 480, h: 320 }; return { w: 320, h: 240 }; }