feat: browser simulator served by the controller, desktop build, browser bridge
- led-simulator: the rig runs the C++ led-driver as WebAssembly (sim-driver/), one single-threaded worker per bar, no cross-origin isolation needed. Rooms (one JSON per room) with an on-page editor, and a pattern gallery. The Python server, Pyodide boot and ring buffer are removed. - sim-controller sim_rig.c: serves /sim/ from an embedded pack, the page's WebSocket and the rooms/flash API. The desktop build embeds it too. - bridge.c: a "browser" bridge kind that carries ESP-NOW frames to the page; devices announced through it are marked sim. - UI: Simulator in the Menu, split view with resize and pop-out, swipe between controller and rig on phones; SIM/REAL badges in Devices. - Fades: preset pushes and Wi-Fi driver bodies always carry fade and beat_time, so "off" no longer inherits an earlier fade. - Also the sequences-v2 work in progress: desktop port, bridge firmware, serial bridge, Wi-Fi drivers, sequence timeline, audio and API changes. - led-driver: ESP-NOW link, beat sync, control messages, sim hooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
698c1463c0
commit
581b751904
506 files changed
+42336
-3599
No files matched your search
+44
-1
@@ -813,7 +813,15 @@ bool zones_route(httpd_req_t *req, int n, api_seg_t seg, esp_err_t *ret)
|
||||
*ret = api_error(req, "404 Not Found", "Preset not found");
|
||||
return true;
|
||||
}
|
||||
esp_err_t err = skip ? ESP_OK : engine_play(seg[1], key);
|
||||
// A looping preset takes over the zone from a looping sequence; a one-shot playing over the
|
||||
// zone comes back to this preset when it ends
|
||||
seqplay_end_base_in(seg[1]);
|
||||
esp_err_t err = ESP_OK;
|
||||
if (skip) {
|
||||
engine_zone_note(seg[1], key);
|
||||
} else {
|
||||
err = engine_play(seg[1], key);
|
||||
}
|
||||
if (err != ESP_OK) {
|
||||
*ret = api_result(req, err, "");
|
||||
return true;
|
||||
@@ -859,6 +867,40 @@ static bool zone_has_presets(const cJSON *z)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Older zones list one-shot sequences ("animations") apart, in animation_ids: move them to the end of
|
||||
// sequence_ids, where one-shots and looping sequences now sit together. True when the zone changed.
|
||||
bool api_zone_fold_oneshots(cJSON *z)
|
||||
{
|
||||
cJSON *anims = cJSON_GetObjectItem(z, "animation_ids");
|
||||
if (!anims) {
|
||||
return false;
|
||||
}
|
||||
cJSON *seqs = cJSON_GetObjectItem(z, "sequence_ids");
|
||||
if (!cJSON_IsArray(seqs)) {
|
||||
seqs = cJSON_CreateArray();
|
||||
api_set(z, "sequence_ids", seqs);
|
||||
}
|
||||
const cJSON *a;
|
||||
cJSON_ArrayForEach(a, anims)
|
||||
{
|
||||
char id[24], have[24];
|
||||
if (!api_id(a, id, sizeof(id))) {
|
||||
continue;
|
||||
}
|
||||
bool dup = false;
|
||||
const cJSON *s;
|
||||
cJSON_ArrayForEach(s, seqs)
|
||||
{
|
||||
dup = dup || (api_id(s, have, sizeof(have)) && !strcmp(have, id));
|
||||
}
|
||||
if (!dup) {
|
||||
cJSON_AddItemToArray(seqs, cJSON_CreateString(id));
|
||||
}
|
||||
}
|
||||
cJSON_DeleteItemFromObject(z, "animation_ids");
|
||||
return true;
|
||||
}
|
||||
|
||||
// main's Zone.load: group_ids, preset_group_ids, sequence_ids and content_kind on every zone
|
||||
void api_migrate_zones(void)
|
||||
{
|
||||
@@ -881,6 +923,7 @@ void api_migrate_zones(void)
|
||||
api_set(z, "sequence_ids", cJSON_CreateArray());
|
||||
changed = true;
|
||||
}
|
||||
changed = api_zone_fold_oneshots(z) || changed;
|
||||
const cJSON *kind = cJSON_GetObjectItem(z, "content_kind");
|
||||
if (!(cJSON_IsString(kind) && (!strcmp(kind->valuestring, "presets") || !strcmp(kind->valuestring, "sequences")))) {
|
||||
bool seqs = cJSON_GetArraySize(cJSON_GetObjectItem(z, "sequence_ids")) > 0;
|
||||
|
||||
Reference in new issue
Block a user