Channel 11 defaults, ESP-NOW driver config and rig/desktop updates

Moves the controller, bridge and led-driver default ESP-NOW channel to 11 and
updates the led-driver and led-tool submodule pointers. Includes the rest of the
working tree: web UI, desktop and sim-controller changes, API and bridge code,
graphify output, and the .gitea and fixture-driver folders.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
jimmyandClaude Haiku 5.5 committed 2026-11-21 01:19:02 +13:00
1 parent 35207a868a
commit edf35e9c71
280 files changed
+24043 -1756

No files matched your search

+97
View File
@@ -0,0 +1,97 @@
// USB-DMX adapters for the DMX bridge (bridge_dmx.c), linux only:
// Enttec DMX USB Pro: the widget's "Output Only Send DMX" message (label 6) with start code 0 and 512 channels.
// Open DMX (an FTDI cable with no processor): the DMX line itself, 250000 baud 8N2, a break and mark-after-break,
// then start code 0 and 512 channels.
// The kernel's termios2 sets 250000 baud exactly; its header clashes with glibc's <termios.h>, so this file has
// only the kernel's.
#include <errno.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <asm/ioctls.h>
#include <asm/termbits.h>
#include "dmx_wire.h"
int ioctl(int fd, unsigned long request, ...);
int dmx_serial_open(const char *path, bool open_dmx, char *err, size_t elen)
{
int fd = open(path, O_RDWR | O_NOCTTY | O_CLOEXEC);
if (fd < 0) {
snprintf(err, elen, "cannot open %s: %s", path, strerror(errno));
return -1;
}
struct termios2 t;
if (ioctl(fd, TCGETS2, &t) != 0) {
snprintf(err, elen, "%s is not a serial port: %s", path, strerror(errno));
close(fd);
return -1;
}
// Raw: no echo, no line discipline, no flow control
t.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON | IXOFF | IXANY);
t.c_oflag &= ~OPOST;
t.c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN);
t.c_cflag &= ~(CSIZE | PARENB | CBAUD | CRTSCTS);
t.c_cflag |= CS8 | CLOCAL | CREAD | BOTHER;
if (open_dmx) {
t.c_cflag |= CSTOPB; // 8N2
} else {
t.c_cflag &= ~CSTOPB;
}
unsigned baud = open_dmx ? 250000 : 57600; // the Pro is USB: its rate does not matter
t.c_ispeed = t.c_ospeed = baud;
t.c_cc[VMIN] = 0;
t.c_cc[VTIME] = 0;
if (ioctl(fd, TCSETS2, &t) != 0) {
snprintf(err, elen, "cannot set up %s: %s", path, strerror(errno));
close(fd);
return -1;
}
return fd;
}
static bool write_all(int fd, const uint8_t *p, size_t n)
{
while (n) {
ssize_t w = write(fd, p, n);
if (w < 0) {
if (errno == EINTR) {
continue;
}
return false;
}
p += w;
n -= (size_t)w;
}
return true;
}
bool dmx_serial_write(int fd, bool open_dmx, const uint8_t data[DMX_CHANNELS])
{
uint8_t frame[5 + 1 + DMX_CHANNELS + 1];
if (!open_dmx) {
size_t len = 1 + DMX_CHANNELS;
frame[0] = 0x7E;
frame[1] = 6;
frame[2] = (uint8_t)len;
frame[3] = (uint8_t)(len >> 8);
frame[4] = 0; // start code
memcpy(frame + 5, data, DMX_CHANNELS);
frame[5 + DMX_CHANNELS] = 0xE7;
return write_all(fd, frame, 6 + DMX_CHANNELS);
}
ioctl(fd, TCSBRK, 1); // wait for the last frame to leave before the break
if (ioctl(fd, TIOCSBRK) != 0) {
return false;
}
usleep(110); // break: at least 88 us
ioctl(fd, TIOCCBRK);
usleep(16); // mark after break: at least 8 us
frame[0] = 0;
memcpy(frame + 1, data, DMX_CHANNELS);
return write_all(fd, frame, 1 + DMX_CHANNELS);
}