feat: sequence window, finer timeline, zone brightness to Wi-Fi drivers
- A sequence's length is a fixed window (window_beats / window_seconds), not its presets. The timeline is exactly the window long; clips past it are cut on save. - The ruler adds finer ticks when zoomed in; Snap has Auto (follows the zoom), 0.25 s and 0.05 s. Steps and the window go down to 50 ms. - Ctrl+wheel zooms around the pointer; the zoom buttons zoom around the last pointer position. - Sequence start and the zone brightness slider reach Wi-Fi drivers (matched by hostname or MAC). - A preset select with brightness also sends the brightness to Wi-Fi drivers, as ESP-NOW does. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
581b751904
commit
a1c8ce853b
21 files changed
+419
-318
No files matched your search
+30
-1
@@ -342,9 +342,11 @@ static bool wifi_selected(const cJSON *dev, const char *id, const cJSON *targets
|
||||
{
|
||||
if (cJSON_IsArray(targets) && cJSON_GetArraySize(targets) > 0) {
|
||||
const cJSON *t;
|
||||
// A Wi-Fi driver is named by its hostname, or by its MAC when the UI resolved the device to one
|
||||
const cJSON *dmac = cJSON_GetObjectItem(dev, "mac");
|
||||
cJSON_ArrayForEach(t, targets)
|
||||
{
|
||||
if (cJSON_IsString(t) && !strcmp(t->valuestring, id)) {
|
||||
if (cJSON_IsString(t) && (!strcmp(t->valuestring, id) || (cJSON_IsString(dmac) && !strcasecmp(t->valuestring, dmac->valuestring)))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -422,6 +424,12 @@ static void wifi_push(const cJSON *m, const cJSON *targets)
|
||||
cJSON_AddTrueToObject(body, "select"); // a select restarts the pattern and fades in (fade)
|
||||
wifi_drv_post(id, "/api/pattern", body);
|
||||
}
|
||||
// ESP-NOW carries b in the same frame as the select; the Wi-Fi driver takes it in its own call
|
||||
if (cJSON_IsNumber(b)) {
|
||||
cJSON *bb = cJSON_CreateObject();
|
||||
cJSON_AddNumberToObject(bb, "brightness", b->valuedouble);
|
||||
wifi_drv_post(id, "/api/brightness", bb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,6 +561,27 @@ const char *engine_zone_current(const char *zone_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int engine_zone_wifi_ids(const char *zone_id, char out[][GROUP_ID_MAX], int max)
|
||||
{
|
||||
char t[ZONE_TARGETS_MAX][GROUP_ID_MAX];
|
||||
int nt = engine_zone_targets(zone_id, t, ZONE_TARGETS_MAX);
|
||||
int n = 0;
|
||||
const cJSON *d;
|
||||
cJSON_ArrayForEach(d, store_coll("device"))
|
||||
{
|
||||
if (!d->string || !is_wifi(d)) {
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < nt && n < max; i++) {
|
||||
if (wifi_in_group(d, d->string, t[i])) {
|
||||
snprintf(out[n++], GROUP_ID_MAX, "%s", d->string);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
int engine_group_macs(const char *gid, char out[][13], int max)
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
Reference in new issue
Block a user