diff --git a/wled00/FX.cpp b/wled00/FX.cpp index ff69e439..5c0aa546 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -289,7 +289,6 @@ uint16_t mode_dynamic(void) { if (!SEGENV.allocateData(SEGLEN)) return mode_static(); //allocation failed if(SEGENV.call == 0) { - //SEGMENT.setUpLeds(); //lossless getPixelColor() //SEGMENT.fill(BLACK); for (int i = 0; i < SEGLEN; i++) SEGENV.data[i] = random8(); } diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 206e626f..dbe35a8c 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1263,7 +1263,8 @@ void WS2812FX::show(void) { uint8_t busBrightness = estimateCurrentAndLimitBri(); if (_globalLedBuffer) { // copy data from buffer to bus - for (uint16_t i = 0; i < _length; i++) busses.setPixelColor(i, _globalLedBuffer[i]); + //for (uint16_t i = 0; i < _length; i++) busses.setPixelColor(i, _globalLedBuffer[i]); + busses.setColorsFromBuffer(_globalLedBuffer); } else { // if brightness changed since last show, must set everything again to update to new luminance if (_renderBrightness != busBrightness) { diff --git a/wled00/bus_manager.cpp b/wled00/bus_manager.cpp index 4b75baad..001ac1d4 100644 --- a/wled00/bus_manager.cpp +++ b/wled00/bus_manager.cpp @@ -506,7 +506,7 @@ void BusManager::setStatusPixel(uint32_t c) { } } -void IRAM_ATTR BusManager::setPixelColor(uint16_t pix, uint32_t c, int16_t cct) { +void IRAM_ATTR BusManager::setPixelColor(uint16_t pix, uint32_t c) { for (uint8_t i = 0; i < numBusses; i++) { Bus* b = busses[i]; uint16_t bstart = b->getStart(); @@ -515,6 +515,15 @@ void IRAM_ATTR BusManager::setPixelColor(uint16_t pix, uint32_t c, int16_t cct) } } +void BusManager::setColorsFromBuffer(uint32_t* buf) { + for (uint8_t i = 0; i < numBusses; i++) { + Bus* b = busses[i]; + uint16_t bstart = b->getStart(); + for (uint16_t pix = 0; pix < b->getLength(); pix++) + busses[i]->setPixelColor(pix, buf[bstart + pix]); + } +} + void BusManager::setBrightness(uint8_t b) { for (uint8_t i = 0; i < numBusses; i++) { busses[i]->setBrightness(b); diff --git a/wled00/bus_manager.h b/wled00/bus_manager.h index 8740a9a2..e550440a 100644 --- a/wled00/bus_manager.h +++ b/wled00/bus_manager.h @@ -357,7 +357,9 @@ class BusManager { void setStatusPixel(uint32_t c); - void setPixelColor(uint16_t pix, uint32_t c, int16_t cct=-1); + void setPixelColor(uint16_t pix, uint32_t c); + + void setColorsFromBuffer(uint32_t* buf); void setBrightness(uint8_t b);