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

Commit e2764d3

Browse files
committed
Fixed call to thinkerforge library
1 parent 4d5a4f9 commit e2764d3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

libsrc/leddevice/LedDeviceTinkerforge.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ int LedDeviceTinkerforge::write(const std::vector<ColorRgb> &ledValues)
106106

107107
int LedDeviceTinkerforge::switchOff()
108108
{
109-
std::cerr << "Switchoff" << std::endl;
110109
std::fill(_redChannel.begin(), _redChannel.end(), 0);
111110
std::fill(_greenChannel.begin(), _greenChannel.end(), 0);
112111
std::fill(_blueChannel.begin(), _blueChannel.end(), 0);
@@ -121,17 +120,18 @@ int LedDeviceTinkerforge::transferLedData(LEDStrip *ledStrip, unsigned index, un
121120
return E_INVALID_PARAMETER;
122121
}
123122

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+
127127
for (unsigned i=index; i<length; i+=MAX_NUM_LEDS_SETTABLE)
128128
{
129129
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);
134133

134+
const int status = led_strip_set_rgb_values(ledStrip, i, copyLength, reds, greens, blues);
135135
if (status != E_OK)
136136
{
137137
std::cerr << "Setting led values failed with status " << status << std::endl;

0 commit comments

Comments
 (0)