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

@@ -75,14 +75,14 @@ async def send_presets(request):
if not isinstance(preset_ids, list) or not preset_ids:
return json.dumps({"error": "preset_ids must be a non-empty list"}), 400, {'Content-Type': 'application/json'}
# Build API-compliant preset map keyed by preset name
# Build API-compliant preset map keyed by preset ID (not name)
presets_by_name = {}
for pid in preset_ids:
preset_data = presets.read(str(pid))
if not preset_data:
continue
name_key = preset_data.get('name') or str(pid)
presets_by_name[name_key] = build_preset_dict(preset_data)
preset_id_key = str(pid)
presets_by_name[preset_id_key] = build_preset_dict(preset_data)
if not presets_by_name:
return json.dumps({"error": "No matching presets found"}), 404, {'Content-Type': 'application/json'}