mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Smoothing Fixes, Optimizations (#1295)
* Fix #1098, Removed Continuous Output as being obsolete * Pause output processing when no input source is available * Only show configurable options for Linear smoothing
This commit is contained in:
parent
f0bd38d473
commit
1ef3a106f1
@ -58,8 +58,7 @@
|
|||||||
"outputRate" : 25.0000,
|
"outputRate" : 25.0000,
|
||||||
"decay" : 1,
|
"decay" : 1,
|
||||||
"dithering" : false,
|
"dithering" : false,
|
||||||
"updateDelay" : 0,
|
"updateDelay" : 0
|
||||||
"continuousOutput" : true
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"grabberV4L2" :
|
"grabberV4L2" :
|
||||||
|
@ -476,8 +476,11 @@ private slots:
|
|||||||
///
|
///
|
||||||
void handleNewVideoMode(VideoMode mode) { _currVideoMode = mode; }
|
void handleNewVideoMode(VideoMode mode) { _currVideoMode = mode; }
|
||||||
|
|
||||||
|
///
|
||||||
void handlePriorityChangedLedDevice(const quint8& priority);
|
/// @brief Handle the scenario when no/an input source is available
|
||||||
|
/// @param priority Current priority
|
||||||
|
///
|
||||||
|
void handleSourceAvailability(const quint8& priority);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class HyperionDaemon;
|
friend class HyperionDaemon;
|
||||||
|
@ -93,7 +93,7 @@ void Hyperion::start()
|
|||||||
|
|
||||||
// connect Hyperion::update with Muxer visible priority changes as muxer updates independent
|
// 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::update);
|
||||||
connect(&_muxer, &PriorityMuxer::visiblePriorityChanged, this, &Hyperion::handlePriorityChangedLedDevice);
|
connect(&_muxer, &PriorityMuxer::visiblePriorityChanged, this, &Hyperion::handleSourceAvailability);
|
||||||
connect(&_muxer, &PriorityMuxer::visibleComponentChanged, this, &Hyperion::handleVisibleComponentChanged);
|
connect(&_muxer, &PriorityMuxer::visibleComponentChanged, this, &Hyperion::handleVisibleComponentChanged);
|
||||||
|
|
||||||
// listens for ComponentRegister changes of COMP_ALL to perform core enable/disable actions
|
// listens for ComponentRegister changes of COMP_ALL to perform core enable/disable actions
|
||||||
@ -552,22 +552,23 @@ void Hyperion::handleVisibleComponentChanged(hyperion::Components comp)
|
|||||||
_raw2ledAdjustment->setBacklightEnabled((comp != hyperion::COMP_COLOR && comp != hyperion::COMP_EFFECT));
|
_raw2ledAdjustment->setBacklightEnabled((comp != hyperion::COMP_COLOR && comp != hyperion::COMP_EFFECT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hyperion::handlePriorityChangedLedDevice(const quint8& priority)
|
void Hyperion::handleSourceAvailability(const quint8& priority)
|
||||||
{
|
{ int previousPriority = _muxer.getPreviousPriority();
|
||||||
int previousPriority = _muxer.getPreviousPriority();
|
|
||||||
|
|
||||||
Debug(_log,"priority[%d], previousPriority[%d]", priority, previousPriority);
|
Debug(_log,"priority[%d], previousPriority[%d]", priority, previousPriority);
|
||||||
if ( priority == PriorityMuxer::LOWEST_PRIORITY)
|
if ( priority == PriorityMuxer::LOWEST_PRIORITY)
|
||||||
{
|
{
|
||||||
Debug(_log,"No source left -> switch LED-Device off");
|
Debug(_log,"No source left -> Pause output processing and switch LED-Device off");
|
||||||
emit _ledDeviceWrapper->switchOff();
|
emit _ledDeviceWrapper->switchOff();
|
||||||
|
emit _deviceSmooth->setPause(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( previousPriority == PriorityMuxer::LOWEST_PRIORITY )
|
if ( previousPriority == PriorityMuxer::LOWEST_PRIORITY )
|
||||||
{
|
{
|
||||||
Debug(_log,"new source available -> switch LED-Device on");
|
Debug(_log,"new source available -> Resume output processing and switch LED-Device on");
|
||||||
emit _ledDeviceWrapper->switchOn();
|
emit _ledDeviceWrapper->switchOn();
|
||||||
|
emit _deviceSmooth->setPause(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,8 +57,6 @@ LinearColorSmoothing::LinearColorSmoothing(const QJsonDocument &config, Hyperion
|
|||||||
, _timer(new QTimer(this))
|
, _timer(new QTimer(this))
|
||||||
, _outputDelay(DEFAUL_OUTPUTDEPLAY)
|
, _outputDelay(DEFAUL_OUTPUTDEPLAY)
|
||||||
, _smoothingType(SmoothingType::Linear)
|
, _smoothingType(SmoothingType::Linear)
|
||||||
, _writeToLedsEnable(false)
|
|
||||||
, _continuousOutput(false)
|
|
||||||
, _pause(false)
|
, _pause(false)
|
||||||
, _currentConfigId(0)
|
, _currentConfigId(0)
|
||||||
, _enabled(false)
|
, _enabled(false)
|
||||||
@ -94,8 +92,6 @@ void LinearColorSmoothing::handleSettingsUpdate(settings::type type, const QJson
|
|||||||
setEnable(obj["enable"].toBool(true));
|
setEnable(obj["enable"].toBool(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
_continuousOutput = obj["continuousOutput"].toBool(true);
|
|
||||||
|
|
||||||
SMOOTHING_CFG cfg = {SmoothingType::Linear,true, 0, 0, 0, 0, 0, false, 1};
|
SMOOTHING_CFG cfg = {SmoothingType::Linear,true, 0, 0, 0, 0, 0, false, 1};
|
||||||
|
|
||||||
const QString typeString = obj[SETTINGS_KEY_SMOOTHING_TYPE].toString();
|
const QString typeString = obj[SETTINGS_KEY_SMOOTHING_TYPE].toString();
|
||||||
@ -192,7 +188,6 @@ void LinearColorSmoothing::writeDirect()
|
|||||||
_previousWriteTime = now;
|
_previousWriteTime = now;
|
||||||
|
|
||||||
queueColors(_previousValues);
|
queueColors(_previousValues);
|
||||||
_writeToLedsEnable = _continuousOutput;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -201,7 +196,6 @@ void LinearColorSmoothing::writeFrame()
|
|||||||
const int64_t now = micros();
|
const int64_t now = micros();
|
||||||
_previousWriteTime = now;
|
_previousWriteTime = now;
|
||||||
queueColors(_previousValues);
|
queueColors(_previousValues);
|
||||||
_writeToLedsEnable = _continuousOutput;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -505,30 +499,23 @@ void LinearColorSmoothing::clearRememberedFrames()
|
|||||||
|
|
||||||
void LinearColorSmoothing::queueColors(const std::vector<ColorRgb> &ledColors)
|
void LinearColorSmoothing::queueColors(const std::vector<ColorRgb> &ledColors)
|
||||||
{
|
{
|
||||||
//Debug(_log, "queueColors - _outputDelay[%d] _outputQueue.size() [%d], _writeToLedsEnable[%d]", _outputDelay, _outputQueue.size(), _writeToLedsEnable);
|
|
||||||
if (_outputDelay == 0)
|
if (_outputDelay == 0)
|
||||||
{
|
{
|
||||||
// No output delay => immediate write
|
// No output delay => immediate write
|
||||||
if (_writeToLedsEnable && !_pause)
|
if (!_pause)
|
||||||
{
|
{
|
||||||
// if ( ledColors.size() == 0 )
|
|
||||||
// qFatal ("No LedValues! - in LinearColorSmoothing::queueColors() - _outputDelay == 0");
|
|
||||||
// else
|
|
||||||
emit _hyperion->ledDeviceData(ledColors);
|
emit _hyperion->ledDeviceData(ledColors);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Push new colors in the delay-buffer
|
// Push new colors in the delay-buffer
|
||||||
if (_writeToLedsEnable)
|
|
||||||
{
|
|
||||||
_outputQueue.push_back(ledColors);
|
_outputQueue.push_back(ledColors);
|
||||||
}
|
|
||||||
|
|
||||||
// If the delay-buffer is filled pop the front and write to device
|
// If the delay-buffer is filled pop the front and write to device
|
||||||
if (!_outputQueue.empty())
|
if (!_outputQueue.empty())
|
||||||
{
|
{
|
||||||
if (_outputQueue.size() > _outputDelay || !_writeToLedsEnable)
|
if (_outputQueue.size() > _outputDelay)
|
||||||
{
|
{
|
||||||
if (!_pause)
|
if (!_pause)
|
||||||
{
|
{
|
||||||
@ -552,7 +539,6 @@ void LinearColorSmoothing::clearQueuedColors()
|
|||||||
|
|
||||||
void LinearColorSmoothing::componentStateChange(hyperion::Components component, bool state)
|
void LinearColorSmoothing::componentStateChange(hyperion::Components component, bool state)
|
||||||
{
|
{
|
||||||
_writeToLedsEnable = state;
|
|
||||||
if (component == hyperion::COMP_LEDDEVICE)
|
if (component == hyperion::COMP_LEDDEVICE)
|
||||||
{
|
{
|
||||||
clearQueuedColors();
|
clearQueuedColors();
|
||||||
@ -682,7 +668,7 @@ bool LinearColorSmoothing::selectConfig(unsigned cfg, bool force)
|
|||||||
|
|
||||||
QMetaObject::invokeMethod(_timer, "stop", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(_timer, "stop", Qt::QueuedConnection);
|
||||||
_updateInterval = _cfgList[cfg].updateInterval;
|
_updateInterval = _cfgList[cfg].updateInterval;
|
||||||
if (this->enabled() && this->_writeToLedsEnable)
|
if (this->enabled())
|
||||||
{
|
{
|
||||||
//Debug( _log, "_cfgList[cfg].updateInterval != _updateInterval - Restart timer - _updateInterval [%d]", _updateInterval);
|
//Debug( _log, "_cfgList[cfg].updateInterval != _updateInterval - Restart timer - _updateInterval [%d]", _updateInterval);
|
||||||
QMetaObject::invokeMethod(_timer, "start", Qt::QueuedConnection, Q_ARG(int, _updateInterval));
|
QMetaObject::invokeMethod(_timer, "start", Qt::QueuedConnection, Q_ARG(int, _updateInterval));
|
||||||
|
@ -222,12 +222,6 @@ private:
|
|||||||
/// The queue of temporarily remembered frames
|
/// The queue of temporarily remembered frames
|
||||||
std::deque<REMEMBERED_FRAME> _frameQueue;
|
std::deque<REMEMBERED_FRAME> _frameQueue;
|
||||||
|
|
||||||
/// Prevent sending data to device when no intput data is sent
|
|
||||||
bool _writeToLedsEnable;
|
|
||||||
|
|
||||||
/// Flag for dis/enable continuous output to led device regardless there is new data or not
|
|
||||||
bool _continuousOutput;
|
|
||||||
|
|
||||||
/// Flag for pausing
|
/// Flag for pausing
|
||||||
bool _pause;
|
bool _pause;
|
||||||
|
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
{
|
{
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"title": "edt_conf_smooth_heading_title",
|
"title": "edt_conf_smooth_heading_title",
|
||||||
"properties" :
|
"properties": {
|
||||||
{
|
"enable": {
|
||||||
"enable" :
|
|
||||||
{
|
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"title": "edt_conf_general_enable_title",
|
"title": "edt_conf_general_enable_title",
|
||||||
"default": true,
|
"default": true,
|
||||||
"propertyOrder": 1
|
"propertyOrder": 1
|
||||||
},
|
},
|
||||||
"type" :
|
"type": {
|
||||||
{
|
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "edt_conf_smooth_type_title",
|
"title": "edt_conf_smooth_type_title",
|
||||||
"enum": [ "linear", "decay" ],
|
"enum": [ "linear", "decay" ],
|
||||||
@ -21,8 +18,7 @@
|
|||||||
},
|
},
|
||||||
"propertyOrder": 2
|
"propertyOrder": 2
|
||||||
},
|
},
|
||||||
"time_ms" :
|
"time_ms": {
|
||||||
{
|
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"title": "edt_conf_smooth_time_ms_title",
|
"title": "edt_conf_smooth_time_ms_title",
|
||||||
"minimum": 25,
|
"minimum": 25,
|
||||||
@ -31,8 +27,7 @@
|
|||||||
"append": "edt_append_ms",
|
"append": "edt_append_ms",
|
||||||
"propertyOrder": 3
|
"propertyOrder": 3
|
||||||
},
|
},
|
||||||
"updateFrequency" :
|
"updateFrequency": {
|
||||||
{
|
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"title": "edt_conf_smooth_updateFrequency_title",
|
"title": "edt_conf_smooth_updateFrequency_title",
|
||||||
"minimum": 1.0,
|
"minimum": 1.0,
|
||||||
@ -41,44 +36,59 @@
|
|||||||
"append": "edt_append_hz",
|
"append": "edt_append_hz",
|
||||||
"propertyOrder": 4
|
"propertyOrder": 4
|
||||||
},
|
},
|
||||||
"interpolationRate" :
|
"interpolationRate": {
|
||||||
{
|
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"title": "edt_conf_smooth_interpolationRate_title",
|
"title": "edt_conf_smooth_interpolationRate_title",
|
||||||
"minimum": 1.0,
|
"minimum": 1.0,
|
||||||
"maximum": 1000.0,
|
"maximum": 1000.0,
|
||||||
"default": 1.0,
|
"default": 1.0,
|
||||||
"append": "edt_append_hz",
|
"append": "edt_append_hz",
|
||||||
"propertyOrder" : 5
|
"propertyOrder": 5,
|
||||||
|
"options": {
|
||||||
|
"dependencies": {
|
||||||
|
"type": "decay"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"outputRate" :
|
"outputRate": {
|
||||||
{
|
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"title": "edt_conf_smooth_outputRate_title",
|
"title": "edt_conf_smooth_outputRate_title",
|
||||||
"minimum": 1.0,
|
"minimum": 1.0,
|
||||||
"maximum": 1000.0,
|
"maximum": 1000.0,
|
||||||
"default": 1.0,
|
"default": 1.0,
|
||||||
"append": "edt_append_hz",
|
"append": "edt_append_hz",
|
||||||
"propertyOrder" : 6
|
"propertyOrder": 6,
|
||||||
|
"options": {
|
||||||
|
"dependencies": {
|
||||||
|
"type": "decay"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"decay" :
|
"decay": {
|
||||||
{
|
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"title": "edt_conf_smooth_decay_title",
|
"title": "edt_conf_smooth_decay_title",
|
||||||
"default": 1.0,
|
"default": 1.0,
|
||||||
"minimum": 1.0,
|
"minimum": 1.0,
|
||||||
"maximum": 20.0,
|
"maximum": 20.0,
|
||||||
"propertyOrder" : 7
|
"propertyOrder": 7,
|
||||||
|
"options": {
|
||||||
|
"dependencies": {
|
||||||
|
"type": "decay"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"dithering" :
|
"dithering": {
|
||||||
{
|
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"title": "edt_conf_smooth_dithering_title",
|
"title": "edt_conf_smooth_dithering_title",
|
||||||
"default": true,
|
"default": true,
|
||||||
"propertyOrder" : 8
|
"propertyOrder": 8,
|
||||||
|
"options": {
|
||||||
|
"dependencies": {
|
||||||
|
"type": "decay"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"updateDelay" :
|
"updateDelay": {
|
||||||
{
|
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"title": "edt_conf_smooth_updateDelay_title",
|
"title": "edt_conf_smooth_updateDelay_title",
|
||||||
"minimum": 0,
|
"minimum": 0,
|
||||||
@ -86,13 +96,6 @@
|
|||||||
"default": 0,
|
"default": 0,
|
||||||
"append": "edt_append_ms",
|
"append": "edt_append_ms",
|
||||||
"propertyOrder": 9
|
"propertyOrder": 9
|
||||||
},
|
|
||||||
"continuousOutput" :
|
|
||||||
{
|
|
||||||
"type" : "boolean",
|
|
||||||
"title" : "edt_conf_smooth_continuousOutput_title",
|
|
||||||
"default" : true,
|
|
||||||
"propertyOrder" : 10
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
Loading…
Reference in New Issue
Block a user