feat: port the remaining v1 API to the v2 controller
Profiles seed presets, a default zone and a palette, and clone with their own copies; deleting a profile removes what it owned. Zones get the v1 list shape, set-current, current, clone and content-fragment. Devices are keyed by MAC with v1 validation and identify. Patterns: definitions, OTA file and manifest, upload, driver, and send over ESP-NOW (the led-driver pattern sources are embedded in the firmware). Pixel outputs get v1 validation and a DDP/Art-Net/sACN test pattern. Sequences, palettes and settings follow v1 replies and validation, and /ws forwards browser messages to the drivers. The resource handlers move out of api.c into res_*.c, patterns.c and outputs.c. cJSON now allocates from PSRAM: the store had grown enough to starve internal RAM and abort the mic at boot. /status reports free_internal. The Wi-Fi AP and led-tool routes are left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4b42391a46
commit
57182188ba
30 files changed
+2846
-425
No files matched your search
+5
-2
@@ -16,6 +16,7 @@
|
||||
#include "driver/spi_master.h"
|
||||
#include "esp_http_server.h"
|
||||
#include "esp_timer.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_system.h"
|
||||
#include "mdns.h"
|
||||
#include "lwip/ip4_addr.h"
|
||||
@@ -28,6 +29,7 @@
|
||||
#include "beat.h"
|
||||
#include "espnow_tx.h"
|
||||
#include "store.h"
|
||||
#include "ws.h"
|
||||
#include "api.h"
|
||||
#include "engine.h"
|
||||
#include "rel.h"
|
||||
@@ -59,7 +61,7 @@ static esp_err_t status_get_handler(httpd_req_t *req)
|
||||
snprintf(ip, sizeof(ip), IPSTR, IP2STR(&ip_info.ip));
|
||||
snprintf(macs, sizeof(macs), MACSTR, MAC2STR(mac));
|
||||
snprintf(buf, sizeof(buf),
|
||||
"{\"ip\":\"%s\",\"mac\":\"%s\",\"uptime_s\":%lld,\"free_heap\":%lu,"
|
||||
"{\"ip\":\"%s\",\"mac\":\"%s\",\"uptime_s\":%lld,\"free_heap\":%lu,\"free_internal\":%lu,"
|
||||
"\"mic_rms_dbfs\":%.1f,\"mic_peak_dbfs\":%.1f,\"mic_spl_db\":%.1f,"
|
||||
"\"bpm\":%.1f,\"beat_confidence\":%.2f,\"beat_locked\":%s,\"beats\":%lu,\"onsets\":%lu,"
|
||||
"\"meter\":%d,\"bar_beat\":%d,\"bar_sure\":%s,\"downbeats\":%lu,"
|
||||
@@ -67,7 +69,7 @@ static esp_err_t status_get_handler(httpd_req_t *req)
|
||||
"\"bulk_retries\":%lu,\"bulk_failed\":%lu,\"sim_dropped\":%lu},"
|
||||
"\"link\":{\"ver\":%u,\"acked\":%lu,\"ack_timeouts\":%lu,\"retransmits\":%lu,\"resyncs\":%lu,\"digests\":%lu}}",
|
||||
ip, macs, (long long)(esp_timer_get_time() / 1000000), (unsigned long)esp_get_free_heap_size(),
|
||||
level.rms_dbfs, level.peak_dbfs, level.spl_db,
|
||||
(unsigned long)heap_caps_get_free_size(MALLOC_CAP_INTERNAL), level.rms_dbfs, level.peak_dbfs, level.spl_db,
|
||||
bi.bpm, bi.confidence, bi.locked ? "true" : "false", (unsigned long)bi.beat_count,
|
||||
(unsigned long)bi.onset_count, bi.meter, bi.bar_beat, bi.bar_sure ? "true" : "false",
|
||||
(unsigned long)bi.downbeat_count,
|
||||
@@ -220,6 +222,7 @@ static void start_webserver(void)
|
||||
ota_register(s_server);
|
||||
drv_ota_register(s_server);
|
||||
api_register(s_server);
|
||||
ws_register(s_server);
|
||||
ESP_LOGI(TAG, "HTTP server started on port %d", config.server_port);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user