Merge pull request #580 from Lord-Grey/master

Allow to switch on LED device, if currently disabled
This commit is contained in:
Paulchen Panther
2019-08-11 19:02:22 +02:00
committed by GitHub
3 changed files with 19 additions and 9 deletions

View File

@@ -45,12 +45,22 @@ void LedDevice::setEnable(bool enable)
{
// emit signal when state changed
if (_enabled != enable)
{
emit enableStateChanged(enable);
// set black to leds when they should go off
}
// switch off device when disabled, default: set black to leds when they should go off
if ( _enabled && !enable)
{
switchOff();
}
else
{
// switch on device when enabled
if ( !_enabled && enable)
{
switchOn();
}
}
_enabled = enable;
}