Files
voicechecktest/README.md

70 lines
2.1 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(ESP32-2432S028R)+ 三针口哨模块(高低电平)+ LVGL。
触控 + LVGL 壳参考 `activeBuzzerTest` / `hw269test`(SoftSPI,勿改 `src/touch.cpp`)。
## 硬件
| 项目 | 说明 |
|------|------|
| 板子 | CYD ESP32-2432S028R(2.8" ILI9341,横屏 UI 320×240) |
| 模块 | 三针口哨/声音传感器(顶部黑头麦克风,OUT 高低电平) |
| 信号 | **GPIO22** |
接线:`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
pio run -e cyd -t upload
pio device monitor -b 460800
```
### 预编译固件
```powershell
cd firmware\cyd
.\flash.ps1
# 或 .\flash.ps1 -Port COM4
```
源码更新后重新打包:`.\firmware\export_from_build.ps1`。
## 项目结构
```
platformio.ini # env:cyd,TFT_eSPI + lvgl
copy_lv_conf.py
include/
pins.h # SOUND_PIN=22、SOUND_ACTIVE_HIGH
sound.h / touch.h / ui.h / lv_conf.h
src/
main.cpp
sound.cpp # 数字高低电平采样 + 消抖计数
touch.cpp # SoftSPI 触控,勿改
ui.cpp # 横屏状态页
firmware/ # 预编译包 + export_from_build.ps1
README.md
```
## 变更记录
| 日期 | 说明 |
|------|------|
| 2026-10-23 | 初版:三针口哨 GPIO22 高低电平检测、hits、LVGL UI、可刷 `firmware/cyd` |
| 2026-10-23 | 修 UI:Reset 与 hits/提示重叠,改为自上而下固定分区布局 |