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:
jimmyandClaude Haiku 5.5 committed 2026-11-21 01:19:02 +13:00
1 parent 35207a868a
commit edf35e9c71
280 files changed
+24043 -1756

No files matched your search

+40 -7
View File
@@ -18,6 +18,8 @@
#include "store.h"
#include "wifi_drv.h"
static const char *TAG = "devices";
#define IDENTIFY_OFF_MS 2000
// Trimmed copy of a string field; false when missing or blank
@@ -189,8 +191,11 @@ static esp_err_t create_device(httpd_req_t *req)
return api_json(req, "201 Created", o, true);
}
// Settings a driver keeps in its own settings.json and takes from a device_config message
static const char *const DEVICE_CONFIG_KEYS[] = { "name", "max_brightness", "num_leds", "color_order", "startup_mode", "reversed" };
// Settings a driver keeps in its own settings.json and takes from a device_config message. "pin" (the strip's
// data GPIO) and "espnow_channel" (the driver restarts onto it) are what the bare ESP-NOW driver adds: with no
// web interface or USB config, this is how its settings are changed. Drivers announce them back.
static const char *const DEVICE_CONFIG_KEYS[] = { "name", "max_brightness", "num_leds", "color_order", "startup_mode", "reversed",
"pin", "espnow_channel" };
// The driver settings present in a device update, or NULL when it has none. Caller deletes the result.
static cJSON *device_config_from(const cJSON *body)
@@ -666,19 +671,47 @@ static esp_err_t ping_devices(httpd_req_t *req)
}
uint8_t pkt[6] = { 0x4C, 0x05, id & 255, (id >> 8) & 255, (id >> 16) & 255, id >> 24 };
esp_err_t err = ESP_OK;
if (unicast) { // one acked frame to each known device
if (unicast) { // one frame to each known device
// The MACs are collected under the lock and sent after it: there are often more devices than the send queue
// holds, so a full queue is waited on rather than failing the ping, and HTTP must not wait meanwhile.
int nmac = 0;
uint8_t(*macs)[6] = malloc((size_t)cJSON_GetArraySize(store_coll("device")) * 6 + 6);
if (!macs) {
err = ESP_ERR_NO_MEM;
}
cJSON *d;
cJSON_ArrayForEach(d, store_coll("device"))
{
unsigned m[6];
const cJSON *tr = cJSON_GetObjectItem(d, "transport");
bool wifi = cJSON_IsString(tr) && !strcmp(tr->valuestring, "wifi"); // ids are hostnames, not MACs
if (!wifi && d->string && sscanf(d->string, "%2x%2x%2x%2x%2x%2x", &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]) == 6) {
uint8_t mac[6] = { m[0], m[1], m[2], m[3], m[4], m[5] };
esp_err_t e = espnow_tx_send(mac, pkt, sizeof(pkt));
err = e != ESP_OK ? e : err;
if (macs && !wifi && d->string &&
sscanf(d->string, "%2x%2x%2x%2x%2x%2x", &m[0], &m[1], &m[2], &m[3], &m[4], &m[5]) == 6) {
for (int k = 0; k < 6; k++) {
macs[nmac][k] = (uint8_t)m[k];
}
nmac++;
}
}
if (macs) {
store_unlock();
int sent = 0;
for (int i = 0; i < nmac; i++) {
esp_err_t e = espnow_tx_send(macs[i], pkt, sizeof(pkt));
for (int tries = 0; e == ESP_ERR_NO_MEM && tries < 100; tries++) { // up to 0.5 s for room
vTaskDelay(pdMS_TO_TICKS(5));
e = espnow_tx_send(macs[i], pkt, sizeof(pkt));
}
sent += e == ESP_OK;
if (e != ESP_OK) {
ESP_LOGW(TAG, "ping: no send to %02x%02x%02x%02x%02x%02x: %s", macs[i][0], macs[i][1], macs[i][2],
macs[i][3], macs[i][4], macs[i][5], esp_err_to_name(e));
}
}
store_lock();
free(macs);
err = (nmac == 0 || sent > 0) ? ESP_OK : ESP_FAIL; // a few unsent frames only cost those replies
}
} else {
err = espnow_tx_send(NULL, pkt, sizeof(pkt));
vTaskDelay(pdMS_TO_TICKS(20));