Add CYD browser flasher with Next.js, i18n, and Web Serial install.
Replace the starter app with a public/local flasher that discovers sibling firmwares, supports en/zh, and documents HTTPS deploy. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
104
README.md
104
README.md
@@ -1,36 +1,98 @@
|
||||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
|
||||
# CYD Flasher
|
||||
|
||||
## Getting Started
|
||||
Browser flasher for **Cheap Yellow Display** (ESP32-2432S028).
|
||||
|
||||
First, run the development server:
|
||||
Stack: **Next.js 15** · **Web Serial** · **esp-web-tools** · **next-intl** · **Tailwind / shadcn-style UI**
|
||||
|
||||
```bash
|
||||
| | |
|
||||
|---|---|
|
||||
| Locales | English (default) `/en` · 中文 `/zh` |
|
||||
| SEO | `generateMetadata`, Open Graph, `/sitemap.xml`, `/robots.txt` |
|
||||
| Flash | `0x1000` bootloader · `0x8000` partitions · `0xe000` boot_app0 · `0x10000` firmware |
|
||||
|
||||
## Quick start (local)
|
||||
|
||||
```powershell
|
||||
cd c:\Users\dsx2016\Desktop\codes\cyd\cydweb
|
||||
npm install
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
Open **Chrome** or **Edge**: [http://localhost:3000](http://localhost:3000) (redirects to `/en`).
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
1. Connect CYD with a data USB cable
|
||||
2. Select a firmware
|
||||
3. Click **Connect & flash** and choose the serial port (CH340 / CP210x)
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
|
||||
Production locally:
|
||||
|
||||
## Learn More
|
||||
```powershell
|
||||
npm run build
|
||||
npm start
|
||||
```
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
## Firmware discovery
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
By default the app scans sibling projects:
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
```text
|
||||
../<project>/firmware/<variant>/{bootloader,partitions,boot_app0,firmware}.bin
|
||||
```
|
||||
|
||||
## Deploy on Vercel
|
||||
Examples currently picked up: `temperature`, `ld2420test`, `sgp30test`, `phtotest`, `tftest` (Pomodoro).
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
Override search root:
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
```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.
|
||||
|
||||
## 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.
|
||||
|
||||
## Scripts
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `npm run dev` | Dev server (Turbopack) |
|
||||
| `npm run build` | Production build |
|
||||
| `npm start` | Serve production build |
|
||||
| `npm run sync:firmware` | Copy sibling `firmware/*` into `./firmware` |
|
||||
| `npm run lint` | ESLint |
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
## 中文说明
|
||||
|
||||
本机:`npm install` → `npm run dev` → Chrome/Edge 打开 http://localhost:3000 ,右上角可切中文。
|
||||
|
||||
公网:先 `npm run sync:firmware`,配置 `NEXT_PUBLIC_SITE_URL`(必须 HTTPS),再部署。固件来自各 CYD 项目的 `firmware/` 预编译包,与 PlatformIO / esptool 刷写地址一致。
|
||||
|
||||
Reference in New Issue
Block a user