Slightly more efficient buffer copy to busses
This commit is contained in:
parent
61ba16b779
commit
fa9b151c36
@ -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();
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user