feat: main's import/export, zones, audio API and web UI
Profiles, presets and sequences export and import as main's bundles. Zones carry group_ids, preset_group_ids, sequence_ids, content_kind and brightness; profiles seed rainbow as colour_cycle, and deleting a profile also deletes its sequences. Groups, zones and sequences written by older versions are migrated at boot. /api/audio (status, event stream, start/stop, reset, anchor-bar, devices) maps main's audio detector onto the mic's beat detector. Audio start/stop picks whether mic beats or the BPM clock time sequences; the clock's beats also go to the drivers while the mic is off. /ws now greets from a post-handshake callback (httpd does not call the handler for the upgrade). The web UI is main's, plus v2's outputs editor, list search and hostname/static IP settings; the bridge, Wi-Fi AP and led-tool parts are gone. API tests follow main's behaviour (119 pass on the board). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04b56c6ef2
commit
bfeeb958df
44 files changed
+8709
-2338
No files matched your search
@@ -6,6 +6,8 @@
|
||||
#include "api_util.h"
|
||||
#include "beat.h"
|
||||
#include "engine.h"
|
||||
#include "espnow_tx.h"
|
||||
#include "bench.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_timer.h"
|
||||
@@ -466,6 +468,10 @@ static void beat_task(void *arg)
|
||||
if (!audio_drives()) {
|
||||
bool down = s_sim_beats % BEATS_PER_BAR == 0;
|
||||
s_sim_beats++;
|
||||
// Drivers get the clock's beats too, so manual (beat-stepped) presets keep moving
|
||||
if (!bench_running()) {
|
||||
espnow_tx_beat(60e6f / interval, down, (int)((s_sim_beats - 1) % BEATS_PER_BAR) + 1);
|
||||
}
|
||||
on_beat(down);
|
||||
}
|
||||
continue;
|
||||
@@ -492,6 +498,7 @@ esp_err_t seqplay_init(void)
|
||||
const cJSON *a = cJSON_GetObjectItem(store_settings(), "audio_timing");
|
||||
s_audio = !cJSON_IsFalse(a);
|
||||
store_unlock();
|
||||
espnow_tx_set_mic_beats(s_audio);
|
||||
return xTaskCreate(beat_task, "seqplay", 6144, NULL, 4, NULL) == pdPASS ? ESP_OK : ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
@@ -673,6 +680,7 @@ void seqplay_set_audio(bool on)
|
||||
{
|
||||
store_lock();
|
||||
s_audio = on;
|
||||
espnow_tx_set_mic_beats(on);
|
||||
api_set(store_settings(), "audio_timing", cJSON_CreateBool(on));
|
||||
store_save("settings");
|
||||
store_unlock();
|
||||
@@ -682,3 +690,17 @@ bool seqplay_audio(void)
|
||||
{
|
||||
return s_audio;
|
||||
}
|
||||
|
||||
const char *seqplay_switch_wait(void)
|
||||
{
|
||||
store_lock();
|
||||
bool down = wait_for_downbeat();
|
||||
store_unlock();
|
||||
return down ? "downbeat" : "beat";
|
||||
}
|
||||
|
||||
void seqplay_clock(int *bar_beat, uint32_t *tick)
|
||||
{
|
||||
*tick = s_sim_beats;
|
||||
*bar_beat = s_sim_beats ? (int)((s_sim_beats - 1) % BEATS_PER_BAR) + 1 : 1;
|
||||
}
|
||||
Reference in new issue
Block a user