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

@@ -118,14 +118,14 @@ Sender state machine invariants must remain behavior-equivalent:
- `DeviceRole detect_role()`
- configure role pin input pulldown and map to sender/receiver role.
## `src/data_model.cpp`
## `lib/dd3_legacy_core/src/data_model.cpp`
- `void init_device_ids(uint16_t&, char*, size_t)`
- read MAC, derive short ID, format canonical device ID.
- `const char *rx_reject_reason_text(RxRejectReason)`
- stable mapping for diagnostics and payloads.
## `src/html_util.cpp`
## `lib/dd3_legacy_core/src/html_util.cpp`
- `String html_escape(const String&)`
- escape `& < > " '`.
@@ -218,7 +218,7 @@ Sender state machine invariants must remain behavior-equivalent:
- `note_reject`
- `crc16_ccitt`
## `src/payload_codec.cpp`
## `lib/dd3_legacy_core/src/payload_codec.cpp`
- `bool encode_batch(const BatchInput&, uint8_t*, size_t, size_t*)`
- schema v3 encoder with metadata, sparse present mask, delta coding.
@@ -236,7 +236,7 @@ Sender state machine invariants must remain behavior-equivalent:
- Optional self-test:
- `payload_codec_self_test` (when `PAYLOAD_CODEC_TEST`).
## `src/json_codec.cpp`
## `lib/dd3_legacy_core/src/json_codec.cpp`
- `bool meterDataToJson(const MeterData&, String&)`
- create MQTT state JSON with stable field semantics.
@@ -466,6 +466,7 @@ Behavior-critical internals (migrated from pre-refactor `main.cpp`) that must re
Current core orchestration requirements:
- `setup`
- initialize shared subsystems once,
- force-link `dd3_legacy_core` before first legacy-core symbol use (`dd3_legacy_core_force_link()`),
- instantiate role config and call role `begin`,
- keep role-specific runtime out of this file.
- `loop`