feat(box3): ESP-NOW CMD executor (D5 contract) #10

Merged
electron merged 1 commits from feat/box3-cmd-executor into main 2026-06-14 09:34:00 +00:00
Owner

Decode structured {op,a} ESP-NOW CMD on the BOX-3 + dispatch (screen/play/evt/led). Built, flashed, proven on hardware (master→ESP-NOW→BOX-3 parse+dispatch).

🤖 Generated with Claude Code

Decode structured {op,a} ESP-NOW CMD on the BOX-3 + dispatch (screen/play/evt/led). Built, flashed, proven on hardware (master→ESP-NOW→BOX-3 parse+dispatch). 🤖 Generated with Claude Code
electron added 1 commit 2026-06-14 09:33:56 +00:00
feat(box3): implement ESP-NOW CMD executor (D5 contract)
CI / platformio (pull_request) Failing after 4m36s
735aaed648
Add cmd_exec.c / cmd_exec.h providing cmd_exec_handle() — a tolerant
cJSON-based dispatcher for structured ESP-NOW CMD frames per the D5
wire contract ({"op":"<verb>","a":{<args>}}, ≤200 bytes).

Supported ops (all logged):
  screen  — renders title/subtitle/symbol on an LVGL full-screen
             overlay via bsp_display_lock; "pulse"/"flash" effect
             tints the background blue.
  play    — logs the path + loop flag, emits an 880 Hz beep via
             audio_play_tone() (no media_manager on box3_voice).
  evt     — logs event name (card→master direction, unusual here).
  led     — logs pattern (stub, no LED ring on box3_voice).
  unknown — ESP_LOGW + ESP_ERR_NOT_SUPPORTED, no crash.

Wire-up in main.c:
  on_mesh_text() callback installed via scenario_mesh_set_text_cb()
  immediately after scenario_mesh_init(). Every SCENARIO_MESH_TEXT_CMD
  frame is decoded and dispatched; EVT frames are logged and ignored.
  cmd_exec.c added to CMakeLists.txt SRCS.

Channel fix in sdkconfig.defaults:
  Document that CONFIG_ZACUS_WIFI_CHANNEL must match the master's
  connected WiFi channel (lab: ch11) for ESP-NOW co-channel operation.

Tested on hardware (BOX-3 MAC 90:e5:b1:cc:05:f8, /dev/cu.usbmodem11301):
  - Build: 2104/2104 targets, 0 errors, 0 warnings on new files.
  - Flash: idf.py -p /dev/cu.usbmodem11301 flash — Done.
  - Serial proof:
      I (10115) zacus-voice: ESP-NOW CMD executor registered (op: screen/play/evt/led)
      I (10115) cmd_exec: CMD op=screen t="ZACUS" u="" y="LA" e="pulse"
      I (13327) cmd_exec: CMD op=play path="/spiffs/ambiance.wav" loop=0 (beep fallback)
      W (16497) cmd_exec: CMD op="explode" unknown — ignored
    All three via POST /game/espnow/cmd on master ({"ok":true,"status":"ESP_OK"}).
electron merged commit 0b530e70e0 into main 2026-06-14 09:34:00 +00:00
electron deleted branch feat/box3-cmd-executor 2026-06-14 09:34:01 +00:00
Sign in to join this conversation.