mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Added some code comments
Former-commit-id: 58c1ec1fd2dcc210b6d162d1e8b6c40a502f30fa
This commit is contained in:
parent
30cc14d9e8
commit
fbe8e0ad4e
@ -4,7 +4,7 @@
|
|||||||
#include "LinearColorSmoothing.h"
|
#include "LinearColorSmoothing.h"
|
||||||
|
|
||||||
LinearColorSmoothing::LinearColorSmoothing(
|
LinearColorSmoothing::LinearColorSmoothing(
|
||||||
LedDevice *ledDevice,
|
LedDevice * ledDevice,
|
||||||
double ledUpdateFrequency_hz,
|
double ledUpdateFrequency_hz,
|
||||||
int settlingTime_ms,
|
int settlingTime_ms,
|
||||||
unsigned updateDelay) :
|
unsigned updateDelay) :
|
||||||
@ -51,6 +51,8 @@ int LinearColorSmoothing::write(const std::vector<ColorRgb> &ledValues)
|
|||||||
|
|
||||||
int LinearColorSmoothing::switchOff()
|
int LinearColorSmoothing::switchOff()
|
||||||
{
|
{
|
||||||
|
// We will keep updating the leds (but with pure-black)
|
||||||
|
|
||||||
// Clear the smoothing parameters
|
// Clear the smoothing parameters
|
||||||
std::fill(_targetValues.begin(), _targetValues.end(), ColorRgb::BLACK);
|
std::fill(_targetValues.begin(), _targetValues.end(), ColorRgb::BLACK);
|
||||||
_targetTime = 0;
|
_targetTime = 0;
|
||||||
@ -62,7 +64,6 @@ int LinearColorSmoothing::switchOff()
|
|||||||
_outputQueue.pop_front();
|
_outputQueue.pop_front();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,11 +102,14 @@ void LinearColorSmoothing::queueColors(const std::vector<ColorRgb> & ledColors)
|
|||||||
{
|
{
|
||||||
if (_outputDelay == 0)
|
if (_outputDelay == 0)
|
||||||
{
|
{
|
||||||
|
// No output delay => immediate write
|
||||||
_ledDevice->write(ledColors);
|
_ledDevice->write(ledColors);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Push the new colors in the delay-buffer
|
||||||
_outputQueue.push_back(ledColors);
|
_outputQueue.push_back(ledColors);
|
||||||
|
// If the delay-buffer is filled pop the front and write to device
|
||||||
if (_outputQueue.size() > _outputDelay)
|
if (_outputQueue.size() > _outputDelay)
|
||||||
{
|
{
|
||||||
_ledDevice->write(_outputQueue.front());
|
_ledDevice->write(_outputQueue.front());
|
||||||
|
Loading…
Reference in New Issue
Block a user