multi fix commit (#112)

* multi fix commit

- refactoring leddevicefactory
- adalight: default for "delayAfterConnect" is 1s now - needed for most arduino's because of there special behaviour on open
- fadecandy: new option for disabling configuration send - if you want to keep your fadecandy defaults
- Hyperion.cpp: simplify createSmoothing discussed in #105
- smoothing:
-- add option for continuous output
-- when updatedelay>0 and continousOutput is disabled, buffer is flushed correctly after no input is detected

* add doxygen to travis
This commit is contained in:
redPanther
2016-07-13 11:18:12 +02:00
committed by brindosch
parent 1cf7fd545e
commit 5a2ef6c4a3
14 changed files with 212 additions and 255 deletions

View File

@@ -3,26 +3,24 @@
#include "LinearColorSmoothing.h"
LinearColorSmoothing::LinearColorSmoothing(
LedDevice * ledDevice,
double ledUpdateFrequency_hz,
int settlingTime_ms,
unsigned updateDelay) :
QObject(),
LedDevice(),
_ledDevice(ledDevice),
_updateInterval(1000 / ledUpdateFrequency_hz),
_settlingTime(settlingTime_ms),
_timer(),
_outputDelay(updateDelay),
_writeToLedsEnable(true)
LinearColorSmoothing::LinearColorSmoothing( LedDevice * ledDevice, double ledUpdateFrequency_hz, int settlingTime_ms, unsigned updateDelay, bool continuousOutput)
: QObject()
, LedDevice()
, _ledDevice(ledDevice)
, _updateInterval(1000 / ledUpdateFrequency_hz)
, _settlingTime(settlingTime_ms)
, _timer()
, _outputDelay(updateDelay)
, _writeToLedsEnable(true)
, _continuousOutput(continuousOutput)
{
_timer.setSingleShot(false);
_timer.setInterval(_updateInterval);
connect(&_timer, SIGNAL(timeout()), this, SLOT(updateLeds()));
Info(Logger::getInstance("Smoothing"), "Created linear-smoothing with interval_ms: %d, settlingTime_ms: %d, updateDelay: %d",
Info(Logger::getInstance("Smoothing"),
"Created linear-smoothing with interval: %d ms, settlingTime: %d ms, updateDelay: %d frames",
_updateInterval, settlingTime_ms, _outputDelay );
}
@@ -84,7 +82,7 @@ void LinearColorSmoothing::updateLeds()
_previousTime = now;
queueColors(_previousValues);
_writeToLedsEnable = false;
_writeToLedsEnable = _continuousOutput;
}
else
{
@@ -116,14 +114,18 @@ void LinearColorSmoothing::queueColors(const std::vector<ColorRgb> & ledColors)
}
else
{
// Push the new colors in the delay-buffer
_outputQueue.push_back(ledColors);
// Push new colors in the delay-buffer
if ( _writeToLedsEnable )
_outputQueue.push_back(ledColors);
// If the delay-buffer is filled pop the front and write to device
if (_outputQueue.size() > _outputDelay)
if (_outputQueue.size() > 0 )
{
if ( _writeToLedsEnable )
if ( _outputQueue.size() > _outputDelay || !_writeToLedsEnable )
{
_ledDevice->write(_outputQueue.front());
_outputQueue.pop_front();
_outputQueue.pop_front();
}
}
}
}