Add multi-board selector and scalable firmware catalog UI.
Board chips reserve future models; firmware uses searchable cards with detail pane and optional meta.json media/docs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
62
lib/boards.ts
Normal file
62
lib/boards.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
/** 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.<key> */
|
||||
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"],
|
||||
labelKey: "cyd35",
|
||||
displayName: "CYD ESP32-3248S035",
|
||||
chip: "ESP32 · 3.5\"",
|
||||
available: false,
|
||||
},
|
||||
{
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user