Align 3.5C pins with CYD_PROJECT_GUIDE: TFT_BL=27, SGP30 SDA22/SCL21.
Leave 2.8 wiring unchanged; release GT911 INT after reset so SCL21 can share CN1. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
# 预编译固件(可随时刷写)
|
||||
|
||||
当前归档目录:[`cyd_28r/`](cyd_28r/)
|
||||
| 目录 | 板子 | SGP30 | 背光 |
|
||||
|------|------|-------|------|
|
||||
| [`cyd_28r/`](cyd_28r/) | ESP32-2432S028R(ILI9341) | SDA=22 / SCL=27 | GPIO21 |
|
||||
| [`cyd_35r/`](cyd_35r/) | ESP32-3248S035C(ST7796 + GT911) | SDA=22 / SCL=21 | GPIO27 |
|
||||
|
||||
对应板子:**CYD ESP32-2432S028R**(ILI9341),SGP30 → SDA=GPIO22 / SCL=GPIO27。
|
||||
版本信息见 [`cyd_28r/VERSION.txt`](cyd_28r/VERSION.txt)。
|
||||
版本信息见各目录 `VERSION.txt`。引脚约定见 [`../CYD_PROJECT_GUIDE.md`](../../CYD_PROJECT_GUIDE.md)。
|
||||
|
||||
## 直接刷写(无需重新编译)
|
||||
|
||||
1. USB 连接板子
|
||||
2. 在本目录执行:
|
||||
2. 进入对应目录执行:
|
||||
|
||||
```powershell
|
||||
cd firmware\cyd_28r
|
||||
cd firmware\cyd_28r # 或 cyd_35r
|
||||
.\flash.ps1
|
||||
# 或指定端口
|
||||
.\flash.ps1 -Port COM3
|
||||
```
|
||||
|
||||
也可双击 / 运行 `flash.bat`。
|
||||
也可双击 / 运行 `flash.bat`(若有)。
|
||||
|
||||
依赖其一即可:
|
||||
|
||||
@@ -40,7 +42,9 @@ esptool.py --chip esp32 --port COM3 --baud 921600 write_flash -z ^
|
||||
在仓库根目录:
|
||||
|
||||
```powershell
|
||||
.\firmware\export_from_build.ps1
|
||||
.\firmware\export_from_build.ps1 # 2.8 -> cyd_28r
|
||||
.\firmware\export_from_build.ps1 -Env cyd_35r # 3.5 -> cyd_35r
|
||||
# 仅复制、不编译:
|
||||
.\firmware\export_from_build.ps1 -SkipBuild
|
||||
.\firmware\export_from_build.ps1 -Env cyd_35r -SkipBuild
|
||||
```
|
||||
|
||||
17
firmware/cyd_35r/VERSION.txt
Normal file
17
firmware/cyd_35r/VERSION.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
name: CYD sgp30test (cyd_35r)
|
||||
git: 1b2fe27
|
||||
date: 2026-10-25
|
||||
board: ESP32-3248S035 (ST7796 + GT911)
|
||||
sgp30: SDA=GPIO22 SCL=GPIO21
|
||||
tft_bl: GPIO27
|
||||
flash_size: 4MB
|
||||
offsets:
|
||||
0x1000 bootloader.bin
|
||||
0x8000 partitions.bin
|
||||
0xe000 boot_app0.bin
|
||||
0x10000 firmware.bin
|
||||
sha256:
|
||||
bootloader.bin 3D234A7471F67B013686DABD4DEE7C1FA915C9928463616A94BC9297ACF1ABF8
|
||||
boot_app0.bin F94C5D786A7A8FAB06AC5D10E33BF37711A6697636DC037559EA19CC410A17F0
|
||||
firmware.bin 35AD57B34071317C3B1D3CF25B7F9E41C780D9134577A7229A113E8936BA3040
|
||||
partitions.bin 0A8B5720E7B77FF11F1462458C3A509DEE79224E5279898F26D6A2E3AE0517B7
|
||||
BIN
firmware/cyd_35r/boot_app0.bin
Normal file
BIN
firmware/cyd_35r/boot_app0.bin
Normal file
Binary file not shown.
BIN
firmware/cyd_35r/bootloader.bin
Normal file
BIN
firmware/cyd_35r/bootloader.bin
Normal file
Binary file not shown.
BIN
firmware/cyd_35r/firmware.bin
Normal file
BIN
firmware/cyd_35r/firmware.bin
Normal file
Binary file not shown.
5
firmware/cyd_35r/flash.bat
Normal file
5
firmware/cyd_35r/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_35r/flash.ps1
Normal file
84
firmware/cyd_35r/flash.ps1
Normal file
@@ -0,0 +1,84 @@
|
||||
# Flash archived CYD SGP30 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."
|
||||
65
firmware/cyd_35r/media/preview.html
Normal file
65
firmware/cyd_35r/media/preview.html
Normal file
@@ -0,0 +1,65 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>AIR</title>
|
||||
<style>
|
||||
*{box-sizing:border-box;margin:0;padding:0}
|
||||
html,body{width:320px;height:240px;overflow:hidden;background:#000;margin:0}
|
||||
.bezel{width:320px;height:240px;background:#1a1408}
|
||||
.screen{width:320px;height:240px;background:#0A1018;color:#F2F5FA;font:12px/1.2 system-ui,sans-serif;
|
||||
overflow:hidden;}
|
||||
.hdr{display:flex;align-items:center;gap:8px;padding:4px 8px;height:24px}
|
||||
.hdr b{font-size:14px}.up{color:#7E90A8}.sp{margin-left:auto;display:flex;gap:6px;align-items:center;color:#7E90A8}
|
||||
.led{width:9px;height:9px;border-radius:50%;background:#4CAF7A}
|
||||
.row{display:flex;gap:6px;padding:0 8px}
|
||||
.panel{flex:1;height:118px;background:#121C2A;border:1px solid #1E2C40;border-radius:6px;padding:6px 8px;position:relative}
|
||||
.cap{color:#7E90A8;font-size:11px}
|
||||
.gauge{width:90px;height:90px;margin:4px auto 0;border-radius:50%;
|
||||
background:conic-gradient(#4DA3FF 0 40%, #243247 0);
|
||||
mask:radial-gradient(farthest-side,transparent 62%,#000 63%);
|
||||
-webkit-mask:radial-gradient(farthest-side,transparent 62%,#000 63%)}
|
||||
.panel.tvoc .gauge{background:conic-gradient(#B07CFF 0 28%, #243247 0)}
|
||||
.val{position:absolute;left:0;right:0;top:44px;text-align:center;font-size:20px;font-weight:700;color:#4DA3FF}
|
||||
.panel.tvoc .val{color:#B07CFF}
|
||||
.unit{font-size:10px;color:#7E90A8}
|
||||
.rng{position:absolute;left:0;right:0;bottom:6px;text-align:center;color:#7E90A8;font-size:11px}
|
||||
.bot{margin:6px 8px 0;height:78px;background:#121C2A;border:1px solid #1E2C40;border-radius:6px;display:flex;gap:8px;padding:8px}
|
||||
.info{width:96px}.ok{color:#4CAF7A;font-size:14px;font-weight:700}
|
||||
.meta{margin-top:10px;color:#7E90A8;font-size:11px}
|
||||
.chart{flex:1;background:#0E1622;border-radius:4px}
|
||||
.chart svg{width:100%;height:100%}
|
||||
|
||||
/* CYD 3.5" full-bleed: non-uniform scale matches firmware UX()/UY(). */
|
||||
html,body{width:480px!important;height:320px!important;overflow:hidden!important;background:#000!important;margin:0!important;padding:0!important}
|
||||
.cyd35-scale{width:320px;height:240px;transform:scale(1.5,1.3333333333);transform-origin:0 0;overflow:hidden}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="cyd35-scale">
|
||||
|
||||
<div class="bezel"><div class="screen" id="s">
|
||||
<div class="hdr"><b>AIR</b><span class="up">up 03:10</span>
|
||||
<span class="sp"><span>GOOD</span><span class="led"></span></span></div>
|
||||
<div class="row">
|
||||
<div class="panel"><div class="cap">eCO2</div><div class="gauge"></div>
|
||||
<div class="val">612<span class="unit"> ppm</span></div><div class="rng">baseline</div></div>
|
||||
<div class="panel tvoc"><div class="cap">TVOC</div><div class="gauge"></div>
|
||||
<div class="val">84<span class="unit"> ppb</span></div><div class="rng">SGP30</div></div>
|
||||
</div>
|
||||
<div class="bot">
|
||||
<div class="info"><div class="ok">FRESH</div>
|
||||
<div class="meta">SDA22 · SCL27<br/>IAQ index OK</div></div>
|
||||
<div class="chart"><svg viewBox="0 0 180 60" preserveAspectRatio="none">
|
||||
<polyline fill="none" stroke="#4DA3FF" stroke-width="2"
|
||||
points="0,35 30,32 60,30 90,28 120,33 150,29 180,27"/>
|
||||
<polyline fill="none" stroke="#B07CFF" stroke-width="2"
|
||||
points="0,48 30,46 60,44 90,45 120,42 150,43 180,41"/>
|
||||
</svg></div>
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
15
firmware/cyd_35r/meta.json
Normal file
15
firmware/cyd_35r/meta.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"boardId": "esp32-3248s035",
|
||||
"name": "CYD SGP30 air quality dashboard (3.5\")",
|
||||
"summary": "eCO2 and TVOC air-quality gauges",
|
||||
"description": "SGP30 on SDA=GPIO22 / SCL=GPIO21. TFT_BL=GPIO27. Dual arcs and IAQ status.",
|
||||
"tags": [
|
||||
"air",
|
||||
"sgp30",
|
||||
"eco2",
|
||||
"tvoc"
|
||||
],
|
||||
"media": {
|
||||
"preview": "media/preview.html"
|
||||
}
|
||||
}
|
||||
BIN
firmware/cyd_35r/partitions.bin
Normal file
BIN
firmware/cyd_35r/partitions.bin
Normal file
Binary file not shown.
@@ -23,11 +23,15 @@ if (-not $SkipBuild) {
|
||||
$src = Join-Path $root (".pio\build\" + $Env)
|
||||
if ($Env -eq "cyd_35r") {
|
||||
$dstName = "cyd_35r"
|
||||
$boardLine = "board: ESP32-3248S035 (ST7796)"
|
||||
$boardLine = "board: ESP32-3248S035 (ST7796 + GT911)"
|
||||
$sgpLine = "sgp30: SDA=GPIO22 SCL=GPIO21"
|
||||
$blLine = "tft_bl: GPIO27"
|
||||
$boardIdHint = "esp32-3248s035"
|
||||
} else {
|
||||
$dstName = "cyd_28r"
|
||||
$boardLine = "board: ESP32-2432S028R (ILI9341)"
|
||||
$sgpLine = "sgp30: SDA=GPIO22 SCL=GPIO27"
|
||||
$blLine = "tft_bl: GPIO21"
|
||||
$boardIdHint = "esp32-2432s028"
|
||||
}
|
||||
$dst = Join-Path $root ("firmware\" + $dstName)
|
||||
@@ -54,6 +58,8 @@ $lines = @(
|
||||
"git: $git",
|
||||
"date: $date",
|
||||
$boardLine,
|
||||
$sgpLine,
|
||||
$blLine,
|
||||
"flash_size: 4MB",
|
||||
"offsets:",
|
||||
" 0x1000 bootloader.bin",
|
||||
@@ -67,21 +73,5 @@ foreach ($h in $hashes) {
|
||||
}
|
||||
$lines | Set-Content -Encoding utf8 (Join-Path $dst "VERSION.txt")
|
||||
|
||||
# Keep / refresh meta.json boardId for catalog filtering
|
||||
$metaPath = Join-Path $dst "meta.json"
|
||||
if (Test-Path $metaPath) {
|
||||
try {
|
||||
$meta = Get-Content $metaPath -Raw | ConvertFrom-Json
|
||||
$meta.boardId = $boardIdHint
|
||||
if ($Env -eq "cyd_35r" -and $meta.name -notmatch "3\.5") {
|
||||
$meta.name = ($meta.name -replace "\s*$","") + " (3.5\")"
|
||||
}
|
||||
$meta | ConvertTo-Json -Depth 8 | Set-Content -Encoding utf8 $metaPath
|
||||
} catch {
|
||||
Write-Host "meta.json update skipped: $_"
|
||||
}
|
||||
} elseif ($Env -eq "cyd_35r") {
|
||||
Write-Host "Note: add firmware/cyd_35r/meta.json with boardId=$boardIdHint for the web catalog"
|
||||
}
|
||||
|
||||
Write-Host "Exported -> $dst (env=$Env git=$git)"
|
||||
|
||||
Reference in New Issue
Block a user