Leddevice refactoring the next part (#253)

* add general switchOff

* refactoring of leddevices regarding ledcount and switchoff

* remove obsolete includes
This commit is contained in:
redPanther
2016-09-23 08:49:22 +02:00
committed by GitHub
parent 5aeec2e1e5
commit d6a34edfb2
71 changed files with 274 additions and 1073 deletions

View File

@@ -1,4 +1,3 @@
#include <iostream>
#include <exception>
#include "LedDeviceWS281x.h"
@@ -86,23 +85,6 @@ int LedDeviceWS281x::write(const std::vector<ColorRgb> &ledValues)
return ws2811_render(&_led_string) ? -1 : 0;
}
// Turn off the LEDs by sending 000000's
// TODO Allow optional power switch out another gpio, if this code handles it can
// make it more likely we don't accidentally drive data into an off strip
int LedDeviceWS281x::switchOff()
{
if (!_initialized)
{
return -1;
}
int idx = 0;
while (idx < _led_string.channel[_channel].count)
_led_string.channel[_channel].leds[idx++] = 0;
return ws2811_render(&_led_string) ? -1 : 0;
}
// Destructor
LedDeviceWS281x::~LedDeviceWS281x()
{