@@ -106,7 +106,6 @@ int LedDeviceTinkerforge::write(const std::vector<ColorRgb> &ledValues)
106
106
107
107
int LedDeviceTinkerforge::switchOff ()
108
108
{
109
- std::cerr << " Switchoff" << std::endl;
110
109
std::fill (_redChannel.begin (), _redChannel.end (), 0 );
111
110
std::fill (_greenChannel.begin (), _greenChannel.end (), 0 );
112
111
std::fill (_blueChannel.begin (), _blueChannel.end (), 0 );
@@ -121,17 +120,18 @@ int LedDeviceTinkerforge::transferLedData(LEDStrip *ledStrip, unsigned index, un
121
120
return E_INVALID_PARAMETER;
122
121
}
123
122
124
- uint8_t * redPtr = redChannel;
125
- uint8_t * greenPtr = greenChannel;
126
- uint8_t * bluePtr = blueChannel;
123
+ uint8_t reds[MAX_NUM_LEDS_SETTABLE];
124
+ uint8_t greens[MAX_NUM_LEDS_SETTABLE];
125
+ uint8_t blues[MAX_NUM_LEDS_SETTABLE];
126
+
127
127
for (unsigned i=index; i<length; i+=MAX_NUM_LEDS_SETTABLE)
128
128
{
129
129
const unsigned copyLength = (i + MAX_NUM_LEDS_SETTABLE > length) ? length - i : MAX_NUM_LEDS_SETTABLE;
130
- const int status = led_strip_set_rgb_values (ledStrip, i, copyLength, redPtr, greenPtr, bluePtr);
131
- redPtr += copyLength;
132
- greenPtr += copyLength;
133
- bluePtr += copyLength;
130
+ memcpy (reds, redChannel + i, copyLength);
131
+ memcpy (greens, greenChannel + i, copyLength);
132
+ memcpy (blues, blueChannel + i, copyLength);
134
133
134
+ const int status = led_strip_set_rgb_values (ledStrip, i, copyLength, reds, greens, blues);
135
135
if (status != E_OK)
136
136
{
137
137
std::cerr << " Setting led values failed with status " << status << std::endl;
0 commit comments