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

+37
View File
@@ -0,0 +1,37 @@
"""Output registry validation."""
import pytest
from models.output import validate_output
def test_valid_records_are_normalised():
doc = validate_output({"name": " wall ", "protocol": "DDP", "host": "10.0.0.5", "pixel_count": "300",
"color_order": "GRB"})
assert doc["name"] == "wall" and doc["protocol"] == "ddp" and doc["pixel_count"] == 300
assert doc["color_order"] == "grb" and doc["enabled"] is True and doc["port"] is None
art = validate_output({"name": "a", "protocol": "artnet", "universe": 0, "pixel_count": 170})
assert art["universe"] == 0 and art["host"] == ""
sacn = validate_output({"name": "s", "protocol": "sacn", "universe": 5})
assert sacn["universe"] == 5
dmx = validate_output({"name": "d", "protocol": "dmx_serial", "serial_port": "/dev/ttyUSB0",
"channel": 1, "pixel_count": 170})
assert dmx["dmx_mode"] == "enttec_pro"
@pytest.mark.parametrize("data,message", [
({"protocol": "ddp", "host": "x"}, "name"),
({"name": "a", "protocol": "foo"}, "protocol"),
({"name": "a", "protocol": "ddp"}, "host"),
({"name": "a", "protocol": "dmx_serial"}, "serial_port"),
({"name": "a", "protocol": "dmx_serial", "serial_port": "/dev/x", "dmx_mode": "bad"}, "dmx_mode"),
({"name": "a", "protocol": "dmx_serial", "serial_port": "/dev/x", "channel": 500, "pixel_count": 10}, "pixel_count"),
({"name": "a", "protocol": "sacn", "universe": 0}, "universe"),
({"name": "a", "protocol": "artnet", "pixel_count": 0}, "pixel_count"),
({"name": "a", "protocol": "artnet", "brightness": 300}, "brightness"),
({"name": "a", "protocol": "artnet", "color_order": "rgbw"}, "color_order"),
({"name": "a", "protocol": "ddp", "host": "h", "port": "abc"}, "port"),
])
def test_invalid_records(data, message):
with pytest.raises(ValueError, match=message):
validate_output(data)