Align controller backend and data with new presets

Update palettes, profiles, tabs, preset sending, and ESPNow message format to match the new preset defaults and driver short-field schema.
This commit is contained in:
2026-01-29 00:04:23 +13:00
parent fd37183400
commit cf1d831b5a
11 changed files with 305 additions and 67 deletions

View File

@@ -97,7 +97,7 @@ def build_preset_dict(preset_data):
})
"""
# Ensure colors are in hex format
colors = preset_data.get("colors", ["#FFFFFF"])
colors = preset_data.get("colors", preset_data.get("c", ["#FFFFFF"]))
if colors:
# Convert RGB tuples to hex strings if needed
if isinstance(colors[0], list) and len(colors[0]) == 3:
@@ -111,12 +111,13 @@ def build_preset_dict(preset_data):
else:
colors = ["#FFFFFF"]
# Build payload using the short keys expected by led-driver
preset = {
"pattern": preset_data.get("pattern", "off"),
"colors": colors,
"delay": preset_data.get("delay", 100),
"brightness": preset_data.get("brightness", preset_data.get("br", 127)),
"auto": preset_data.get("auto", True),
"p": preset_data.get("pattern", preset_data.get("p", "off")),
"c": colors,
"d": preset_data.get("delay", preset_data.get("d", 100)),
"b": preset_data.get("brightness", preset_data.get("b", preset_data.get("br", 127))),
"a": preset_data.get("auto", preset_data.get("a", True)),
"n1": preset_data.get("n1", 0),
"n2": preset_data.get("n2", 0),
"n3": preset_data.get("n3", 0),