feat: sequences v2, bridges, and sim-controller
Rework sequences (engine, seqplay, envelope, API, web UI), add bridge support, add the host sim-controller and rig simulation tests, and update docs, presets and project tooling config. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d664026ee5
commit
2543673bd8
68 files changed
+5761
-460
No files matched your search
+16
-5
@@ -8,6 +8,7 @@
|
||||
#include "esp_log.h"
|
||||
#include "esp_check.h"
|
||||
#include "esp_event.h"
|
||||
#include <stdlib.h>
|
||||
#include "esp_netif.h"
|
||||
#include "esp_eth.h"
|
||||
#include "esp_mac.h"
|
||||
@@ -71,7 +72,11 @@ static esp_err_t status_get_handler(httpd_req_t *req)
|
||||
rel_stats_t rs;
|
||||
esp_netif_ip_info_t ip_info = { 0 };
|
||||
uint8_t mac[6] = { 0 };
|
||||
char ip[16], macs[18], buf[1024];
|
||||
char ip[16], macs[18], mask[16], gw[16], clients[400];
|
||||
char *buf = malloc(2048);
|
||||
if (!buf) {
|
||||
return httpd_resp_send_500(req);
|
||||
}
|
||||
beat_get_info(&bi);
|
||||
mic_get_level(&level);
|
||||
espnow_tx_stats(&es);
|
||||
@@ -82,15 +87,18 @@ 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),
|
||||
"{\"ap\":%s,\"ip\":\"%s\",\"mac\":\"%s\",\"uptime_s\":%lld,\"reset_reason\":\"%s\",\"free_heap\":%lu,\"free_internal\":%lu,"
|
||||
snprintf(mask, sizeof(mask), IPSTR, IP2STR(&ip_info.netmask));
|
||||
snprintf(gw, sizeof(gw), IPSTR, IP2STR(&ip_info.gw));
|
||||
espnow_tx_ap_clients(clients, sizeof(clients));
|
||||
snprintf(buf, 2048,
|
||||
"{\"ap\":%s,\"eth\":{\"ip\":\"%s\",\"mask\":\"%s\",\"gw\":\"%s\",\"up\":%s},\"ap_ip\":\"192.168.5.1\",\"ap_clients\":%s,\"ip\":\"%s\",\"mac\":\"%s\",\"uptime_s\":%lld,\"reset_reason\":\"%s\",\"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,"
|
||||
"\"espnow\":{\"beats_sent\":%lu,\"beat_send_fail\":%lu,\"bulk_sent\":%lu,"
|
||||
"\"bulk_retries\":%lu,\"bulk_failed\":%lu,\"sim_dropped\":%lu},"
|
||||
"\"link\":{\"ver\":%u,\"acked\":%lu,\"ack_timeouts\":%lu,\"retransmits\":%lu,\"resyncs\":%lu,\"digests\":%lu}}",
|
||||
s_ap_on ? "true" : "false", ip, macs, (long long)(esp_timer_get_time() / 1000000), reset_reason(), (unsigned long)esp_get_free_heap_size(),
|
||||
s_ap_on ? "true" : "false", ip, mask, gw, ip_info.ip.addr ? "true" : "false", clients, ip, macs, (long long)(esp_timer_get_time() / 1000000), reset_reason(), (unsigned long)esp_get_free_heap_size(),
|
||||
(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",
|
||||
@@ -100,7 +108,9 @@ static esp_err_t status_get_handler(httpd_req_t *req)
|
||||
(unsigned long)rs.acked, (unsigned long)rs.ack_timeouts, (unsigned long)rs.retransmits,
|
||||
(unsigned long)rs.resyncs, (unsigned long)rs.digests);
|
||||
httpd_resp_set_type(req, "application/json");
|
||||
return httpd_resp_sendstr(req, buf);
|
||||
esp_err_t err = httpd_resp_sendstr(req, buf);
|
||||
free(buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
#define DEFAULT_HOSTNAME "led-controller"
|
||||
@@ -446,6 +456,7 @@ void app_main(void)
|
||||
bool held = ap_button_held();
|
||||
s_ap_on = settings_bool("ap_enabled", true) || held;
|
||||
ESP_LOGI(TAG, "AP %s%s", s_ap_on ? "on" : "off", held ? " (button held)" : "");
|
||||
espnow_tx_set_bridge(settings_str("bridge")); // led-simulator stands in for the radio
|
||||
ESP_ERROR_CHECK(espnow_tx_init(s_ap_on ? (host ? host : DEFAULT_HOSTNAME) : NULL, settings_str("ap_password")));
|
||||
|
||||
// Ethernet is optional: without it the web UI is still served over the AP
|
||||
|
||||
Reference in new issue
Block a user