Monitor dmx personality and dmx start address for change and update rdm

This commit is contained in:
Arne 2023-08-18 15:44:27 +02:00 committed by Will Tatam
parent 9d8fdd0b20
commit be3e331afb
2 changed files with 33 additions and 0 deletions

View File

@ -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

View File

@ -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();