Document hourly and first-sync sender fault counter resets

This commit is contained in:
2026-02-17 01:28:20 +01:00
parent 3aff6ea666
commit 1bdae03cc4
2 changed files with 15 additions and 0 deletions

View File

@@ -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/<device_id>/<key>/config`

View File

@@ -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`