mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fix reopened issue 993 (#1062)
This commit is contained in:
parent
f7ccf9d0da
commit
958975975c
@ -212,19 +212,6 @@ signals:
|
|||||||
///
|
///
|
||||||
void visibleComponentChanged(hyperion::Components comp);
|
void visibleComponentChanged(hyperion::Components comp);
|
||||||
|
|
||||||
///
|
|
||||||
/// @brief Emits whenever a priority changes active state
|
|
||||||
/// @param priority The priority who changed the active state
|
|
||||||
/// @param state The new state, state true = active else false
|
|
||||||
///
|
|
||||||
void activeStateChanged(quint8 priority, bool state);
|
|
||||||
|
|
||||||
///
|
|
||||||
/// @brief Emits whenever the auto selection state has been changed
|
|
||||||
/// @param state The new state of auto selection; True enabled else false
|
|
||||||
///
|
|
||||||
void autoSelectChanged(bool state);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// @brief Emits whenever something changes which influences the priorities listing
|
/// @brief Emits whenever something changes which influences the priorities listing
|
||||||
/// Emits also in 1s interval when a COLOR or EFFECT is running with a timeout > -1
|
/// Emits also in 1s interval when a COLOR or EFFECT is running with a timeout > -1
|
||||||
|
@ -72,12 +72,10 @@ bool JsonCB::subscribeFor(const QString& type, bool unsubscribe)
|
|||||||
|
|
||||||
if(type == "priorities-update")
|
if(type == "priorities-update")
|
||||||
{
|
{
|
||||||
if(unsubscribe){
|
if (unsubscribe)
|
||||||
disconnect(_prioMuxer,0 ,0 ,0);
|
disconnect(_prioMuxer,0 ,0 ,0);
|
||||||
} else {
|
else
|
||||||
connect(_prioMuxer, &PriorityMuxer::prioritiesChanged, this, &JsonCB::handlePriorityUpdate, Qt::UniqueConnection);
|
connect(_prioMuxer, &PriorityMuxer::prioritiesChanged, this, &JsonCB::handlePriorityUpdate, Qt::UniqueConnection);
|
||||||
connect(_prioMuxer, &PriorityMuxer::autoSelectChanged, this, &JsonCB::handlePriorityUpdate, Qt::UniqueConnection);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(type == "imageToLedMapping-update")
|
if(type == "imageToLedMapping-update")
|
||||||
|
@ -391,10 +391,8 @@ end:
|
|||||||
// register color
|
// register color
|
||||||
registerInput(priority, hyperion::COMP_COLOR, origin);
|
registerInput(priority, hyperion::COMP_COLOR, origin);
|
||||||
|
|
||||||
// write color to muxer & queuePush
|
// write color to muxer
|
||||||
setInput(priority, newLedColors, timeout_ms);
|
setInput(priority, newLedColors, timeout_ms);
|
||||||
if (timeout_ms <= 0)
|
|
||||||
_muxer.queuePush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Hyperion::getAdjustmentIds() const
|
QStringList Hyperion::getAdjustmentIds() const
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
// qt incl
|
// qt incl
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
// Hyperion includes
|
// Hyperion includes
|
||||||
#include <hyperion/PriorityMuxer.h>
|
#include <hyperion/PriorityMuxer.h>
|
||||||
@ -44,7 +45,6 @@ PriorityMuxer::PriorityMuxer(int ledCount, QObject * parent)
|
|||||||
// forward timeRunner signal to prioritiesChanged signal & threading workaround
|
// forward timeRunner signal to prioritiesChanged signal & threading workaround
|
||||||
connect(this, &PriorityMuxer::timeRunner, this, &PriorityMuxer::prioritiesChanged);
|
connect(this, &PriorityMuxer::timeRunner, this, &PriorityMuxer::prioritiesChanged);
|
||||||
connect(this, &PriorityMuxer::signalTimeTrigger, this, &PriorityMuxer::timeTrigger);
|
connect(this, &PriorityMuxer::signalTimeTrigger, this, &PriorityMuxer::timeTrigger);
|
||||||
connect(this, &PriorityMuxer::activeStateChanged, this, &PriorityMuxer::prioritiesChanged);
|
|
||||||
|
|
||||||
// start muxer timer
|
// start muxer timer
|
||||||
connect(_updateTimer, &QTimer::timeout, this, &PriorityMuxer::setCurrentTime);
|
connect(_updateTimer, &QTimer::timeout, this, &PriorityMuxer::setCurrentTime);
|
||||||
@ -79,7 +79,6 @@ bool PriorityMuxer::setSourceAutoSelectEnabled(bool enable, bool update)
|
|||||||
if(update)
|
if(update)
|
||||||
setCurrentTime();
|
setCurrentTime();
|
||||||
|
|
||||||
emit autoSelectChanged(enable);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -142,10 +141,10 @@ hyperion::Components PriorityMuxer::getComponentOfPriority(int priority) const
|
|||||||
void PriorityMuxer::registerInput(int priority, hyperion::Components component, const QString& origin, const QString& owner, unsigned smooth_cfg)
|
void PriorityMuxer::registerInput(int priority, hyperion::Components component, const QString& origin, const QString& owner, unsigned smooth_cfg)
|
||||||
{
|
{
|
||||||
// detect new registers
|
// detect new registers
|
||||||
bool newInput, reusedInput = false;
|
bool newInput = false, reusedInput = false;
|
||||||
if (!_activeInputs.contains(priority))
|
if (!_activeInputs.contains(priority))
|
||||||
newInput = true;
|
newInput = true;
|
||||||
else
|
else if(_prevVisComp == component || _activeInputs[priority].componentId == component)
|
||||||
reusedInput = true;
|
reusedInput = true;
|
||||||
|
|
||||||
InputInfo& input = _activeInputs[priority];
|
InputInfo& input = _activeInputs[priority];
|
||||||
@ -159,12 +158,14 @@ void PriorityMuxer::registerInput(int priority, hyperion::Components component,
|
|||||||
if (newInput)
|
if (newInput)
|
||||||
{
|
{
|
||||||
Debug(_log,"Register new input '%s/%s' with priority %d as inactive", QSTRING_CSTR(origin), hyperion::componentToIdString(component), priority);
|
Debug(_log,"Register new input '%s/%s' with priority %d as inactive", QSTRING_CSTR(origin), hyperion::componentToIdString(component), priority);
|
||||||
if (!_sourceAutoSelectEnabled) // emit 'prioritiesChanged' only on when _sourceAutoSelectEnabled is false
|
// emit 'prioritiesChanged' only if _sourceAutoSelectEnabled is false
|
||||||
|
if (!_sourceAutoSelectEnabled)
|
||||||
emit prioritiesChanged();
|
emit prioritiesChanged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reusedInput) emit prioritiesChanged();
|
if (reusedInput)
|
||||||
|
emit timeRunner();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PriorityMuxer::setInput(int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms)
|
bool PriorityMuxer::setInput(int priority, const std::vector<ColorRgb>& ledColors, int64_t timeout_ms)
|
||||||
@ -201,9 +202,11 @@ bool PriorityMuxer::setInput(int priority, const std::vector<ColorRgb>& ledColor
|
|||||||
if(activeChange)
|
if(activeChange)
|
||||||
{
|
{
|
||||||
Debug(_log, "Priority %d is now %s", priority, active ? "active" : "inactive");
|
Debug(_log, "Priority %d is now %s", priority, active ? "active" : "inactive");
|
||||||
emit activeStateChanged(priority, active);
|
if (_currentPriority < priority)
|
||||||
|
emit prioritiesChanged();
|
||||||
setCurrentTime();
|
setCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,9 +244,11 @@ bool PriorityMuxer::setInputImage(int priority, const Image<ColorRgb>& image, in
|
|||||||
if(activeChange)
|
if(activeChange)
|
||||||
{
|
{
|
||||||
Debug(_log, "Priority %d is now %s", priority, active ? "active" : "inactive");
|
Debug(_log, "Priority %d is now %s", priority, active ? "active" : "inactive");
|
||||||
emit activeStateChanged(priority, active);
|
if (_currentPriority < priority)
|
||||||
|
emit prioritiesChanged();
|
||||||
setCurrentTime();
|
setCurrentTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,7 +265,9 @@ bool PriorityMuxer::clearInput(uint8_t priority)
|
|||||||
Debug(_log,"Removed source priority %d",priority);
|
Debug(_log,"Removed source priority %d",priority);
|
||||||
// on clear success update _currentPriority
|
// on clear success update _currentPriority
|
||||||
setCurrentTime();
|
setCurrentTime();
|
||||||
emit prioritiesChanged();
|
// emit 'prioritiesChanged' only if _sourceAutoSelectEnabled is false
|
||||||
|
if (!_sourceAutoSelectEnabled || _currentPriority < priority)
|
||||||
|
emit prioritiesChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -281,9 +288,7 @@ void PriorityMuxer::clearAll(bool forceClearAll)
|
|||||||
{
|
{
|
||||||
const InputInfo info = getInputInfo(key);
|
const InputInfo info = getInputInfo(key);
|
||||||
if ((info.componentId == hyperion::COMP_COLOR || info.componentId == hyperion::COMP_EFFECT || info.componentId == hyperion::COMP_IMAGE) && key < PriorityMuxer::LOWEST_PRIORITY-1)
|
if ((info.componentId == hyperion::COMP_COLOR || info.componentId == hyperion::COMP_EFFECT || info.componentId == hyperion::COMP_IMAGE) && key < PriorityMuxer::LOWEST_PRIORITY-1)
|
||||||
{
|
|
||||||
clearInput(key);
|
clearInput(key);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -331,19 +336,20 @@ void PriorityMuxer::setCurrentTime()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// apply & emit on change (after apply!)
|
// apply & emit on change (after apply!)
|
||||||
if (_currentPriority != newPriority)
|
hyperion::Components comp = getComponentOfPriority(newPriority);
|
||||||
|
if (_currentPriority != newPriority || comp != _prevVisComp)
|
||||||
{
|
{
|
||||||
_previousPriority = _currentPriority;
|
_previousPriority = _currentPriority;
|
||||||
_currentPriority = newPriority;
|
_currentPriority = newPriority;
|
||||||
Debug(_log, "Set visible priority to %d", newPriority);
|
Debug(_log, "Set visible priority to %d", newPriority);
|
||||||
emit visiblePriorityChanged(newPriority);
|
emit visiblePriorityChanged(newPriority);
|
||||||
// check for visible comp change
|
// check for visible comp change
|
||||||
hyperion::Components comp = getComponentOfPriority(newPriority);
|
|
||||||
if (comp != _prevVisComp)
|
if (comp != _prevVisComp)
|
||||||
{
|
{
|
||||||
_prevVisComp = comp;
|
_prevVisComp = comp;
|
||||||
emit visibleComponentChanged(comp);
|
emit visibleComponentChanged(comp);
|
||||||
}
|
}
|
||||||
|
emit prioritiesChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user