Files
jimmyandClaude Opus 5.5 581b751904 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>
2026-11-16 19:32:46 +13:00

42 lines
1.8 KiB
C

#pragma once
// Serial bridge boards (linux target only): USB ESP-NOW bridge boards (bridge/) on serial ports. Several
// boards can be open at once; bridge.c owns the list and routes frames. Frames are in bridge_proto.h.
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
#include "esp_err.h"
#include "bridge.h"
typedef struct bridge_serial bridge_serial_t;
// Open a board on dev (e.g. /dev/ttyACM1), or reopen it if it was closed. The port may come and go: its
// link task keeps reopening it, so a missing board is not an error. Frames from it go to cb.
bridge_serial_t *bridge_serial_open(const char *dev, bridge_rx_cb_t cb);
// Stop using the board: its port closes and stays closed until bridge_serial_open(dev) again.
void bridge_serial_close(bridge_serial_t *b);
// Send dst_mac + packet to the board, which puts it on ESP-NOW. ESP_ERR_INVALID_STATE while the board is closed.
esp_err_t bridge_serial_send(bridge_serial_t *b, const uint8_t *dst_mac, const void *data, size_t len);
// Change the board's ESP-NOW channel (1-13). It keeps the setting in its NVS. ESP_ERR_INVALID_STATE until it answers.
esp_err_t bridge_serial_set_channel(bridge_serial_t *b, uint8_t channel);
// JSON object describing the board: port, linked, MAC, channel, mic and counters; returns its length
size_t bridge_serial_status(bridge_serial_t *b, char *out, size_t n);
// Audio from whichever board is recording (one at a time)
void bridge_serial_set_audio_cb(bridge_audio_cb_t cb);
// A linked board reports a microphone (its INFO capabilities)
bool bridge_serial_has_mic(void);
// Start (true) or stop (false) microphone audio on the first open board that has a mic. A start is re-sent
// after a reconnect.
esp_err_t bridge_serial_mic(bool on);
// Serial ports a board may be on, as a JSON array of paths; returns its length
size_t bridge_serial_ports_json(char *out, size_t n);