Channel 11 defaults, ESP-NOW driver config and rig/desktop updates
Moves the controller, bridge and led-driver default ESP-NOW channel to 11 and updates the led-driver and led-tool submodule pointers. Includes the rest of the working tree: web UI, desktop and sim-controller changes, API and bridge code, graphify output, and the .gitea and fixture-driver folders. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
35207a868a
commit
edf35e9c71
280 files changed
+24043
-1756
No files matched your search
@@ -98,6 +98,57 @@ static esp_err_t send_presets(httpd_req_t *req)
|
||||
return api_json(req, "200 OK", o, true);
|
||||
}
|
||||
|
||||
// A preset that was saved goes to every driver, which keeps it: sequences then only select it
|
||||
static void push_saved(const char *id)
|
||||
{
|
||||
cJSON *ids = cJSON_CreateArray();
|
||||
cJSON_AddItemToArray(ids, cJSON_CreateString(id));
|
||||
engine_send_presets(ids, true, NULL, NULL, NULL);
|
||||
cJSON_Delete(ids);
|
||||
}
|
||||
|
||||
// POST /presets/sync: every preset of the current profile to every driver (broadcast), saved on each
|
||||
static esp_err_t sync_presets(httpd_req_t *req)
|
||||
{
|
||||
cJSON *ids = cJSON_CreateArray();
|
||||
const cJSON *it;
|
||||
cJSON_ArrayForEach(it, store_coll("preset"))
|
||||
{
|
||||
if (api_preset_in_profile(it)) {
|
||||
cJSON_AddItemToArray(ids, cJSON_CreateString(it->string));
|
||||
}
|
||||
}
|
||||
int sent = 0;
|
||||
esp_err_t err = ids->child ? engine_send_presets(ids, true, NULL, NULL, &sent) : ESP_ERR_NOT_FOUND;
|
||||
cJSON_Delete(ids);
|
||||
if (err != ESP_OK) {
|
||||
return api_result(req, err, "");
|
||||
}
|
||||
cJSON *o = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(o, "message", "Presets synced to all drivers");
|
||||
cJSON_AddNumberToObject(o, "presets_sent", sent);
|
||||
return api_json(req, "200 OK", o, true);
|
||||
}
|
||||
|
||||
// POST /presets/clear: every driver deletes its stored presets (broadcast), the counterpart of Sync to Devices
|
||||
static esp_err_t clear_presets_all(httpd_req_t *req)
|
||||
{
|
||||
cJSON *msg = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(msg, "v", "1");
|
||||
cJSON_AddTrueToObject(msg, "clear_presets");
|
||||
cJSON_AddTrueToObject(msg, "save");
|
||||
cJSON *messages = cJSON_CreateArray();
|
||||
cJSON_AddItemToArray(messages, msg);
|
||||
esp_err_t err = engine_push(messages, NULL);
|
||||
cJSON_Delete(messages);
|
||||
if (err != ESP_OK) {
|
||||
return api_result(req, err, "");
|
||||
}
|
||||
cJSON *o = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(o, "message", "Presets cleared on all drivers");
|
||||
return api_json(req, "200 OK", o, true);
|
||||
}
|
||||
|
||||
bool presets_route(httpd_req_t *req, int n, api_seg_t seg, esp_err_t *ret)
|
||||
{
|
||||
const int method = req->method;
|
||||
@@ -109,6 +160,14 @@ bool presets_route(httpd_req_t *req, int n, api_seg_t seg, esp_err_t *ret)
|
||||
*ret = send_presets(req);
|
||||
return true;
|
||||
}
|
||||
if (n == 2 && method == HTTP_POST && !strcmp(seg[1], "sync")) {
|
||||
*ret = sync_presets(req);
|
||||
return true;
|
||||
}
|
||||
if (n == 2 && method == HTTP_POST && !strcmp(seg[1], "clear")) {
|
||||
*ret = clear_presets_all(req);
|
||||
return true;
|
||||
}
|
||||
const char *profile = api_current_profile();
|
||||
if (n == 1 && method == HTTP_POST) {
|
||||
if (!profile) {
|
||||
@@ -127,6 +186,7 @@ bool presets_route(httpd_req_t *req, int n, api_seg_t seg, esp_err_t *ret)
|
||||
char id[16];
|
||||
api_add("preset", rec, id, sizeof(id));
|
||||
store_save("preset");
|
||||
push_saved(id);
|
||||
*ret = send_keyed(req, "201 Created", id, rec);
|
||||
return true;
|
||||
}
|
||||
@@ -147,6 +207,7 @@ bool presets_route(httpd_req_t *req, int n, api_seg_t seg, esp_err_t *ret)
|
||||
api_set(rec, "profile_id", cJSON_CreateString(profile));
|
||||
}
|
||||
store_save("preset");
|
||||
push_saved(seg[1]);
|
||||
*ret = api_json(req, "200 OK", rec, false);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user