From fbe8e0ad4e29ea4e278ac2831b259cc3f368e8aa Mon Sep 17 00:00:00 2001 From: "T. van der Zwan" Date: Thu, 25 Sep 2014 22:05:01 +0200 Subject: [PATCH] Added some code comments Former-commit-id: 58c1ec1fd2dcc210b6d162d1e8b6c40a502f30fa --- libsrc/hyperion/LinearColorSmoothing.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libsrc/hyperion/LinearColorSmoothing.cpp b/libsrc/hyperion/LinearColorSmoothing.cpp index 47974c90..888b1c2f 100644 --- a/libsrc/hyperion/LinearColorSmoothing.cpp +++ b/libsrc/hyperion/LinearColorSmoothing.cpp @@ -4,7 +4,7 @@ #include "LinearColorSmoothing.h" LinearColorSmoothing::LinearColorSmoothing( - LedDevice *ledDevice, + LedDevice * ledDevice, double ledUpdateFrequency_hz, int settlingTime_ms, unsigned updateDelay) : @@ -51,6 +51,8 @@ int LinearColorSmoothing::write(const std::vector &ledValues) int LinearColorSmoothing::switchOff() { + // We will keep updating the leds (but with pure-black) + // Clear the smoothing parameters std::fill(_targetValues.begin(), _targetValues.end(), ColorRgb::BLACK); _targetTime = 0; @@ -62,7 +64,6 @@ int LinearColorSmoothing::switchOff() _outputQueue.pop_front(); } - return 0; } @@ -101,11 +102,14 @@ void LinearColorSmoothing::queueColors(const std::vector & ledColors) { if (_outputDelay == 0) { + // No output delay => immediate write _ledDevice->write(ledColors); } else { + // Push the new colors in the delay-buffer _outputQueue.push_back(ledColors); + // If the delay-buffer is filled pop the front and write to device if (_outputQueue.size() > _outputDelay) { _ledDevice->write(_outputQueue.front());