feat: ESP-NOW link, beat sync and control messages in the C++ driver

- espnow_link, ctrl_msg and beat_sync: the reliable link, envelopes and
  beat-synced timing.
- ctrl_msg: accept an envelope with the trailing save byte.
- patterns_frame() and espnow_link_poll() split out of their tasks, so the
  WebAssembly simulator can drive one frame and one link pass from a timer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-16 19:32:36 +13:00
1 parent 94e300f6ad
commit 24dd5ffb15
30 files changed
+2159 -158

No files matched your search

+23
View File
@@ -102,3 +102,26 @@ Build and flash for the ESP32-C3:
idf.py set-target esp32c3
idf.py build flash monitor
```
### ESP-NOW (led-controller)
The driver takes part in an ESP-NOW rig run by `led-controller` (the same 0x4C wire protocol as the
MicroPython drivers). It announces itself at boot, so the controller lists it with its name and LED count
(`transport: espnow`), and then takes:
- presets and selects, the brightness, device settings (`device_config`), the zones (group commands) and
the startup preset, from v2/v3 envelopes and v1 JSON;
- the controller's reliable messages: acknowledged, reassembled, duplicates dropped, state resynced by digest;
- pings, and the beat for beat-timed presets (`tb`), which take their quarter-beat length from the
controller's tempo.
Settings (`GET`/`POST /api/espnow`): `enabled`, and `channel` (1-13). ESP-NOW uses the radio's channel:
the access point's, or the router's when the client is joined. Put the controller's bridge on the same
channel. A client that is searching for a network that is not in range keeps the radio hopping channels,
which breaks ESP-NOW; the access point gives it a fixed channel.
Saving Wi-Fi credentials (`POST /api/wifi`, or the Settings tab) switches to Wi-Fi mode: ESP-NOW is turned
off and the driver restarts, then joins the saved network. Turn ESP-NOW back on with `POST /api/espnow` and
a restart.
Not supported yet: OTA over ESP-NOW, the reverse (`reversed`) setting, and the lossy-link test mode.