feat(engine): Pi-side animation engine with protocol outputs and sequencer

Add src/engine, modelled on technicalkiwi/portal's player and sequence runner:

- Pixel generator: runs the unchanged led-driver patterns under CPython
  (utime shim + NeoPixel-like buffer) on a per-zone render thread and
  streams frames to pixel outputs, with keepalive for static frames.
- Output drivers: DDP, Art-Net (ArtDMX/ArtSync), sACN/E1.31, USB-DMX
  (Enttec Pro / Open DMX), plus an ESP32 preset output that reuses the
  existing preset + select delivery path. Registry in db/output.json,
  CRUD and test pattern at /outputs.
- Sequencer: timed preset chains per zone (portal step shape), deadline
  scheduling, loop/repeat, resume after restart; legacy sequence records
  are migrated. Zone play/stop, sequence and scene play/stop endpoints.
- CLI (python -m engine.cli), Outputs and Sequences modals, preset tiles
  drive pixel outputs, API/README docs, engine test suite.

ESP32 firmware is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-10-22 13:24:14 +13:00
1 parent 827eb97203
commit a5a7fc575f
42 files changed
+4117 -75

No files matched your search

+18
View File
@@ -41,3 +41,21 @@ LED controller web app for managing profiles, **zones**, presets, and colour pal
## Driver pattern modules
Pattern **`.py`** sources live under **`led-driver/src/patterns`**. The Pi app resolves that path via `util.driver_patterns.driver_patterns_dir()`. If you deploy without that tree next to the app, set **`LED_CONTROLLER_PATTERNS_DIR`** to the directory that contains those files.
## Animation engine (Pi-side)
`src/engine/` lets the Pi drive LEDs itself, in addition to the ESP32 drivers:
- **Pixel generator**: runs the **unchanged** `led-driver/src/patterns/*.py` under CPython (a `utime` shim plus a NeoPixel-like buffer) with the same preset JSON the drivers get, and streams each frame to **pixel outputs**: DDP, Art-Net, sACN (E1.31), or USB-DMX (Enttec Pro / Open DMX). Configure outputs in **Outputs** (edit mode) and add an output's name to a zone's devices.
- **Preset sequencer**: **Sequences** play timed chains of presets on a zone, switching both the pixel outputs and the zone's ESP32 drivers. Sequences resume after a restart.
- ESP32 firmware is unchanged; drivers still get presets + `select`.
CLI (run from `src/`):
```bash
python -m engine.cli --output "ddp://192.168.1.60?pixels=300" --test
python -m engine.cli --output "artnet://192.168.1.61?universe=0&pixels=170" --preset 16
python -m engine.cli --pattern rainbow --n1 2 --leds 60 # terminal preview
```
Tests: `pipenv run pytest tests/engine_tests`.