[codex] align espnow interop and add terminal dtmf tests #5

Merged
electron-rare merged 1 commits from codex/espnow-zacus-killlife-sync into audit/telephony-webserver 2026-02-20 22:05:19 +00:00
electron-rare commented 2026-02-20 21:57:30 +00:00 (Migrated from github.com)

Context

This PR aligns RTC_BL_PHONE with active cross-repo collaboration needs:

  • Runtime interoperability with le-mystere-professeur-zacus ESP-NOW payload formats.
  • Reusable engineering process baseline from Kill_LIFE (gates/evidence mindset).
  • Local terminal-only test flow on macOS without requiring board upload/reset for every check.

Problem

Two practical gaps were slowing collaboration:

  1. ESP-NOW runtime control was incomplete for parity with the Zacus command surface (no explicit ESPNOW_ON / ESPNOW_OFF).
  2. Bridge command decoding was too narrow (cmd/raw only), while incoming payloads from companion stacks may use nested structures (event, message, payload) or alternate keys (command, action).
  3. ESP-NOW TX metrics could be inflated because success could be counted both at send call return and at send callback.
  4. Local test loop in terminal was not straightforward without hardware upload hooks.

Root Cause

  • Cross-repo protocol assumptions diverged over time.
  • Bridge parser logic in RTC_BL_PHONE was optimized for a limited payload shape.
  • ESP-NOW metrics logic mixed enqueue-level and callback-level acknowledgements.
  • No single script encoded the intended no-hardware terminal gate.

What Changed

ESP-NOW interop and runtime control

  • Added serial/runtime commands:
    • ESPNOW_ON
    • ESPNOW_OFF
  • Added EspNowBridge::stop() for explicit deinit path.
  • Added re-entry protection in EspNowBridge::begin() when already active.

Bridge payload compatibility

  • Added recursive command extraction helper in src/main.cpp that accepts:
    • direct keys: cmd, raw, command, action
    • nested objects/values in: event, message, payload
  • Updated inbound bridge execution path to use this extractor.

Metrics correctness

  • Adjusted ESP-NOW TX accounting to avoid double-counting success events.
  • Added last_rx_payload in status JSON for better observability.

Test and docs baseline

  • Added host DTMF test executable (test/host/test_dtmf_host.cpp) with synthetic tone scenarios.
  • Added scripts/test_terminal.sh to run:
    • PlatformIO test build (no upload/no hardware)
    • Host DTMF tests on macOS/Linux terminal.
  • Added cross-repo intelligence reference:
    • docs/CROSS_REPO_INTELLIGENCE.md
  • Updated protocol notes:
    • docs/props.md
    • docs/AGENT_TODO.md

User Impact

  • More reliable pairing with sibling ESP-NOW stacks and story/event emitters.
  • Better runtime control for debugging/bench workflows.
  • Cleaner metrics for diagnostics and QA reporting.
  • Faster local iteration loop in terminal without mandatory board interaction.

Validation

Executed locally on macOS:

  • bash scripts/test_terminal.sh -> PASS
  • platformio run -e esp32dev -> SUCCESS

Notes

  • This PR intentionally excludes unrelated local modifications already present in working tree (reports/manual artifacts/Bluetooth ongoing edits).
  • Follow-up coordination issue is created in le-mystere-professeur-zacus to keep protocol parity explicit.
## Context This PR aligns `RTC_BL_PHONE` with active cross-repo collaboration needs: - Runtime interoperability with `le-mystere-professeur-zacus` ESP-NOW payload formats. - Reusable engineering process baseline from `Kill_LIFE` (gates/evidence mindset). - Local terminal-only test flow on macOS without requiring board upload/reset for every check. ## Problem Two practical gaps were slowing collaboration: 1. ESP-NOW runtime control was incomplete for parity with the Zacus command surface (no explicit `ESPNOW_ON` / `ESPNOW_OFF`). 2. Bridge command decoding was too narrow (`cmd`/`raw` only), while incoming payloads from companion stacks may use nested structures (`event`, `message`, `payload`) or alternate keys (`command`, `action`). 3. ESP-NOW TX metrics could be inflated because success could be counted both at send call return and at send callback. 4. Local test loop in terminal was not straightforward without hardware upload hooks. ## Root Cause - Cross-repo protocol assumptions diverged over time. - Bridge parser logic in `RTC_BL_PHONE` was optimized for a limited payload shape. - ESP-NOW metrics logic mixed enqueue-level and callback-level acknowledgements. - No single script encoded the intended no-hardware terminal gate. ## What Changed ### ESP-NOW interop and runtime control - Added serial/runtime commands: - `ESPNOW_ON` - `ESPNOW_OFF` - Added `EspNowBridge::stop()` for explicit deinit path. - Added re-entry protection in `EspNowBridge::begin()` when already active. ### Bridge payload compatibility - Added recursive command extraction helper in `src/main.cpp` that accepts: - direct keys: `cmd`, `raw`, `command`, `action` - nested objects/values in: `event`, `message`, `payload` - Updated inbound bridge execution path to use this extractor. ### Metrics correctness - Adjusted ESP-NOW TX accounting to avoid double-counting success events. - Added `last_rx_payload` in status JSON for better observability. ### Test and docs baseline - Added host DTMF test executable (`test/host/test_dtmf_host.cpp`) with synthetic tone scenarios. - Added `scripts/test_terminal.sh` to run: - PlatformIO test build (no upload/no hardware) - Host DTMF tests on macOS/Linux terminal. - Added cross-repo intelligence reference: - `docs/CROSS_REPO_INTELLIGENCE.md` - Updated protocol notes: - `docs/props.md` - `docs/AGENT_TODO.md` ## User Impact - More reliable pairing with sibling ESP-NOW stacks and story/event emitters. - Better runtime control for debugging/bench workflows. - Cleaner metrics for diagnostics and QA reporting. - Faster local iteration loop in terminal without mandatory board interaction. ## Validation Executed locally on macOS: - `bash scripts/test_terminal.sh` -> PASS - `platformio run -e esp32dev` -> SUCCESS ## Notes - This PR intentionally excludes unrelated local modifications already present in working tree (reports/manual artifacts/Bluetooth ongoing edits). - Follow-up coordination issue is created in `le-mystere-professeur-zacus` to keep protocol parity explicit.
electron-rare commented 2026-02-20 21:57:52 +00:00 (Migrated from github.com)

Cross-repo coordination issue opened in Zacus: https://github.com/electron-rare/le-mystere-professeur-zacus/issues/90

Cross-repo coordination issue opened in Zacus: https://github.com/electron-rare/le-mystere-professeur-zacus/issues/90
electron-rare commented 2026-02-20 22:04:07 +00:00 (Migrated from github.com)

Coordination + gates pio exécutés avec le repo collègue (le-mystere-professeur-zacus) :

  • Zacus (feat/freenove-ap-local-espnow-rtc-sync)
    • pio run -e freenove_esp32s3_full_with_ui -> PASS
    • pio run -e esp32dev -> PASS
  • RTC (codex/espnow-zacus-killlife-sync)
    • bash scripts/test_terminal.sh -> PASS (build embarqué + host DTMF)

Issue de synchro protocole maintenue ici: https://github.com/electron-rare/le-mystere-professeur-zacus/issues/90

Coordination + gates pio exécutés avec le repo collègue (`le-mystere-professeur-zacus`) : - Zacus (`feat/freenove-ap-local-espnow-rtc-sync`) - `pio run -e freenove_esp32s3_full_with_ui` -> PASS - `pio run -e esp32dev` -> PASS - RTC (`codex/espnow-zacus-killlife-sync`) - `bash scripts/test_terminal.sh` -> PASS (build embarqué + host DTMF) Issue de synchro protocole maintenue ici: https://github.com/electron-rare/le-mystere-professeur-zacus/issues/90
Sign in to join this conversation.