feat(v2): ESP32-S3 controller with Ethernet, I2S mic beat detection and ESP-NOW

New ESP-IDF project in v2/ that replaces the Pi and the UART bridge:

- W5500 Ethernet, INMP441 beat/tempo detector (from esp32-eth), ESP-NOW master
- LittleFS data store and a JSON API over the Pi's db/*.json collections,
  with /db import and export; web UI minified and gzipped at build time
- Zone play/stop as 0x4C GROUP_CMD, preset push/send as CMD (binary v2
  envelope, byte-identical to src/util/binary_envelope.py), sequencer and
  scenes, driver registration from the boot hello
- Reliable bulk link: acks with retransmit, fragments, state-version digest
  and resync; beat frames sent twice with a lead so drivers fire together
- Bench tooling: lossy-link mode, synthetic beats with echo measurement,
  USB and logic-analyzer latency scripts, and docs/BENCH_TEST.md

Needs the matching led-driver changes (p2p branch) to receive the link and
beat frames.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Sonnet 5.5 committed 2026-10-27 17:15:28 +13:00
1 parent 7336c7fb22
commit a94d6a7de5
37 files changed
+5109

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
#pragma once
#include <stdbool.h>
#include "cJSON.h"
#include "esp_err.h"
// Zone play/stop, preset push/send and the sequencer. Drivers run the patterns
// themselves; this builds preset + select frames and hands them to ESP-NOW.
// Start the sequencer task; sequences marked active resume after a short delay
esp_err_t engine_init(void);
// Select a preset on every driver named in the zone (broadcast, sent twice)
esp_err_t engine_play(const char *zone_id, const char *preset_id);
// Turn the zone's drivers off and stop its sequence
esp_err_t engine_stop(const char *zone_id);
// POST /presets/push: v1 messages for targets (MAC strings), or broadcast when targets is NULL
esp_err_t engine_push(const cJSON *messages, const cJSON *targets);
// POST /presets/send: presets from the current profile by id
esp_err_t engine_send_presets(const cJSON *ids, bool save, const char *def, const cJSON *targets, int *sent);
esp_err_t engine_seq_play(const char *seq_id);
esp_err_t engine_seq_stop(const char *seq_id);
esp_err_t engine_scene_play(const char *scene_id);
esp_err_t engine_scene_stop(const char *scene_id);
// Caller owns the result
cJSON *engine_status(void);
// Zones or devices changed: re-send group membership to every registered ESP-NOW driver
void engine_groups_changed(void);