feat: sequences v2, bridges, and sim-controller
Rework sequences (engine, seqplay, envelope, API, web UI), add bridge support, add the host sim-controller and rig simulation tests, and update docs, presets and project tooling config. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d664026ee5
commit
2543673bd8
68 files changed
+5761
-460
No files matched your search
@@ -249,6 +249,36 @@ static esp_err_t play_sequence(httpd_req_t *req, const char *id)
|
||||
return api_json(req, "200 OK", o, true);
|
||||
}
|
||||
|
||||
// POST /sequences/<id>/fire {zone_id?, wait?: "now" | "beat" | "downbeat"}: play it once over whatever runs
|
||||
static esp_err_t fire_sequence(httpd_req_t *req, const char *id)
|
||||
{
|
||||
const char *profile = api_current_profile();
|
||||
if (!profile) {
|
||||
return api_error(req, "404 Not Found", "No profile available");
|
||||
}
|
||||
cJSON *body = api_body_opt(req);
|
||||
if (!body) {
|
||||
return ESP_OK;
|
||||
}
|
||||
char zone[24] = "", wait[12] = "now";
|
||||
api_id(cJSON_GetObjectItem(body, "zone_id"), zone, sizeof(zone));
|
||||
const cJSON *w = cJSON_GetObjectItem(body, "wait");
|
||||
if (cJSON_IsString(w)) {
|
||||
snprintf(wait, sizeof(wait), "%s", w->valuestring);
|
||||
}
|
||||
cJSON_Delete(body);
|
||||
const char *msg;
|
||||
esp_err_t err = seqplay_fire(id, zone, profile, wait, &msg);
|
||||
if (err != ESP_OK) {
|
||||
return api_error(req, err == ESP_ERR_NOT_FOUND ? "404 Not Found" : "400 Bad Request",
|
||||
msg ? msg : "animation not found");
|
||||
}
|
||||
cJSON *o = cJSON_CreateObject();
|
||||
cJSON_AddTrueToObject(o, "ok");
|
||||
cJSON_AddStringToObject(o, "wait", wait);
|
||||
return api_json(req, "200 OK", o, true);
|
||||
}
|
||||
|
||||
bool sequences_route(httpd_req_t *req, int n, api_seg_t seg, esp_err_t *ret)
|
||||
{
|
||||
cJSON *all = store_coll("sequence");
|
||||
@@ -291,6 +321,17 @@ bool sequences_route(httpd_req_t *req, int n, api_seg_t seg, esp_err_t *ret)
|
||||
*ret = api_json(req, "200 OK", o, true);
|
||||
return true;
|
||||
}
|
||||
if (n == 3 && method == HTTP_POST && !strcmp(seg[1], "overlay") && !strcmp(seg[2], "stop")) {
|
||||
seqplay_overlay_stop();
|
||||
cJSON *o = cJSON_CreateObject();
|
||||
cJSON_AddTrueToObject(o, "ok");
|
||||
*ret = api_json(req, "200 OK", o, true);
|
||||
return true;
|
||||
}
|
||||
if (n == 3 && method == HTTP_POST && !strcmp(seg[2], "fire")) {
|
||||
*ret = fire_sequence(req, seg[1]);
|
||||
return true;
|
||||
}
|
||||
if (n == 3 && method == HTTP_POST && !strcmp(seg[2], "play")) {
|
||||
*ret = play_sequence(req, seg[1]);
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user