feat: browser simulator served by the controller, desktop build, browser bridge
- led-simulator: the rig runs the C++ led-driver as WebAssembly (sim-driver/), one single-threaded worker per bar, no cross-origin isolation needed. Rooms (one JSON per room) with an on-page editor, and a pattern gallery. The Python server, Pyodide boot and ring buffer are removed. - sim-controller sim_rig.c: serves /sim/ from an embedded pack, the page's WebSocket and the rooms/flash API. The desktop build embeds it too. - bridge.c: a "browser" bridge kind that carries ESP-NOW frames to the page; devices announced through it are marked sim. - UI: Simulator in the Menu, split view with resize and pop-out, swipe between controller and rig on phones; SIM/REAL badges in Devices. - Fades: preset pushes and Wi-Fi driver bodies always carry fade and beat_time, so "off" no longer inherits an earlier fade. - Also the sequences-v2 work in progress: desktop port, bridge firmware, serial bridge, Wi-Fi drivers, sequence timeline, audio and API changes. - led-driver: ESP-NOW link, beat sync, control messages, sim hooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
698c1463c0
commit
581b751904
506 files changed
+42336
-3599
No files matched your search
+18
-6
@@ -1,5 +1,6 @@
|
||||
#include "espnow_tx.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "esp_check.h"
|
||||
#include "esp_event.h"
|
||||
@@ -50,11 +51,16 @@ static espnow_stats_t s_stats;
|
||||
static volatile int s_loss_pct;
|
||||
static volatile bool s_loss_beats = true;
|
||||
static espnow_rx_cb_t s_rx_cb;
|
||||
static char s_bridge[80];
|
||||
static char s_bridges[BRIDGE_MAX_LINKS][BRIDGE_ADDR_MAX]; // the bridges to open at init
|
||||
static size_t s_nbridges;
|
||||
|
||||
void espnow_tx_set_bridge(const char *addr)
|
||||
void espnow_tx_set_bridges(const char addrs[][BRIDGE_ADDR_MAX], size_t n)
|
||||
{
|
||||
snprintf(s_bridge, sizeof(s_bridge), "%s", addr ? addr : "");
|
||||
if (n > BRIDGE_MAX_LINKS) {
|
||||
n = BRIDGE_MAX_LINKS;
|
||||
}
|
||||
memcpy(s_bridges, addrs, n * sizeof(s_bridges[0]));
|
||||
s_nbridges = n;
|
||||
}
|
||||
|
||||
// One frame onto the air, or to the UDP bridge while one is set
|
||||
@@ -349,18 +355,24 @@ int espnow_tx_ap_clients(char *out, size_t n)
|
||||
}
|
||||
#endif
|
||||
|
||||
esp_err_t espnow_tx_change_bridges(const char addrs[][BRIDGE_ADDR_MAX], size_t n)
|
||||
{
|
||||
espnow_tx_set_bridges(addrs, n);
|
||||
return bridge_set_all(addrs, n, bridge_rx);
|
||||
}
|
||||
|
||||
esp_err_t espnow_tx_init(const char *ap_ssid, const char *ap_password)
|
||||
{
|
||||
#if CONFIG_IDF_TARGET_LINUX
|
||||
(void)ap_ssid;
|
||||
(void)ap_password;
|
||||
ESP_RETURN_ON_FALSE(s_bridge[0], ESP_ERR_INVALID_STATE, TAG, "the host build needs a bridge address");
|
||||
ESP_RETURN_ON_FALSE(s_nbridges, ESP_ERR_INVALID_STATE, TAG, "the host build needs a bridge address");
|
||||
#else
|
||||
// The radio still comes up behind a bridge: the access point serves the web UI
|
||||
ESP_RETURN_ON_ERROR(radio_init(ap_ssid, ap_password), TAG, "radio");
|
||||
#endif
|
||||
if (s_bridge[0]) {
|
||||
ESP_RETURN_ON_ERROR(bridge_start(s_bridge, bridge_rx), TAG, "bridge");
|
||||
if (s_nbridges) {
|
||||
ESP_RETURN_ON_ERROR(bridge_set_all(s_bridges, s_nbridges, bridge_rx), TAG, "bridge");
|
||||
}
|
||||
|
||||
s_bulk_q = xQueueCreate(BULK_QUEUE_LEN, sizeof(bulk_t));
|
||||
|
||||
Reference in new issue
Block a user