This repository was archived by the owner on May 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 4
4
#include " LinearColorSmoothing.h"
5
5
6
6
LinearColorSmoothing::LinearColorSmoothing (
7
- LedDevice *ledDevice,
7
+ LedDevice * ledDevice,
8
8
double ledUpdateFrequency_hz,
9
9
int settlingTime_ms,
10
10
unsigned updateDelay) :
@@ -51,6 +51,8 @@ int LinearColorSmoothing::write(const std::vector<ColorRgb> &ledValues)
51
51
52
52
int LinearColorSmoothing::switchOff ()
53
53
{
54
+ // We will keep updating the leds (but with pure-black)
55
+
54
56
// Clear the smoothing parameters
55
57
std::fill (_targetValues.begin (), _targetValues.end (), ColorRgb::BLACK);
56
58
_targetTime = 0 ;
@@ -62,7 +64,6 @@ int LinearColorSmoothing::switchOff()
62
64
_outputQueue.pop_front ();
63
65
}
64
66
65
-
66
67
return 0 ;
67
68
}
68
69
@@ -101,11 +102,14 @@ void LinearColorSmoothing::queueColors(const std::vector<ColorRgb> & ledColors)
101
102
{
102
103
if (_outputDelay == 0 )
103
104
{
105
+ // No output delay => immediate write
104
106
_ledDevice->write (ledColors);
105
107
}
106
108
else
107
109
{
110
+ // Push the new colors in the delay-buffer
108
111
_outputQueue.push_back (ledColors);
112
+ // If the delay-buffer is filled pop the front and write to device
109
113
if (_outputQueue.size () > _outputDelay)
110
114
{
111
115
_ledDevice->write (_outputQueue.front ());
You can’t perform that action at this time.
0 commit comments