Threading and more

- webui remove restarts
- threading for LedDevice
This commit is contained in:
Paulchen-Panther
2019-01-01 19:47:07 +01:00
parent 7b6df922ea
commit 7352ff4d42
24 changed files with 482 additions and 282 deletions

View File

@@ -9,9 +9,8 @@
using namespace hyperion;
LinearColorSmoothing::LinearColorSmoothing( LedDevice * ledDevice, const QJsonDocument& config, Hyperion* hyperion)
: LedDevice()
, _ledDevice(ledDevice)
LinearColorSmoothing::LinearColorSmoothing(const QJsonDocument& config, Hyperion* hyperion)
: LedDevice(QJsonObject(), hyperion)
, _log(Logger::getInstance("SMOOTHING"))
, _hyperion(hyperion)
, _updateInterval(1000)
@@ -42,8 +41,7 @@ LinearColorSmoothing::LinearColorSmoothing( LedDevice * ledDevice, const QJsonDo
LinearColorSmoothing::~LinearColorSmoothing()
{
// Make sure to switch off the underlying led-device (because switchOff is no longer forwarded)
_ledDevice->switchOff();
}
void LinearColorSmoothing::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
@@ -148,7 +146,8 @@ void LinearColorSmoothing::queueColors(const std::vector<ColorRgb> & ledColors)
{
// No output delay => immediate write
if ( _writeToLedsEnable && !_pause)
_ledDevice->setLedValues(ledColors);
emit _hyperion->ledDeviceData(ledColors);
}
else
{
@@ -163,7 +162,7 @@ void LinearColorSmoothing::queueColors(const std::vector<ColorRgb> & ledColors)
{
if (!_pause)
{
_ledDevice->setLedValues(_outputQueue.front());
emit _hyperion->ledDeviceData(_outputQueue.front());
}
_outputQueue.pop_front();
}
@@ -235,18 +234,3 @@ bool LinearColorSmoothing::selectConfig(unsigned cfg, const bool& force)
_currentConfigId = 0;
return false;
}
void LinearColorSmoothing::startTimerDelayed()
{
QTimer::singleShot(500, this, SLOT(delayStartTimer()));
}
void LinearColorSmoothing::stopTimer()
{
_timer->stop();
}
void LinearColorSmoothing::delayStartTimer()
{
_timer->start();
}