refactor: stabilize legacy-core linking and header ownership

- Make include/ the canonical declarations for data_model/html_util/json_codec and convert dd3_legacy_core header copies to thin forwarders.
- Add stable public forwarders for app_context/receiver_pipeline/sender_state_machine and update refactor smoke test to stop using ../../src includes.
- Force-link dd3_legacy_core from setup() to ensure deterministic PlatformIO LDF linking across firmware envs.
- Refresh docs (README, Requirements, docs/TESTS.md) to reflect current module paths and smoke-test include strategy.
This commit is contained in:
2026-02-20 23:29:50 +01:00
parent 25709abf8d
commit 0577464ec5
11 changed files with 27 additions and 79 deletions

View File

@@ -8,8 +8,8 @@ Firmware for LilyGO T3 v1.6.1 (`ESP32 + SX1276 + SSD1306`) that runs in two role
- Single codebase, role selected at boot by `detect_role()` (`src/config.cpp`).
- 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 meter ingest is decoupled from LoRa waits via FreeRTOS meter reader task + queue on ESP32 (`src/sender_state_machine.cpp`).
- Batch payload codec is schema `v3` with a 30-bit `present_mask` over `[t_last-29, t_last]` (`lib/dd3_legacy_core/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 catch-up mode drains backlog with immediate extra sends when more than one batch is queued (still ACK-gated, single inflight batch).
@@ -73,7 +73,7 @@ Timezone:
## Sender Meter Path
Implemented by `src/meter_driver.cpp` and sender loop in `src/main.cpp`:
Implemented by `src/meter_driver.cpp` and sender loop in `src/sender_state_machine.cpp`:
- UART: `Serial2`, `GPIO34`, `9600 7E1`
- ESP32 RX buffer enlarged to `8192`
- Frame detection `/ ... !`, timeout `METER_FRAME_TIMEOUT_MS=3000`
@@ -124,7 +124,7 @@ State topic:
Fault topic (retained):
- `smartmeter/<device_id>/faults`
State JSON (`src/json_codec.cpp`) includes:
State JSON (`lib/dd3_legacy_core/src/json_codec.cpp`) includes:
- `id`, `ts`, `e_kwh`
- `p_w`, `p1_w`, `p2_w`, `p3_w`
- `bat_v`, `bat_pct`