Gate REC/PLAY to explicit user input only.

Add boot lockout, long-press touch confirm, BOOT debounce, and
line-based serial commands so noise cannot auto-start recording.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-27 22:24:19 +08:00
parent b8527e9fb8
commit 8f0d1d739b
5 changed files with 113 additions and 56 deletions

View File

@@ -39,7 +39,8 @@ ESP32 Cheap Yellow Display + INMP441(I2S)→ microSD **WAV 录音**,支持
- 实时电平条(近似 dB,与 inmp441test 同一换算)
- **PLAY / STOP**:用板载喇叭(GPIO26)回放最近一条录音
- 需插入 **FAT32 microSD**
- 备用:板载 **BOOT** 键切换 REC;串口 `115200` 发 `r` / `p` 切换录音 / 播放
- 备用:板载 **BOOT** 键切换 REC;串口整行 `r` / `rec` / `p` / `play`(不会吃 USB 杂字节)
- **绝无自动开录**:无触控按钮 / BOOT / 串口整行命令;上电 4s 内锁死
## 2.8" 触控说明(重要)
@@ -49,9 +50,9 @@ ESP32 Cheap Yellow Display + INMP441(I2S)→ microSD **WAV 录音**,支持
|----|------|
| 总线 | SoftSPI,读触控前拉高 `SD_CS` |
| 坐标 | raw ADC → 横屏 UI 320×240;**X/Y 均反向** 以对齐 `LVGL ROTATION_270` 画面 |
| 点击 | 只命中屏幕上画的 REC / PLAY 区域(带边距);松手触发 |
| 防抖 | 压力滞回 + **1.5 s** 动作冷却,避免误触反复开停录音 |
| 备用 | BOOT / 串口 `r`·`p`(触控异常时仍可用) |
| 点击 | 只命中画出的 REC / PLAY;按住 ≥120ms 且指头不滑出按钮才算 |
| 防抖 | z≥70 且连续 5 采样;**2 s** 冷却;上电 **4 s** 动作锁 |
| 备用 | BOOT(稳定按下)/ 串口整行命令 |
参考:[RNT CYD + SoftSPI + SD](https://randomnerdtutorials.com/esp32-cyd-display-touchscreen-microsd-card/)、[hexeguitar/CYD28_Touchscreen](https://github.com/hexeguitar/CYD28_Touchscreen)。
@@ -102,3 +103,4 @@ README.md
|------|------|
| 2026-10-27 | 初版:INMP441 → microSD WAV 录音 + DAC 回放;双板 `cyd_28r` / `cyd_35r` |
| 2026-10-27 | 2.8 触控:SoftSPI + XY 反向校准、按钮命中区、1.5s 冷却;消除误触反复录音 |
| 2026-10-27 | 显式操作门闩:上电锁 4s、触控长按确认、BOOT 防抖、串口整行;禁止无操作自启录音 |