20d1af7177c831185ada08cd512f0e90cd52bd9d
Adds the driver half of the v2 controller link as extra 0x4C message types: DATA with fragment reassembly, de-duplication and acks, a state-version digest with jittered resync requests, a bench echo, and a BEAT frame handled by BeatSync (accepts one of the two copies, free-runs on the last period when a beat is missed). Presets.beat() steps the selected pattern without a message. Optional settings: espnow_loss, bench, beat_pin, usb_log. The working tree also carries the files already running on the bench device, which were ahead of origin/p2p: board.py (per-chip LED pin and CPU speed), the reversed device_config flag in controller_messages.py, and the apply_cpu_freq call in main.py. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
LED Driver — MicroPython
MicroPython LED driver for ESP32: presets, patterns, Wi-Fi (TCP + UDP discovery) or ESP-NOW transport, optional HTTP polling, and dynamic pattern modules under src/patterns/.
Prerequisites
- MicroPython firmware on the ESP32
- USB cable for programming
- Python 3 with pipenv (on the host, for
dev.py/ tests)
Setup
-
Install dependencies:
pipenv install -
Deploy to the device:
pipenv run dev
Project layout
led-driver/
├── src/
│ ├── main.py # Entry: Wi-Fi/TCP or ESP-NOW path, process_data(), manifest OTA
│ ├── presets.py # Preset runtime + Presets class
│ ├── preset.py # Single preset helpers
│ ├── settings.py # settings.json
│ ├── hello.py # UDP discovery (port 8766) / hello payloads
│ ├── http_poll.py # Optional HTTP polling helper
│ ├── utils.py # Colour conversion / ordering
│ ├── presets.json # Default preset file (on device)
│ └── patterns/ # Pattern modules (.py), loaded dynamically
├── tests/ # Host-side helpers (e.g. udp_client.py, test_mdns.py)
├── test/ # On-device style pattern tests (all.py, patterns/)
├── dev.py # Deploy / sync to serial device
├── docs/API.md # Wire format (long keys); Pi app docs short keys
├── msg.json # Sample message
├── Pipfile
└── LICENSE
Transport: settings.json transport_type is typically wifi (TCP to the Pi on port 8765, discovery on 8766) or espnow. ESP-NOW code paths are loaded only when needed so a Wi-Fi-only image stays smaller.
Further reading
docs/API.md— JSON message fields as used in examples (pattern,colors, …). The Pi app may send short keys (p,c, …); behaviour matches once normalised on device.
Languages
Python
100%