Files
led-controller/main/dmx_wire.h
T
jimmyandClaude Haiku 5.5 edf35e9c71 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>
2026-11-21 01:19:02 +13:00

42 lines
1.8 KiB
C

#pragma once
// Art-Net and sACN (E1.31) packets: one universe of DMX data each. Shared by the pixel outputs' test
// (outputs.c) and the DMX bridge (bridge_dmx.c).
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "cJSON.h"
#define DMX_CHANNELS 512
#define ARTNET_PORT 6454
#define SACN_PORT 5568
#define DMX_PACKET_MAX (126 + DMX_CHANNELS) // the larger of the two
// ArtDmx for universe uni (15-bit port-address) with sequence seq: n bytes of data (at most 512, padded to an
// even length of at least 2). Returns the packet's length.
size_t dmx_artnet_packet(uint8_t *pkt, uint8_t seq, int uni, const uint8_t *data, size_t n);
// sACN data packet for universe uni (1-63999) from the source cid / name, priority 100, start code 0: n bytes of
// data (at most 512). Returns the packet's length.
size_t dmx_sacn_packet(uint8_t *pkt, const uint8_t cid[16], const char *source, uint8_t seq, int uni,
const uint8_t *data, size_t n);
// The multicast group of an sACN universe: 239.255.<hi>.<lo>, host order
uint32_t dmx_sacn_group(int uni);
// What a fixture's slot gets, from its channel name in the definition (see bridge_dmx.h)
enum { DMX_ROLE_FIXED, DMX_ROLE_RED, DMX_ROLE_GREEN, DMX_ROLE_BLUE, DMX_ROLE_WHITE, DMX_ROLE_DIMMER, DMX_ROLE_STROBE };
#define DMX_PIXELS_MAX 64
typedef struct {
uint8_t role;
uint8_t pixel; // RED..WHITE: the pixel group, 0 first
uint8_t value; // FIXED: the default
} dmx_slot_t;
// Map a "dmx_definition" record ({channels: [names], defaults: {name: value}}) into slots (up to max).
// Returns the channel count (0 when the record has none), with the pixel groups (at least 1) in *pixels and
// whether any pixel has a white slot in *white.
int dmx_def_map(const cJSON *def, dmx_slot_t *slots, int max, int *pixels, bool *white);