extract test for rdm identify into own method

This commit is contained in:
Arne 2023-08-18 15:43:14 +02:00 committed by Will Tatam
parent 033c7abe62
commit 9d8fdd0b20
2 changed files with 13 additions and 4 deletions

View File

@ -103,11 +103,9 @@ void DMXInput::update()
connected = true;
}
uint8_t identify = 0;
const bool gotIdentify = rdm_get_identify_device(inputPortNum, &identify);
// gotIdentify should never be false because it is a default parameter in rdm but just in case we check for it anyway
if (identify && gotIdentify)
if (isIdentifyOn())
{
DEBUG_PRINTLN("RDM Identify active");
turnOnAllLeds();
}
else
@ -162,4 +160,13 @@ void DMXInput::enable()
}
}
bool DMXInput::isIdentifyOn() const
{
uint8_t identify = 0;
const bool gotIdentify = rdm_get_identify_device(inputPortNum, &identify);
// gotIdentify should never be false because it is a default parameter in rdm
// but just in case we check for it anyway
return bool(identify) && gotIdentify;
}
#endif

View File

@ -17,6 +17,8 @@ public:
void enable();
private:
/// @return true if rdm identify is active
bool isIdentifyOn() const;
/// overrides everything and turns on all leds
void turnOnAllLeds();