495da4e366b4ddef75a79e4eae0cec9fd6462013
New espnow_ota module, loaded on the first OTA packet (types 0x07-0x0C, status reply 0x26). Files are written by chunk index to <path>.new, checked against their sha256, and moved into place together on commit, followed by a reset. Unchanged files are skipped, and a repeated commit after the reset still gets OK. - receive ESP-NOW frames from esp.irq() so frames are not lost while presets.tick() runs; polling remains as a fallback - raise rxbuf to 2048 and the link inbox to 24 frames - file_hashes: MicroPython's sha256 has no hexdigest() - bench stats line includes esp.stats() Co-Authored-By: Claude Opus 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%