feat: port the remaining v1 API to the v2 controller

Profiles seed presets, a default zone and a palette, and clone with their
own copies; deleting a profile removes what it owned. Zones get the v1
list shape, set-current, current, clone and content-fragment. Devices are
keyed by MAC with v1 validation and identify. Patterns: definitions, OTA
file and manifest, upload, driver, and send over ESP-NOW (the led-driver
pattern sources are embedded in the firmware). Pixel outputs get v1
validation and a DDP/Art-Net/sACN test pattern. Sequences, palettes and
settings follow v1 replies and validation, and /ws forwards browser
messages to the drivers.

The resource handlers move out of api.c into res_*.c, patterns.c and
outputs.c. cJSON now allocates from PSRAM: the store had grown enough to
starve internal RAM and abort the mic at boot. /status reports
free_internal.

The Wi-Fi AP and led-tool routes are left out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-03 09:58:17 +13:00
1 parent 4b42391a46
commit 57182188ba
30 files changed
+2846 -425

No files matched your search

+1 -6
View File
@@ -1,6 +1,6 @@
"""Groups, sequences, scenes and palettes."""
from helpers import find_id_by_field, missing, new_id, unique
from helpers import find_id_by_field, new_id, unique
def test_groups(c):
@@ -31,14 +31,12 @@ def test_sequences_crud(c):
assert c.delete(f"/sequences/{sid}").status_code == 200
@missing("sequence step validation")
def test_sequence_step_needs_preset(c):
sid = new_id(c.post("/sequences", json={"name": unique("pytest-seq"), "steps": []}))
assert c.put(f"/sequences/{sid}", json={"steps": [{"duration_s": 1}]}).status_code == 400
c.delete(f"/sequences/{sid}")
@missing("400 for a sequence without zone_id")
def test_sequence_without_zone_cannot_play(c):
sid = new_id(c.post("/sequences", json={"name": unique("pytest-seq"),
"steps": [{"preset_id": "1", "duration_s": 1}]}))
@@ -46,7 +44,6 @@ def test_sequence_without_zone_cannot_play(c):
c.delete(f"/sequences/{sid}")
@missing("sequence play/stop status replies and active flag")
def test_sequence_play_and_stop(c):
profile = new_id(c.post("/profiles", json={"name": unique("pytest-engine")}))
c.post(f"/profiles/{profile}/apply")
@@ -80,7 +77,6 @@ def test_scenes(c):
assert c.delete(f"/scenes/{sid}").status_code == 200
@missing("v1 palette shape ({id, colors})")
def test_palettes(c):
resp = c.post("/palettes", json={"colors": ["#112233", "#445566"]})
assert resp.status_code == 201
@@ -95,7 +91,6 @@ def test_palettes(c):
assert c.delete(f"/palettes/{pid}").status_code == 200
@missing("v1 palette shape ({id, colors})")
def test_palettes_list_is_colour_lists(c):
pid = str(c.post("/palettes", json={"colors": ["#abcdef"]}).json()["id"])
assert c.get("/palettes").json()[pid] == ["#abcdef"]