From e549e15c3ff7f4c5afc500150453e30776d882e6 Mon Sep 17 00:00:00 2001 From: "T. van der Zwan" Date: Sat, 8 Mar 2014 19:55:23 +0100 Subject: [PATCH] Fixed call to thinkerforge library Former-commit-id: e2764d3ecbf7d462ad5d967572b3ea37548fec73 --- libsrc/leddevice/LedDeviceTinkerforge.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libsrc/leddevice/LedDeviceTinkerforge.cpp b/libsrc/leddevice/LedDeviceTinkerforge.cpp index e99f482f..83367042 100644 --- a/libsrc/leddevice/LedDeviceTinkerforge.cpp +++ b/libsrc/leddevice/LedDeviceTinkerforge.cpp @@ -106,7 +106,6 @@ int LedDeviceTinkerforge::write(const std::vector &ledValues) int LedDeviceTinkerforge::switchOff() { - std::cerr << "Switchoff" << std::endl; std::fill(_redChannel.begin(), _redChannel.end(), 0); std::fill(_greenChannel.begin(), _greenChannel.end(), 0); std::fill(_blueChannel.begin(), _blueChannel.end(), 0); @@ -121,17 +120,18 @@ int LedDeviceTinkerforge::transferLedData(LEDStrip *ledStrip, unsigned index, un return E_INVALID_PARAMETER; } - uint8_t * redPtr = redChannel; - uint8_t * greenPtr = greenChannel; - uint8_t * bluePtr = blueChannel; + uint8_t reds[MAX_NUM_LEDS_SETTABLE]; + uint8_t greens[MAX_NUM_LEDS_SETTABLE]; + uint8_t blues[MAX_NUM_LEDS_SETTABLE]; + for (unsigned i=index; i length) ? length - i : MAX_NUM_LEDS_SETTABLE; - const int status = led_strip_set_rgb_values(ledStrip, i, copyLength, redPtr, greenPtr, bluePtr); - redPtr += copyLength; - greenPtr += copyLength; - bluePtr += copyLength; + memcpy(reds, redChannel + i, copyLength); + memcpy(greens, greenChannel + i, copyLength); + memcpy(blues, blueChannel + i, copyLength); + const int status = led_strip_set_rgb_values(ledStrip, i, copyLength, reds, greens, blues); if (status != E_OK) { std::cerr << "Setting led values failed with status " << status << std::endl;