sim: fixture editor for DDP and Art-Net/DMX fixtures

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>
This commit is contained in:
jimmyandClaude Opus 5.5 committed 2026-11-17 18:13:58 +13:00
1 parent 2fdd55323b
commit 35207a868a
16 files changed
+2859 -118

No files matched your search

+24 -4
View File
@@ -3,17 +3,33 @@
* A room (rooms/<name>.json, see rooms.py) spans x -width/2..width/2 and y 0..depth, metres,
* y up on screen. A fixture's x, y is pixel 0; the strip runs along `direction` (degrees clockwise
* from +y) for leds x pitch_m metres. roomStrips() mirrors rooms.room_strips() on the server.
* Art-Net cans and movers (type "artnet", kind "can" / "mover") are points with no LEDs of their own.
*/
(function (g) {
'use strict';
/** DMX cans and movers are points: their x, y is the light, the turn handle sits HANDLE_M along the heading. */
const HANDLE_M = 0.45;
function isPoint(f) {
return f.type === 'artnet' && (f.kind === 'can' || f.kind === 'mover');
}
function fixtureLeds(room, f) {
if (isPoint(f)) {
return 0;
}
return Number(f.leds) || room.definitions[f.def].leds;
}
/** A mover's handle turns its zero (the heading at pan centre), a can's or a strip's its direction. */
function heading(f) {
return f.type === 'artnet' && f.kind === 'mover' ? Number(f.zero) || 0 : f.direction;
}
function fixtureEnd(room, f) {
const len = fixtureLeds(room, f) * room.definitions[f.def].pitch_m;
const a = (f.direction * Math.PI) / 180;
const len = isPoint(f) ? HANDLE_M : fixtureLeds(room, f) * room.definitions[f.def].pitch_m;
const a = (heading(f) * Math.PI) / 180;
return [f.x + len * Math.sin(a), f.y + len * Math.cos(a)];
}
@@ -26,6 +42,9 @@
n: i + 1,
id,
label: f.label,
type: f.type || 'espnow',
kind: f.type === 'artnet' ? f.kind || 'pixels' : 'pixels',
point: isPoint(f),
mac: f.mac,
leds: fixtureLeds(room, f),
x: f.x,
@@ -33,6 +52,7 @@
x1,
y1,
direction: f.direction,
zero: Number(f.zero) || 0,
};
});
}
@@ -68,7 +88,7 @@
const bx = view.sx(s.x1);
const by = view.sy(s.y1);
const len = Math.hypot(bx - ax, by - ay);
return { ax, ay, bx, by, len, ang: Math.atan2(by - ay, bx - ax), pitch: len / s.leds };
return { ax, ay, bx, by, len, ang: Math.atan2(by - ay, bx - ax), pitch: s.leds ? len / s.leds : 0, point: s.point };
});
}
@@ -80,5 +100,5 @@
return Math.hypot(x - (sg.ax + t * dx), y - (sg.ay + t * dy));
}
g.RigLayout = { roomStrips, fit, stripGeometry, distToStrip, fixtureLeds };
g.RigLayout = { roomStrips, fit, stripGeometry, distToStrip, fixtureLeds, isPoint };
})(typeof self !== 'undefined' ? self : globalThis);