LightHub 4.6.0
Open-source smart home controller firmware
Loading...
Searching...
No Matches
dmx.cpp File Reference
#include "dmx.h"
#include "options.h"
#include "item.h"
#include "main.h"

Functions

itemCmd rgb2hsv (itemCmd in)
int itemCtrl2 (char *name, int r, int g, int b, int w)
 Drives a named DMX/LED item with an RGB(W) value.
void DMXImmediateUpdate (short tch, short r, short g, short b, short w)
void DMXSemiImmediateUpdate (short tch, short r, short g, short b, short w)
void DMXput (void)
 Propagates received DMX input frames to the mapped items.
void DMXUpdate (void)
void DMXCheck (void)
 DMX housekeeping called from the main loop: propagates changes and services pending DMX-in updates.
void onDmxFrame (uint16_t universe, uint16_t length, uint8_t sequence, uint8_t *data, IPAddress remoteIP)
void DMXinSetup (int channels)
 Sets up the DMX input for the given number of channels.
void DMXoutSetup (int channels)
 Sets up the DMX output for the given number of channels.
void DMXOUT_propagate ()
 Smoothly ramps the actual DMX output toward the buffered target.
void artnetSetup ()
 Initializes the Art-Net receiver and wires its frame callback.
void artnetSetChans (uint8_t minCh, uint8_t maxCh)
 Restricts the Art-Net channel range that is forwarded.
void DmxWriteBuf (uint16_t chan, uint8_t val)
 Writes a value into the intermediate (smoothing) DMX output buffer.

Variables

uint8_t * DMXin = NULL
volatile uint32_t D_State =0
volatile unsigned long D_checkT =0
uint8_t DMXINChannels =0
aJsonObject * items
aJsonObject * dmxArr
volatile uint8_t timerHandlerBusy
volatile int DMXinDoublecheck =0
volatile int8_t propagateBusy = 0

Function Documentation

◆ artnetSetChans()

void artnetSetChans ( uint8_t minCh,
uint8_t maxCh )

Restricts the Art-Net channel range that is forwarded.

Parameters
minChFirst channel (1-based) to accept.
maxChLast channel (1-based) to accept.

◆ artnetSetup()

void artnetSetup ( )

Initializes the Art-Net receiver and wires its frame callback.

◆ DMXCheck()

void DMXCheck ( void )

DMX housekeeping called from the main loop: propagates changes and services pending DMX-in updates.

◆ DMXImmediateUpdate()

void DMXImmediateUpdate ( short tch,
short r,
short g,
short b,
short w )

◆ DMXinSetup()

void DMXinSetup ( int channels)

Sets up the DMX input for the given number of channels.

Parameters
channelsNumber of DMX input channels.

ToDo: re-init

◆ DMXOUT_propagate()

void DMXOUT_propagate ( )

Smoothly ramps the actual DMX output toward the buffered target.

◆ DMXoutSetup()

void DMXoutSetup ( int channels)

Sets up the DMX output for the given number of channels.

Parameters
channelsNumber of DMX output channels.

◆ DMXput()

void DMXput ( void )

Propagates received DMX input frames to the mapped items.

DMX in/out is handled per platform: on the SAM3X8E (Due) a hardware USART (DmxDue) is used for both input and output; on AVR a software bit-banged driver (DmxSimple for output on pin 3/18, DMXSerial for input). ESP8266/ESP32 use ESPDMX.

◆ DMXSemiImmediateUpdate()

void DMXSemiImmediateUpdate ( short tch,
short r,
short g,
short b,
short w )

◆ DMXUpdate()

void DMXUpdate ( void )

◆ DmxWriteBuf()

void DmxWriteBuf ( uint16_t chan,
uint8_t val )

Writes a value into the intermediate (smoothing) DMX output buffer.

Parameters
chan1-based DMX channel.
valChannel value 0..255.

◆ itemCtrl2()

int itemCtrl2 ( char * name,
int r,
int g,
int b,
int w )

Drives a named DMX/LED item with an RGB(W) value.

Parameters
nameName of the target item.
rRed component.
gGreen component.
bBlue component.
wWhite component.
Returns
1 on success, 0 if the item was not found.

◆ onDmxFrame()

void onDmxFrame ( uint16_t universe,
uint16_t length,
uint8_t sequence,
uint8_t * data,
IPAddress remoteIP )

◆ rgb2hsv()

itemCmd rgb2hsv ( itemCmd in)

Variable Documentation

◆ D_checkT

volatile unsigned long D_checkT =0

◆ D_State

volatile uint32_t D_State =0

◆ dmxArr

aJsonObject* dmxArr
extern

◆ DMXin

uint8_t* DMXin = NULL

◆ DMXINChannels

uint8_t DMXINChannels =0

◆ DMXinDoublecheck

volatile int DMXinDoublecheck =0

◆ items

aJsonObject* items
extern

◆ propagateBusy

volatile int8_t propagateBusy = 0

◆ timerHandlerBusy

volatile uint8_t timerHandlerBusy
extern