mirror of
https://github.com/wled/WLED.git
synced 2025-04-23 22:37:18 +00:00
Monitor dmx personality and dmx start address for change and update rdm
This commit is contained in:
parent
9d8fdd0b20
commit
be3e331afb
@ -90,6 +90,9 @@ void DMXInput::update()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
checkAndUpdateConfig();
|
||||
|
||||
byte dmxdata[DMX_PACKET_SIZE];
|
||||
dmx_packet_t packet;
|
||||
unsigned long now = millis();
|
||||
@ -169,4 +172,29 @@ bool DMXInput::isIdentifyOn() const
|
||||
// but just in case we check for it anyway
|
||||
return bool(identify) && gotIdentify;
|
||||
}
|
||||
|
||||
void DMXInput::checkAndUpdateConfig()
|
||||
{
|
||||
|
||||
/**
|
||||
* The global configuration variables are modified by the web interface.
|
||||
* If they differ from the driver configuration, we have to update the driver
|
||||
* configuration.
|
||||
*/
|
||||
|
||||
const uint8_t currentPersonality = dmx_get_current_personality(inputPortNum);
|
||||
if (currentPersonality != DMXMode)
|
||||
{
|
||||
DEBUG_PRINTF("DMX personality has changed from %d to %d\n", currentPersonality, DMXMode);
|
||||
dmx_set_current_personality(inputPortNum, DMXMode);
|
||||
}
|
||||
|
||||
const uint16_t currentAddr = dmx_get_start_address(inputPortNum);
|
||||
if (currentAddr != DMXAddress)
|
||||
{
|
||||
DEBUG_PRINTF("DMX address has changed from %d to %d\n", currentAddr, DMXAddress);
|
||||
dmx_set_start_address(inputPortNum, DMXAddress);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -20,6 +20,11 @@ private:
|
||||
/// @return true if rdm identify is active
|
||||
bool isIdentifyOn() const;
|
||||
|
||||
/**
|
||||
* Checks if the global dmx config has changed and updates the changes in rdm
|
||||
*/
|
||||
void checkAndUpdateConfig();
|
||||
|
||||
/// overrides everything and turns on all leds
|
||||
void turnOnAllLeds();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user