refactor(doorbell): check hold completion before release handling

This commit is contained in:
2026-02-19 19:22:49 -08:00
parent dfd511e499
commit f367bd365b
2 changed files with 9 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
FQBN="esp32:esp32:waveshare_esp32_s3_touch_lcd_43:PSRAM=enabled,FlashSize=16M,USBMode=hwcdc,PartitionScheme=app3M_fat9M_16MB" FQBN="esp32:esp32:waveshare_esp32_s3_touch_lcd_43:PSRAM=enabled,FlashSize=16M,USBMode=hwcdc,PartitionScheme=app3M_fat9M_16MB"
PORT="/dev/ttyACM0" PORT="/dev/ttyACM0"
LIBS="--libraries ~/Arduino/libraries/LovyanGFX" LIBS="--libraries ./vendor/esp32-s3-lcd-43/LovyanGFX"
OPTS="-DDEBUG_MODE -DBOARD_HAS_PSRAM -DLGFX_USE_V1 -DLOCAL_SECRETS" OPTS="-DDEBUG_MODE -DBOARD_HAS_PSRAM -DLGFX_USE_V1 -DLOCAL_SECRETS"

View File

@@ -319,6 +319,14 @@ void DoorbellLogic::setScreen(ScreenID s) {
} }
int DoorbellLogic::handleTouch(const TouchEvent& evt) { int DoorbellLogic::handleTouch(const TouchEvent& evt) {
// Check hold completion FIRST - before any release handling
// This ensures hold-to-silence works on ALERT screen
if(evt.released && _state.deviceState == DeviceState::ALERTING) {
if(updateHold(evt)) {
return (int)TileAction::SILENCE;
}
}
// Handle press - show visual feedback // Handle press - show visual feedback
if(evt.pressed) { if(evt.pressed) {
// Reset inactivity timer on any touch // Reset inactivity timer on any touch