feat(esp32-s3-lcd-43): add touch test harness and coordinate transformation

This commit is contained in:
2026-02-18 18:58:37 -08:00
parent e4609c6978
commit d6eb2cd561
9 changed files with 173 additions and 7 deletions

View File

@@ -22,6 +22,7 @@
#define HINT_ANIMATION_MS 2000
#define HINT_MIN_BRIGHTNESS 30
#define HINT_MAX_BRIGHTNESS 60
#define TOUCH_DEBOUNCE_MS 100
// ── Loop yield (prevents Task Watchdog on ESP32) ──
#ifndef LOOP_YIELD_MS

View File

@@ -223,6 +223,15 @@ void DoorbellLogic::onSilence() {
void DoorbellLogic::silenceAlert() { onSilence(); }
void DoorbellLogic::dismissAlert() {
Serial.printf("[%lu] [DISMISS] Alert dismissed by user\n", millis());
_state.deviceState = DeviceState::SILENT;
_state.screen = ScreenID::DASHBOARD;
_state.alertTitle = "";
_state.alertBody = "";
_display->render(_state);
}
void DoorbellLogic::onAdmin(const String& cmd) {
Serial.printf("[ADMIN] %s\n", cmd.c_str());
if(cmd == "reboot") {
@@ -364,7 +373,9 @@ int DoorbellLogic::handleTouch(const TouchEvent& evt) {
}
if(_state.screen == ScreenID::ALERT) {
Serial.println("[TOUCH] ALERT tap");
Serial.printf("[%lu] [TOUCH] ALERT → DASHBOARD (dismiss)\n", millis());
dismissAlert();
return (int)TileAction::DISMISS;
}
}

View File

@@ -26,6 +26,8 @@ public:
/// Externally trigger silence (e.g. hold-to-silence gesture).
void silenceAlert();
/// Dismiss alert and return to dashboard (user tap on alert screen).
void dismissAlert();
void setScreen(ScreenID s);
/// Handle touch input — returns dashboard tile index if tapped, or -1.
int handleTouch(const TouchEvent& evt);

View File

@@ -12,6 +12,7 @@ enum class TileAction {
NONE,
ALERT, // Trigger alert
SILENCE, // Silence alert
DISMISS, // Dismiss alert and return to dashboard
STATUS, // Send heartbeat/status
REBOOT, // Reboot device
};