diff --git a/sketches/doorbell-touch-esp32-32e/.arduino_config.lua b/sketches/doorbell-touch-esp32-32e/.arduino_config.lua new file mode 100644 index 0000000..d49453c --- /dev/null +++ b/sketches/doorbell-touch-esp32-32e/.arduino_config.lua @@ -0,0 +1,5 @@ +local M = {} +M.board = 'arduino:avr:uno' +M.port = '/dev/ttyUSB0' +M.baudrate =115200 +return M diff --git a/sketches/doorbell-touch-esp32-32e/Config.h b/sketches/doorbell-touch-esp32-32e/Config.h index f612f47..3e3d021 100644 --- a/sketches/doorbell-touch-esp32-32e/Config.h +++ b/sketches/doorbell-touch-esp32-32e/Config.h @@ -40,7 +40,6 @@ static const int NUM_WIFI = sizeof(wifiNetworks) / sizeof(wifiNetworks[0]); #define BLINK_INTERVAL_MS 500 #define STALE_MSG_THRESHOLD_S 600 #define NTP_SYNC_INTERVAL_MS 3600000 -#define ALERT_TIMEOUT_MS 300000 #define WAKE_DISPLAY_MS 5000 #define TOUCH_DEBOUNCE_MS 300 #define HEARTBEAT_INTERVAL_MS 30000 diff --git a/sketches/doorbell-touch-esp32-32e/DoorbellLogic.cpp b/sketches/doorbell-touch-esp32-32e/DoorbellLogic.cpp index 32875db..9f62af2 100644 --- a/sketches/doorbell-touch-esp32-32e/DoorbellLogic.cpp +++ b/sketches/doorbell-touch-esp32-32e/DoorbellLogic.cpp @@ -232,7 +232,6 @@ void DoorbellLogic::transitionTo(DeviceState newState) { break; case DeviceState::ALERTING: _alertStart = now; - _alertStartEpoch = _lastEpoch; // <-- ADD: record NTP time of alert _lastBlink = now; _blinkState = false; _screen.screen = ScreenID::ALERT; diff --git a/sketches/doorbell-touch-esp32-32e/DoorbellLogic.h b/sketches/doorbell-touch-esp32-32e/DoorbellLogic.h index 4a14be2..c13abd1 100644 --- a/sketches/doorbell-touch-esp32-32e/DoorbellLogic.h +++ b/sketches/doorbell-touch-esp32-32e/DoorbellLogic.h @@ -49,6 +49,11 @@ private: unsigned long _lastHeartbeat = 0; bool _blinkState = false; + // Stale silence protection + time_t _alertMsgEpoch = 0; // ntfy timestamp of the alert that started ALERTING + time_t _lastParsedMsgEpoch = 0; // ntfy timestamp of message currently being handled + + // Deferred status publish bool _pendingStatus = false; String _pendStatusState;