Fix 3.5C backlight and GT911: BL=GPIO27, INT left as input after reset.

Black screen on cyd_35r came from TFT_BL=21; align pins/platformio/touch with CYD_PROJECT_GUIDE and export firmware/cyd_35r.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-25 12:21:48 +08:00
parent 2beb80af25
commit 1b82268428
15 changed files with 427 additions and 48 deletions

View File

@@ -1,18 +1,21 @@
# 口哨 / 声音传感器(CYD)
ESP32 Cheap Yellow Display(ESP32-2432S028R)+ 三针口哨模块(高低电平)+ LVGL。
ESP32 Cheap Yellow Display + 三针口哨模块(高低电平)+ LVGL。
触控 + LVGL 壳参考 `activeBuzzerTest` / `hw269test`(SoftSPI,勿改 `src/touch.cpp`)。
默认 **2.8"**(`env:cyd`);可选 **3.5" C**(`env:cyd_35r`)。引脚约定见上级 `CYD_PROJECT_GUIDE.md`。
## 硬件
| 项目 | 说明 |
|------|------|
| 板子 | CYD ESP32-2432S028R(2.8" ILI9341,横屏 UI 320×240) |
| 模块 | 三针口哨/声音传感器(顶部黑头麦克风,OUT 高低电平) |
| 信号 | **GPIO22** |
| 项目 | **2.8" · 2432S028R** | **3.5" C · 3248S035C** |
|------|----------------------|------------------------|
| 屏 / 触控 | ILI9341 + XPT2046 SoftSPI | ST7796 + GT911 I2C |
| 横屏 UI | 320×240 | 480×320(`UX/UY` 缩放) |
| 背光 | GPIO21 | **GPIO27** |
| 口哨信号 | **GPIO22** | **GPIO22**(两板相同) |
接线:`VCC→3.3V`(或模块标注电压),`GND→GND`,`OUT / DO / S→GPIO22`。
模块:三针口哨/声音传感器(顶部黑头麦克风,OUT 高低电平)。
接线:`VCC→3.3V`,`GND→GND`,`OUT / DO / S→GPIO22`。
默认 **高电平 = 有声**。若实际相反,改 `include/pins.h` 里 `SOUND_ACTIVE_HIGH` 为 `0`。板上电位器调节灵敏度。
@@ -30,34 +33,43 @@ ESP32 Cheap Yellow Display(ESP32-2432S028R)+ 三针口哨模块(高低电
依赖 [PlatformIO](https://platformio.org/)。
```bash
# 2.8"
pio run -e cyd -t upload
# 3.5" C
pio run -e cyd_35r -t upload
pio device monitor -b 460800
```
### 预编译固件
```powershell
cd firmware\cyd
cd firmware\cyd # 2.8"
# 或 cd firmware\cyd_35r
.\flash.ps1
# 或 .\flash.ps1 -Port COM4
```
源码更新后重新打包:`.\firmware\export_from_build.ps1`。
源码更新后重新打包:
```powershell
.\firmware\export_from_build.ps1 # 2.8
.\firmware\export_from_build.ps1 -Env cyd_35r
```
## 项目结构
```
platformio.ini # env:cyd,TFT_eSPI + lvgl
platformio.ini # env:cyd + cyd_35r,TFT_eSPI + lvgl
copy_lv_conf.py
include/
pins.h # SOUND_PIN=22、SOUND_ACTIVE_HIGH
pins.h # 按 CYD_BOARD_3248S035 分支;SOUND_PIN=22
sound.h / touch.h / ui.h / lv_conf.h
src/
main.cpp
sound.cpp # 数字高低电平采样 + 消抖计数
touch.cpp # SoftSPI 触控,勿改
touch.cpp # 2.8 SoftSPI / 3.5 GT911,勿空想改脚
ui.cpp # 横屏状态页
firmware/ # 预编译包 + export_from_build.ps1
firmware/cyd / cyd_35r # 预编译包 + export_from_build.ps1
README.md
```
@@ -67,3 +79,4 @@ README.md
|------|------|
| 2026-10-23 | 初版:三针口哨 GPIO22 高低电平检测、hits、LVGL UI、可刷 `firmware/cyd` |
| 2026-10-23 | 修 UI:Reset 与 hits/提示重叠,改为自上而下固定分区布局 |
| 2026-10-25 | 按指南修正 3.5:背光 GPIO27、GT911 INT 复位后改 INPUT;导出 `firmware/cyd_35r` |