Files
voicechecktest/README.md
DESKTOP-PUHFO60\dsx2016 1b82268428 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>
2026-10-25 12:21:48 +08:00

83 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 口哨 / 声音传感器(CYD)
ESP32 Cheap Yellow Display + 三针口哨模块(高低电平)+ LVGL。
默认 **2.8"**(`env:cyd`);可选 **3.5" C**(`env:cyd_35r`)。引脚约定见上级 `CYD_PROJECT_GUIDE.md`。
## 硬件
| 项目 | **2.8" · 2432S028R** | **3.5" C · 3248S035C** |
|------|----------------------|------------------------|
| 屏 / 触控 | ILI9341 + XPT2046 SoftSPI | ST7796 + GT911 I2C |
| 横屏 UI | 320×240 | 480×320(`UX/UY` 缩放) |
| 背光 | GPIO21 | **GPIO27** |
| 口哨信号 | **GPIO22** | **GPIO22**(两板相同) |
模块:三针口哨/声音传感器(顶部黑头麦克风,OUT 高低电平)。
接线:`VCC→3.3V`,`GND→GND`,`OUT / DO / S→GPIO22`。
默认 **高电平 = 有声**。若实际相反,改 `include/pins.h` 里 `SOUND_ACTIVE_HIGH` 为 `0`。板上电位器调节灵敏度。
## 功能 / 操作
- 实时显示 **QUIET** / **SOUND!**、引脚 **HIGH/LOW** 与 active/idle
- 触发时进度条闪动;边沿计数 **hits**(约 40ms 消抖)
- 触控底部 **Reset**:清零 hits
- **无分贝**:数字口 + GPIO22 非 ADC,无法测 dB
界面自上而下分区(互不重叠):标题 → 引脚 → 状态 → 电平 → 条 → hits → Reset。
## 构建 / 烧录
依赖 [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 # 2.8"
# 或 cd firmware\cyd_35r
.\flash.ps1
# 或 .\flash.ps1 -Port COM4
```
源码更新后重新打包:
```powershell
.\firmware\export_from_build.ps1 # 2.8
.\firmware\export_from_build.ps1 -Env cyd_35r
```
## 项目结构
```
platformio.ini # env:cyd + cyd_35r,TFT_eSPI + lvgl
copy_lv_conf.py
include/
pins.h # 按 CYD_BOARD_3248S035 分支;SOUND_PIN=22
sound.h / touch.h / ui.h / lv_conf.h
src/
main.cpp
sound.cpp # 数字高低电平采样 + 消抖计数
touch.cpp # 2.8 SoftSPI / 3.5 GT911,勿空想改脚
ui.cpp # 横屏状态页
firmware/cyd / cyd_35r # 预编译包 + export_from_build.ps1
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` |