feat: device groups, combined brightness and beat-driven sequences from main
Groups (registry of driver MACs, optionally scoped to a profile) become
the drivers' group membership, alongside z<zone id> for zones that still
name drivers. Zones play to their group_ids. Group and device routes for
driver config, brightness (global x groups x device x zone) and identify.
The push path takes main's message shape: select as a list, groups as a
filter (one GROUP_CMD per group, or JSON when a preset has a background),
short keys so JSON fits a frame.
Sequences follow main: lanes of {preset_id, beats} steps played to each
lane's groups, advanced by the mic's beats or a clock at
audio_simulated_bpm; a switch waits for the next beat or downbeat; sync-
phase, stop (clears the zone's drivers) and status. This replaces the
time-based per-zone sequencer and scene playback, as in main.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
19fea0b0a1
commit
04b56c6ef2
12 files changed
+1922
-579
No files matched your search
+14
-15
@@ -4,15 +4,24 @@
|
||||
#include "cJSON.h"
|
||||
#include "esp_err.h"
|
||||
|
||||
// Zone play/stop, preset push/send and the sequencer. Drivers run the patterns
|
||||
// themselves; this builds preset + select frames and hands them to ESP-NOW.
|
||||
// Zone play/stop and preset push/send. Drivers run the patterns themselves; this builds preset +
|
||||
// select frames and hands them to ESP-NOW. Sequences are played by seqplay.c.
|
||||
|
||||
// Start the sequencer task; sequences marked active resume after a short delay
|
||||
// Hook driver announce and resync replies
|
||||
esp_err_t engine_init(void);
|
||||
|
||||
// Select a preset on every driver named in the zone (broadcast, sent twice)
|
||||
#define GROUP_ID_MAX 20
|
||||
#define ZONE_TARGETS_MAX 12
|
||||
// Group ids a zone plays to: its group_ids, plus "z<zone id>" when it names drivers directly (zones
|
||||
// from before groups). -1 when the zone does not exist. Call with the store locked.
|
||||
int engine_zone_targets(const char *zone_id, char out[][GROUP_ID_MAX], int max);
|
||||
// A preset ready to send: palette colours and background resolved, mode as n6. Caller owns it;
|
||||
// NULL when there is no such preset. Call with the store locked.
|
||||
cJSON *engine_preset_payload(const char *preset_id);
|
||||
|
||||
// Select a preset on every driver in the zone's groups (broadcast, sent twice)
|
||||
esp_err_t engine_play(const char *zone_id, const char *preset_id);
|
||||
// Turn the zone's drivers off and stop its sequence
|
||||
// Turn the zone's drivers off
|
||||
esp_err_t engine_stop(const char *zone_id);
|
||||
|
||||
// POST /presets/push: v1 messages for targets (MAC strings), or broadcast when targets is NULL
|
||||
@@ -20,16 +29,6 @@ esp_err_t engine_push(const cJSON *messages, const cJSON *targets);
|
||||
// POST /presets/send: presets from the current profile by id
|
||||
esp_err_t engine_send_presets(const cJSON *ids, bool save, const char *def, const cJSON *targets, int *sent);
|
||||
|
||||
esp_err_t engine_seq_play(const char *seq_id);
|
||||
esp_err_t engine_seq_stop(const char *seq_id);
|
||||
esp_err_t engine_scene_play(const char *scene_id);
|
||||
esp_err_t engine_scene_stop(const char *scene_id);
|
||||
|
||||
// Caller owns the result
|
||||
cJSON *engine_status(void);
|
||||
// Running sequences: {<seq id>: {sequence_id, zone_id, step_index, pass, preset_id, running}}; caller owns it
|
||||
cJSON *engine_seq_status(void);
|
||||
|
||||
// Zones or devices changed: re-send group membership to every registered ESP-NOW driver
|
||||
void engine_groups_changed(void);
|
||||
// POST /devices/groups: send every ESP-NOW driver its groups, including silent ones, and wait for the
|
||||
|
||||
Reference in new issue
Block a user