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:
71
README.md
71
README.md
@@ -1,12 +1,14 @@
|
||||
# CYD Flasher
|
||||
|
||||
Browser flasher for **Cheap Yellow Display** (ESP32-2432S028).
|
||||
Browser flasher for **Cheap Yellow Display** and related boards.
|
||||
|
||||
Stack: **Next.js 15** · **Web Serial** · **esp-web-tools** · **next-intl** · **Tailwind / shadcn-style UI**
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Locales | English (default) `/en` · 中文 `/zh` |
|
||||
| Boards | CYD 2.8\" available · 2.4\" / 3.5\" / S3 Touch shown as Soon |
|
||||
| Catalog | Searchable card grid · detail pane · media-ready |
|
||||
| SEO | `generateMetadata`, Open Graph, `/sitemap.xml`, `/robots.txt` |
|
||||
| Flash | `0x1000` bootloader · `0x8000` partitions · `0xe000` boot_app0 · `0x10000` firmware |
|
||||
|
||||
@@ -20,11 +22,9 @@ npm run dev
|
||||
|
||||
Open **Chrome** or **Edge**: [http://localhost:3000](http://localhost:3000) (redirects to `/en`).
|
||||
|
||||
1. Connect CYD with a data USB cable
|
||||
2. Select a firmware
|
||||
3. Click **Connect & flash** and choose the serial port (CH340 / CP210x)
|
||||
|
||||
Production locally:
|
||||
1. Pick a **board** (only CYD 2.8\" is active for now)
|
||||
2. Browse / search the **firmware catalog**
|
||||
3. **Connect & flash** and choose the serial port (CH340 / CP210x)
|
||||
|
||||
```powershell
|
||||
npm run build
|
||||
@@ -33,42 +33,59 @@ npm start
|
||||
|
||||
## Firmware discovery
|
||||
|
||||
By default the app scans sibling projects:
|
||||
Scans sibling projects by default:
|
||||
|
||||
```text
|
||||
../<project>/firmware/<variant>/{bootloader,partitions,boot_app0,firmware}.bin
|
||||
```
|
||||
|
||||
Examples currently picked up: `temperature`, `ld2420test`, `sgp30test`, `phtotest`, `tftest` (Pomodoro).
|
||||
|
||||
Override search root:
|
||||
Optional rich metadata next to the bins: `meta.json` (see below).
|
||||
|
||||
```env
|
||||
CYD_FIRMWARE_ROOT=C:\Users\dsx2016\Desktop\codes\cyd
|
||||
```
|
||||
|
||||
After rebuilding a project, refresh its `firmware/` archive (each repo’s `firmware\export_from_build.ps1`), then click **Refresh** on the page.
|
||||
After rebuilding a project, run its `firmware\export_from_build.ps1`, then click **Refresh**.
|
||||
|
||||
## Extending a firmware (media / docs)
|
||||
|
||||
Create `meta.json` beside the `.bin` files:
|
||||
|
||||
```json
|
||||
{
|
||||
"boardId": "esp32-2432s028",
|
||||
"name": "CYD Pomodoro",
|
||||
"summary": "Short card blurb",
|
||||
"description": "Longer detail text",
|
||||
"tags": ["pomodoro", "touch"],
|
||||
"media": {
|
||||
"cover": "media/cover.webp",
|
||||
"animation": "media/preview.gif",
|
||||
"video": "media/demo.mp4",
|
||||
"docs": "docs/README.md"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- Relative media paths are served via `/api/firmware/.../media/...` (only if the file exists).
|
||||
- `docs` may also be an `https://` URL.
|
||||
- `boardId` values: `esp32-2432s028` (active), `esp32-2432s024`, `esp32-3248s035`, `esp32-s3-touch` (UI reserved).
|
||||
|
||||
Without `meta.json`, the catalog still works from `VERSION.txt`.
|
||||
|
||||
## Public deploy
|
||||
|
||||
Web Serial requires **HTTPS** (or localhost).
|
||||
|
||||
1. Mirror firmwares into this repo (no Desktop path dependency):
|
||||
|
||||
```powershell
|
||||
npm run sync:firmware
|
||||
# or: .\scripts\sync-firmware.ps1
|
||||
```
|
||||
|
||||
2. Copy `.env.example` → `.env` and set:
|
||||
|
||||
```env
|
||||
NEXT_PUBLIC_SITE_URL=https://your-domain.example
|
||||
```
|
||||
|
||||
3. Deploy with Node (`npm run build && npm start`) or any Next.js host.
|
||||
|
||||
Mirrored binaries live under `firmware/` (gitignored). Run sync in CI before build if needed.
|
||||
Then `npm run build && npm start` (or any Next.js host). `firmware/` mirror is gitignored.
|
||||
|
||||
## Scripts
|
||||
|
||||
@@ -83,16 +100,16 @@ Mirrored binaries live under `firmware/` (gitignored). Run sync in CI before bui
|
||||
## Project layout
|
||||
|
||||
```text
|
||||
app/[locale]/ # SSR pages (en / zh)
|
||||
app/api/firmware/ # list · manifest · .bin
|
||||
components/ # Flasher UI + shadcn-style primitives
|
||||
messages/ # en.json · zh.json
|
||||
lib/firmware.ts # discovery + flash offsets
|
||||
scripts/ # sync-firmware.ps1
|
||||
app/[locale]/ # SSR pages (en / zh)
|
||||
app/api/firmware/ # list · manifest · .bin · media
|
||||
components/ # board selector, catalog cards, detail
|
||||
lib/boards.ts # board catalog
|
||||
lib/firmware.ts # discovery + meta.json
|
||||
messages/ # en.json · zh.json
|
||||
```
|
||||
|
||||
## 中文说明
|
||||
|
||||
本机:`npm install` → `npm run dev` → Chrome/Edge 打开 http://localhost:3000 ,右上角可切中文。
|
||||
本机:`npm run dev` → http://localhost:3000 ,右上角切语言。先选板型(目前仅 2.8\" 可用),再在卡片目录里选固件刷写。
|
||||
|
||||
公网:先 `npm run sync:firmware`,配置 `NEXT_PUBLIC_SITE_URL`(必须 HTTPS),再部署。固件来自各 CYD 项目的 `firmware/` 预编译包,与 PlatformIO / esptool 刷写地址一致。
|
||||
为固件增加封面 / 动画 / 视频 / 文档:在对应 `firmware/<variant>/` 下放 `meta.json` 与 `media/` 文件即可,无需改前端代码。
|
||||
|
||||
Reference in New Issue
Block a user