Add timesync burst handling and sender-only timeout
- Add TimeSync fault code and labels in UI/SD/web docs - Trigger receiver beacon bursts on sender drift, but keep errors sender-local - Sender flags TimeSync only after TIME_SYNC_ERROR_TIMEOUT_MS
This commit is contained in:
@@ -220,7 +220,7 @@ Fixed header (little-endian):
|
||||
- `err_m` u8 (meter read failures, sender-side counter)
|
||||
- `err_d` u8 (decode failures, sender-side counter)
|
||||
- `err_tx` u8 (LoRa TX failures, sender-side counter)
|
||||
- `err_last` u8 (last error code: 0=None, 1=MeterRead, 2=Decode, 3=LoraTx)
|
||||
- `err_last` u8 (last error code: 0=None, 1=MeterRead, 2=Decode, 3=LoraTx, 4=TimeSync)
|
||||
|
||||
Body:
|
||||
- `E0` u32 (absolute energy in Wh)
|
||||
@@ -303,6 +303,8 @@ inline constexpr uint16_t EXPECTED_SENDER_IDS[NUM_SENDERS] = { 0xF19C };
|
||||
- Receiver time sync packets set the RTC.
|
||||
- On boot, if no LoRa time sync has arrived yet, the sender uses the RTC time as the initial `ts_utc`.
|
||||
- Receiver keeps sending time sync every 60 seconds.
|
||||
- If a sender’s timestamps drift from receiver time by more than `TIME_SYNC_DRIFT_THRESHOLD_SEC`, the receiver enters a burst mode (every `TIME_SYNC_BURST_INTERVAL_MS` for `TIME_SYNC_BURST_DURATION_MS`).
|
||||
- Sender raises a local `TimeSync` error if it has not received a time beacon for `TIME_SYNC_ERROR_TIMEOUT_MS` (default 2 days). This is shown on the sender OLED only and is not sent over LoRa.
|
||||
|
||||
## Build Environments
|
||||
- `lilygo-t3-v1-6-1`: production build (debug on)
|
||||
@@ -321,7 +323,7 @@ Key timing settings in `include/config.h`:
|
||||
- `BATTERY_SAMPLE_INTERVAL_MS`
|
||||
- `BATTERY_CAL`
|
||||
- `BATCH_ACK_TIMEOUT_MS`
|
||||
- `BATCH_MAX_RETRIES`
|
||||
- `BATCH_MAX_RETRIES`
|
||||
- `BATCH_QUEUE_DEPTH`
|
||||
- `BATCH_RETRY_POLICY` (keep or drop on retry exhaustion)
|
||||
- `SERIAL_DEBUG_MODE_FLAG` (build flag) / `SERIAL_DEBUG_DUMP_JSON`
|
||||
@@ -329,6 +331,9 @@ Key timing settings in `include/config.h`:
|
||||
- `ENABLE_SD_LOGGING` / `PIN_SD_CS`
|
||||
- `SENDER_TIMESYNC_WINDOW_MS`
|
||||
- `SENDER_TIMESYNC_CHECK_SEC_FAST` / `SENDER_TIMESYNC_CHECK_SEC_SLOW`
|
||||
- `TIME_SYNC_DRIFT_THRESHOLD_SEC`
|
||||
- `TIME_SYNC_BURST_INTERVAL_MS` / `TIME_SYNC_BURST_DURATION_MS`
|
||||
- `TIME_SYNC_ERROR_TIMEOUT_MS`
|
||||
- `SD_HISTORY_MAX_DAYS` / `SD_HISTORY_MIN_RES_MIN`
|
||||
- `SD_HISTORY_MAX_BINS` / `SD_HISTORY_TIME_BUDGET_MS`
|
||||
- `WEB_AUTH_REQUIRE_STA` / `WEB_AUTH_REQUIRE_AP` / `WEB_AUTH_DEFAULT_USER` / `WEB_AUTH_DEFAULT_PASS`
|
||||
|
||||
Reference in New Issue
Block a user