Archive flashable cyd_28r firmware bins for offline reflash.
Add flash scripts and export helper so the board can be programmed without rebuilding from source. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
14
README.md
14
README.md
@@ -31,6 +31,18 @@ pio run -e cyd_28r -t upload
|
||||
pio device monitor -b 115200
|
||||
```
|
||||
|
||||
### 预编译固件(随时刷,不必编译)
|
||||
|
||||
已归档到 [`firmware/cyd_28r/`](firmware/cyd_28r/)(含 bootloader / partitions / app):
|
||||
|
||||
```powershell
|
||||
cd firmware\cyd_28r
|
||||
.\flash.ps1
|
||||
# 或 .\flash.ps1 -Port COM3
|
||||
```
|
||||
|
||||
说明见 [`firmware/README.md`](firmware/README.md)。源码更新后重新打包:`.\firmware\export_from_build.ps1`。
|
||||
|
||||
### 环境选择
|
||||
|
||||
| 环境 | 适用 |
|
||||
@@ -66,6 +78,7 @@ platformio.ini # 板级与库依赖
|
||||
include/lv_conf.h # LVGL 配置
|
||||
src/main.cpp # 仪表盘主程序
|
||||
scripts/exclude_lvgl_asm.py # 排除 ESP32 不兼容的 LVGL ASM
|
||||
firmware/ # 预编译固件(可离线刷写)
|
||||
cad/ # 3D 外壳(OpenSCAD + STL)
|
||||
.cursor/rules/ # Cursor 协作规则
|
||||
README.md # 本文档
|
||||
@@ -123,3 +136,4 @@ git reset --hard v1.1-case-snaps
|
||||
| 2026-10-17 | 打标签 `v1.1-case-snaps`(及分支 `keep/v1.1-case-snaps`)作为可回滚稳定版 |
|
||||
| 2026-10-17 | UI 重排:修文字压图表;表盘/底栏分区;动画与短按/长按交互 |
|
||||
| 2026-10-17 | 顶栏改单行,避免 up 文案被表盘面板盖住 |
|
||||
| 2026-10-17 | 归档预编译固件到 `firmware/cyd_28r/`,附一键刷写脚本 |
|
||||
|
||||
46
firmware/README.md
Normal file
46
firmware/README.md
Normal file
@@ -0,0 +1,46 @@
|
||||
# 预编译固件(可随时刷写)
|
||||
|
||||
当前归档目录:[`cyd_28r/`](cyd_28r/)
|
||||
|
||||
对应板子:**CYD ESP32-2432S028R**(ILI9341),DHT11 → GPIO22。
|
||||
版本信息见 [`cyd_28r/VERSION.txt`](cyd_28r/VERSION.txt)。
|
||||
|
||||
## 直接刷写(无需重新编译)
|
||||
|
||||
1. USB 连接板子
|
||||
2. 在本目录执行:
|
||||
|
||||
```powershell
|
||||
cd firmware\cyd_28r
|
||||
.\flash.ps1
|
||||
# 或指定端口
|
||||
.\flash.ps1 -Port COM3
|
||||
```
|
||||
|
||||
也可双击 / 运行 `flash.bat`。
|
||||
|
||||
依赖其一即可:
|
||||
|
||||
- 已安装 PlatformIO(`pio`,自带 esptool)
|
||||
- 或 `pip install esptool`
|
||||
|
||||
## 手动 esptool
|
||||
|
||||
```bash
|
||||
esptool.py --chip esp32 --port COM3 --baud 921600 write_flash -z ^
|
||||
--flash_mode dio --flash_freq 40m --flash_size 4MB ^
|
||||
0x1000 bootloader.bin ^
|
||||
0x8000 partitions.bin ^
|
||||
0xe000 boot_app0.bin ^
|
||||
0x10000 firmware.bin
|
||||
```
|
||||
|
||||
## 从源码重新打包进本目录
|
||||
|
||||
在仓库根目录:
|
||||
|
||||
```powershell
|
||||
.\firmware\export_from_build.ps1
|
||||
# 仅复制、不编译:
|
||||
.\firmware\export_from_build.ps1 -SkipBuild
|
||||
```
|
||||
16
firmware/cyd_28r/VERSION.txt
Normal file
16
firmware/cyd_28r/VERSION.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
name: CYD climate dashboard (cyd_28r)
|
||||
git: 3173b5f
|
||||
date: 2026-10-17
|
||||
board: ESP32-2432S028R (ILI9341)
|
||||
dht: GPIO22
|
||||
flash_size: 4MB
|
||||
offsets:
|
||||
0x1000 bootloader.bin
|
||||
0x8000 partitions.bin
|
||||
0xe000 boot_app0.bin
|
||||
0x10000 firmware.bin
|
||||
sha256:
|
||||
bootloader.bin 3D234A7471F67B013686DABD4DEE7C1FA915C9928463616A94BC9297ACF1ABF8
|
||||
partitions.bin 0A8B5720E7B77FF11F1462458C3A509DEE79224E5279898F26D6A2E3AE0517B7
|
||||
boot_app0.bin F94C5D786A7A8FAB06AC5D10E33BF37711A6697636DC037559EA19CC410A17F0
|
||||
firmware.bin 136CDB0949D3B74DF14ACBB8A2ED100C6F6934BEBE6290639E9C4CD1E68582F4
|
||||
BIN
firmware/cyd_28r/boot_app0.bin
Normal file
BIN
firmware/cyd_28r/boot_app0.bin
Normal file
Binary file not shown.
BIN
firmware/cyd_28r/bootloader.bin
Normal file
BIN
firmware/cyd_28r/bootloader.bin
Normal file
Binary file not shown.
BIN
firmware/cyd_28r/firmware.bin
Normal file
BIN
firmware/cyd_28r/firmware.bin
Normal file
Binary file not shown.
5
firmware/cyd_28r/flash.bat
Normal file
5
firmware/cyd_28r/flash.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
setlocal
|
||||
cd /d "%~dp0"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0flash.ps1" %*
|
||||
exit /b %ERRORLEVEL%
|
||||
84
firmware/cyd_28r/flash.ps1
Normal file
84
firmware/cyd_28r/flash.ps1
Normal file
@@ -0,0 +1,84 @@
|
||||
# Flash archived CYD climate firmware (no rebuild needed)
|
||||
# Usage:
|
||||
# .\flash.ps1
|
||||
# .\flash.ps1 -Port COM5
|
||||
# .\flash.ps1 -Port COM5 -Baud 460800
|
||||
|
||||
param(
|
||||
[string]$Port = "",
|
||||
[int]$Baud = 921600
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
Set-Location $here
|
||||
|
||||
function Find-Esptool {
|
||||
$pio = Get-Command pio -ErrorAction SilentlyContinue
|
||||
if ($pio) {
|
||||
$pkg = Join-Path $env:USERPROFILE ".platformio\packages\tool-esptoolpy\esptool.py"
|
||||
if (Test-Path $pkg) { return @{ Kind = "py"; Path = $pkg } }
|
||||
}
|
||||
$py = Get-Command python -ErrorAction SilentlyContinue
|
||||
if ($py) {
|
||||
try {
|
||||
& python -c "import esptool" 2>$null
|
||||
if ($LASTEXITCODE -eq 0) { return @{ Kind = "mod"; Path = "esptool" } }
|
||||
} catch {}
|
||||
}
|
||||
$esp = Get-Command esptool.py -ErrorAction SilentlyContinue
|
||||
if ($esp) { return @{ Kind = "py"; Path = $esp.Source } }
|
||||
return $null
|
||||
}
|
||||
|
||||
if (-not $Port) {
|
||||
$ports = @()
|
||||
try {
|
||||
Add-Type -AssemblyName System.IO.Ports -ErrorAction SilentlyContinue | Out-Null
|
||||
$ports = [System.IO.Ports.SerialPort]::GetPortNames() | Sort-Object
|
||||
} catch {}
|
||||
if (-not $ports -or $ports.Count -eq 0) {
|
||||
$ports = Get-CimInstance Win32_SerialPort -ErrorAction SilentlyContinue |
|
||||
Select-Object -ExpandProperty DeviceID | Sort-Object
|
||||
}
|
||||
if (-not $ports -or $ports.Count -eq 0) {
|
||||
Write-Error "No serial ports found. Plug in the CYD USB cable, then retry with -Port COMx"
|
||||
}
|
||||
if ($ports.Count -eq 1) {
|
||||
$Port = $ports[0]
|
||||
} else {
|
||||
Write-Host "Available ports: $($ports -join ', ')"
|
||||
$Port = $ports[-1]
|
||||
Write-Host "Using last port: $Port (override with -Port)"
|
||||
}
|
||||
}
|
||||
|
||||
$tool = Find-Esptool
|
||||
if (-not $tool) {
|
||||
Write-Error "esptool not found. Install PlatformIO (`pio`) or: pip install esptool"
|
||||
}
|
||||
|
||||
$argsCommon = @(
|
||||
"--chip", "esp32",
|
||||
"--port", $Port,
|
||||
"--baud", "$Baud",
|
||||
"--before", "default_reset",
|
||||
"--after", "hard_reset",
|
||||
"write_flash", "-z",
|
||||
"--flash_mode", "dio",
|
||||
"--flash_freq", "40m",
|
||||
"--flash_size", "4MB",
|
||||
"0x1000", "bootloader.bin",
|
||||
"0x8000", "partitions.bin",
|
||||
"0xe000", "boot_app0.bin",
|
||||
"0x10000", "firmware.bin"
|
||||
)
|
||||
|
||||
Write-Host "Flashing $here -> $Port @ $Baud"
|
||||
if ($tool.Kind -eq "mod") {
|
||||
& python -m esptool @argsCommon
|
||||
} else {
|
||||
& python $tool.Path @argsCommon
|
||||
}
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
Write-Host "Done. Open serial monitor at 115200 if needed."
|
||||
BIN
firmware/cyd_28r/partitions.bin
Normal file
BIN
firmware/cyd_28r/partitions.bin
Normal file
Binary file not shown.
52
firmware/export_from_build.ps1
Normal file
52
firmware/export_from_build.ps1
Normal file
@@ -0,0 +1,52 @@
|
||||
# Rebuild (optional) and refresh firmware/cyd_28r from PlatformIO build output.
|
||||
# Usage:
|
||||
# .\firmware\export_from_build.ps1
|
||||
# .\firmware\export_from_build.ps1 -SkipBuild
|
||||
|
||||
param([switch]$SkipBuild)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
||||
Set-Location $root
|
||||
|
||||
if (-not $SkipBuild) {
|
||||
pio run -e cyd_28r
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
$src = Join-Path $root ".pio\build\cyd_28r"
|
||||
$dst = Join-Path $root "firmware\cyd_28r"
|
||||
New-Item -ItemType Directory -Force -Path $dst | Out-Null
|
||||
|
||||
Copy-Item (Join-Path $src "bootloader.bin") $dst -Force
|
||||
Copy-Item (Join-Path $src "partitions.bin") $dst -Force
|
||||
Copy-Item (Join-Path $src "firmware.bin") $dst -Force
|
||||
|
||||
$bootApp = Join-Path $env:USERPROFILE ".platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin"
|
||||
if (-not (Test-Path $bootApp)) {
|
||||
Write-Error "boot_app0.bin not found under PlatformIO packages"
|
||||
}
|
||||
Copy-Item $bootApp (Join-Path $dst "boot_app0.bin") -Force
|
||||
|
||||
$git = (git -C $root rev-parse --short HEAD).Trim()
|
||||
$date = Get-Date -Format "yyyy-MM-dd"
|
||||
$hashes = Get-FileHash (Join-Path $dst "*.bin") -Algorithm SHA256
|
||||
$lines = @(
|
||||
"name: CYD climate dashboard (cyd_28r)",
|
||||
"git: $git",
|
||||
"date: $date",
|
||||
"board: ESP32-2432S028R (ILI9341)",
|
||||
"dht: GPIO22",
|
||||
"flash_size: 4MB",
|
||||
"offsets:",
|
||||
" 0x1000 bootloader.bin",
|
||||
" 0x8000 partitions.bin",
|
||||
" 0xe000 boot_app0.bin",
|
||||
" 0x10000 firmware.bin",
|
||||
"sha256:"
|
||||
)
|
||||
foreach ($h in $hashes) {
|
||||
$lines += (" {0,-15} {1}" -f (Split-Path $h.Path -Leaf), $h.Hash)
|
||||
}
|
||||
$lines | Set-Content -Encoding utf8 (Join-Path $dst "VERSION.txt")
|
||||
Write-Host "Exported -> $dst (git $git)"
|
||||
Reference in New Issue
Block a user