Differentiate between LED-Device Enable/Disable and Switch On/Off (#960)

* Switch Off devices, when no input source

* Realign Enable/SwitchOn, Disable/SwitchOff

* Align to updated LedDevice-Flow

* Remove debug statements slipped in

* Send last color update after enabling again

* Fix WLED getProperties API call

* Remove unused signals

* LedDevice process flow documentation

* LedDevice process flow documentation

Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
LordGrey
2020-09-14 17:19:14 +02:00
committed by GitHub
parent fbd8167458
commit 4aabe175cd
15 changed files with 247 additions and 146 deletions

View File

@@ -87,6 +87,7 @@ void Hyperion::start()
// connect Hyperion::update with Muxer visible priority changes as muxer updates independent
connect(&_muxer, &PriorityMuxer::visiblePriorityChanged, this, &Hyperion::update);
connect(&_muxer, &PriorityMuxer::visiblePriorityChanged, this, &Hyperion::handlPriorityChangedLedDevice);
connect(&_muxer, &PriorityMuxer::visibleComponentChanged, this, &Hyperion::handleVisibleComponentChanged);
// listens for ComponentRegister changes of COMP_ALL to perform core enable/disable actions
@@ -530,6 +531,26 @@ void Hyperion::handleVisibleComponentChanged(hyperion::Components comp)
_raw2ledAdjustment->setBacklightEnabled((comp != hyperion::COMP_COLOR && comp != hyperion::COMP_EFFECT));
}
void Hyperion::handlPriorityChangedLedDevice(const quint8& priority)
{
quint8 previousPriority = _muxer.getPreviousPriority();
Debug(_log,"priority[%u], previousPriority[%u]", priority, previousPriority);
if ( priority == PriorityMuxer::LOWEST_PRIORITY)
{
Debug(_log,"No source left -> switch LED-Device off");
emit _ledDeviceWrapper->switchOff();
}
else
{
if ( previousPriority == PriorityMuxer::LOWEST_PRIORITY )
{
Debug(_log,"new source available -> switch LED-Device on");
emit _ledDeviceWrapper->switchOn();
}
}
}
void Hyperion::update()
{
// Obtain the current priority channel