The rig sim receives Art-Net (UDP 6454, answers ArtPoll) and DDP (each port the room's DDP strips use) in sim_net.c and passes changed universes and pixels to the page over /sim/ws, now with a kind byte in front of each binary frame. Rooms gain fixture types: ddp strips, artnet pixel strips, and artnet cans and movers that read named channels from the room's dmx_definitions (the qlcplus stage map's format). Overlapping DMX channels are refused. Cans and movers are decoded and drawn as in the qlcplus stage simulator (dmx.js, dmx-draw.js). In Edit mode: pick a type to add, edit port/offset/universe/address/colour order/definition, see a can's or mover's live channels, make a controller output aimed at the sim and send its test. The room dialog lists DMX definitions, with presets, a channel editor, and .qxf and stage map import. GET /sim/api/dmx shows what the receiver has had. Tests: test/api/test_sim_net.py and test/browser/dmx_decode.test.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
1.4 KiB
C
33 lines
1.4 KiB
C
/*
|
|
* The simulated rig's network fixtures: Art-Net (UDP 6454) and DDP (UDP 4048, or the ports the room's DDP
|
|
* fixtures name) received here and forwarded to the rig page over /sim/ws, at most 40 frames a second:
|
|
*
|
|
* here -> page binary 0x01 + u16 universe (LE) + 512 bytes an Art-Net universe changed
|
|
* here -> page binary 0x02 + u16 port (LE) + u32 0 + RGB bytes a DDP port's pixels changed (from offset 0)
|
|
*
|
|
* The ESP-NOW frames to the page carry 0x00 in front (sim_rig.c). ArtPoll is answered so QLC+ lists the node.
|
|
* LED_SIM_ARTNET_PORT moves the Art-Net port (0: off), for when QLC+ on the same machine holds 6454.
|
|
*/
|
|
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include "cJSON.h"
|
|
|
|
#define SIM_NET_MAX_DDP_PORTS 8
|
|
#define SIM_NET_DDP_PIXELS 4096
|
|
|
|
// Start the receiver task (once)
|
|
void sim_net_start(void);
|
|
|
|
// The DDP ports the active room uses (duplicates and 0 are ignored); sockets follow on the next tick
|
|
void sim_net_set_ddp_ports(const uint16_t *ports, int n);
|
|
|
|
// {artnet: {port, error, packets, polls, last_from, universes: {"0": {packets, data?: hex}}},
|
|
// ddp: {"4048": {packets, pixels, error, last_from, data?: hex}}}; data only when with_data
|
|
cJSON *sim_net_status(bool with_data);
|
|
|
|
// sim_rig.c: send one binary frame to the page; false when no page is open
|
|
bool sim_rig_page_send(const uint8_t *frame, size_t len);
|