Document sender efficiency and reliability improvements

This commit is contained in:
2026-02-17 01:17:35 +01:00
parent e0f3ffc21c
commit d327f9b68a
2 changed files with 28 additions and 2 deletions

View File

@@ -10,6 +10,8 @@ Firmware for LilyGO T3 v1.6.1 (`ESP32 + SX1276 + SSD1306`) that runs in two role
- LoRa transport is wrapped with firmware-level CRC16-CCITT (`src/lora_transport.cpp`).
- Sender meter ingest is decoupled from LoRa waits via FreeRTOS meter reader task + queue on ESP32 (`src/main.cpp`).
- Batch payload codec is schema `v3` with a 30-bit `present_mask` over `[t_last-29, t_last]` (`src/payload_codec.cpp`).
- 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.
- Receiver runs STA mode if stored config is valid and connects, otherwise AP fallback.
@@ -44,6 +46,7 @@ Payload codec (`schema=3`, magic `0xDDB3`) carries:
- `flags bit0`: `time_valid`
- ACK is repeated (`ACK_REPEAT_COUNT=3`, `ACK_REPEAT_DELAY_MS=200`)
- Sender sets local time only if `time_valid=1` and `epoch >= MIN_ACCEPTED_EPOCH_UTC` (`2026-02-01 00:00:00 UTC`)
- Sender ACK wait windows are adaptive (short first window, expanded second window on miss)
## Time Bootstrap and Timezone
@@ -68,6 +71,8 @@ Implemented by `src/meter_driver.cpp` and sender loop in `src/main.cpp`:
- UART: `Serial2`, `GPIO34`, `9600 7E1`
- ESP32 RX buffer enlarged to `8192`
- Frame detection `/ ... !`, timeout `METER_FRAME_TIMEOUT_MS=3000`
- Single-pass OBIS line dispatch (no repeated multi-key scans per line)
- Fixed-point decimal parser (dot/comma decimals), with early-exit once all required OBIS fields are captured
- Parsed OBIS fields:
- `0-0:96.8.0*255` meter Sekundenindex (hex u32)
- `1-0:1.8.0` total energy (auto scales Wh -> kWh when unit is Wh)
@@ -81,6 +86,14 @@ Timestamp derivation:
Sender builds sparse 30-slot windows and sends every `METER_SEND_INTERVAL_MS` (`30s`).
Sender diagnostics (serial debug mode):
- periodic structured `diag:` line with:
- meter parser counters (`ok/parse_fail/overflow/timeout`)
- meter queue stats (`depth/high-watermark/drops`)
- ACK stats (`last RTT`, `EWMA RTT`, `miss streak`, timeout/retry totals)
- sender runtime totals (`rx window ms`, `sleep ms`)
- diagnostics are local-only (serial); LoRa payload schema/fields are unchanged.
## Receiver Behavior
For decoded `BatchUp`: