Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 58c1ec1

Browse files
committed
Added some code comments
1 parent fa5a7f1 commit 58c1ec1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

libsrc/hyperion/LinearColorSmoothing.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "LinearColorSmoothing.h"
55

66
LinearColorSmoothing::LinearColorSmoothing(
7-
LedDevice *ledDevice,
7+
LedDevice * ledDevice,
88
double ledUpdateFrequency_hz,
99
int settlingTime_ms,
1010
unsigned updateDelay) :
@@ -51,6 +51,8 @@ int LinearColorSmoothing::write(const std::vector<ColorRgb> &ledValues)
5151

5252
int LinearColorSmoothing::switchOff()
5353
{
54+
// We will keep updating the leds (but with pure-black)
55+
5456
// Clear the smoothing parameters
5557
std::fill(_targetValues.begin(), _targetValues.end(), ColorRgb::BLACK);
5658
_targetTime = 0;
@@ -62,7 +64,6 @@ int LinearColorSmoothing::switchOff()
6264
_outputQueue.pop_front();
6365
}
6466

65-
6667
return 0;
6768
}
6869

@@ -101,11 +102,14 @@ void LinearColorSmoothing::queueColors(const std::vector<ColorRgb> & ledColors)
101102
{
102103
if (_outputDelay == 0)
103104
{
105+
// No output delay => immediate write
104106
_ledDevice->write(ledColors);
105107
}
106108
else
107109
{
110+
// Push the new colors in the delay-buffer
108111
_outputQueue.push_back(ledColors);
112+
// If the delay-buffer is filled pop the front and write to device
109113
if (_outputQueue.size() > _outputDelay)
110114
{
111115
_ledDevice->write(_outputQueue.front());

0 commit comments

Comments
 (0)