From 1bdae03cc4424a1be6b4259b68620f14dc23e179 Mon Sep 17 00:00:00 2001 From: acidburns Date: Tue, 17 Feb 2026 01:28:20 +0100 Subject: [PATCH] Document hourly and first-sync sender fault counter resets --- README.md | 9 +++++++++ Requirements.md | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 90fa26d..45086f2 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Firmware for LilyGO T3 v1.6.1 (`ESP32 + SX1276 + SSD1306`) that runs in two role - Sender retries reuse cached encoded payload bytes (no re-encode on retry path). - Sender ACK receive windows adapt from observed ACK RTT + miss streak. - Sender only starts normal metering/transmit flow after valid time bootstrap from receiver ACK. +- Sender fault counters are reset at first valid time sync and again at each UTC hour boundary. - Receiver runs STA mode if stored config is valid and connects, otherwise AP fallback. ## LoRa Protocol @@ -58,8 +59,12 @@ Sender boot starts in sync-only mode: After valid ACK time: - `time_set_utc()` is called - `g_time_acquired=true` +- sender fault counters are reset once (`err_m`, `err_d`, `err_tx`, last-error state) - normal 1 Hz sampling + periodic batch transmission starts +After initial sync: +- sender fault counters are reset again once per UTC hour when the hour index changes (`HH:00 UTC` boundary) + Timezone: - `TIMEZONE_TZ` from `include/config.h` is applied in `time_manager`. - Web/OLED local-time rendering uses this timezone. @@ -125,6 +130,10 @@ State JSON (`src/json_codec.cpp`) includes: - `err_last`, `rx_reject`, `rx_reject_text` - non-zero fault counters when available +Sender fault counter lifecycle: +- counters are cumulative only within the current UTC-hour window after first sync +- counters reset on first valid sender time sync and at each subsequent UTC hour boundary + Home Assistant discovery: - enabled by `ENABLE_HA_DISCOVERY=true` - publishes to `homeassistant/sensor///config` diff --git a/Requirements.md b/Requirements.md index 1e8e46d..02f3dfd 100644 --- a/Requirements.md +++ b/Requirements.md @@ -28,6 +28,8 @@ Function names below are C++ references. Rust naming/layout may differ, but the - Time bootstrap guardrail: - sender must not run normal sampling/transmit until valid ACK time received. - accept ACK time only if `time_valid=1` and `epoch >= MIN_ACCEPTED_EPOCH_UTC`. + - sender fault counters reset when first valid sync is accepted. + - after first sync, sender fault counters reset again at each UTC hour boundary. - Sampling/transmit cadence: - sender sample cadence 1 Hz. - sender batch cadence 30 s. @@ -364,6 +366,10 @@ These functions define end-to-end firmware behavior and must have equivalents: - Fault tracking/publish: - `note_fault` + - `clear_faults` + - `sender_reset_fault_stats` + - `sender_reset_fault_stats_on_first_sync` + - `sender_reset_fault_stats_on_hour_boundary` - `age_seconds` - `counters_changed` - `publish_faults_if_needed`