fix for outputs not working any more when receiving DDP or art-net pixels
This disables bus caching (and related speedups) while receiving realtime UDP pixels. Its still totally unclear to me what happens, and why disabling the cache solves problems.
This commit is contained in:
@@ -1261,6 +1261,7 @@ int BusManager::add(BusConfig &bc) {
|
||||
lastBus = nullptr;
|
||||
laststart = 0;
|
||||
lastend = 0;
|
||||
slowMode = false;
|
||||
return numBusses++;
|
||||
}
|
||||
|
||||
@@ -1279,6 +1280,7 @@ void BusManager::removeAll() {
|
||||
lastBus = nullptr;
|
||||
laststart = 0;
|
||||
lastend = 0;
|
||||
slowMode = false;
|
||||
}
|
||||
|
||||
void __attribute__((hot)) BusManager::show() {
|
||||
@@ -1298,7 +1300,7 @@ void BusManager::setStatusPixel(uint32_t c) {
|
||||
}
|
||||
|
||||
void IRAM_ATTR __attribute__((hot)) BusManager::setPixelColor(uint16_t pix, uint32_t c, int16_t cct) {
|
||||
if ((pix >= laststart) && (pix < lastend ) && (lastBus != nullptr)) {
|
||||
if ( !slowMode && (pix >= laststart) && (pix < lastend ) && (lastBus != nullptr)) {
|
||||
// WLEDMM same bus as last time - no need to search again
|
||||
lastBus->setPixelColor(pix - laststart, c);
|
||||
return;
|
||||
@@ -1309,10 +1311,12 @@ void IRAM_ATTR __attribute__((hot)) BusManager::setPixelColor(uint16_t pix, uint
|
||||
uint_fast16_t bstart = b->getStart();
|
||||
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
||||
else {
|
||||
// WLEDMM remember last Bus we took
|
||||
lastBus = b;
|
||||
laststart = bstart;
|
||||
lastend = bstart + b->getLength();
|
||||
if (!slowMode) {
|
||||
// WLEDMM remember last Bus we took
|
||||
lastBus = b;
|
||||
laststart = bstart;
|
||||
lastend = bstart + b->getLength();
|
||||
}
|
||||
b->setPixelColor(pix - bstart, c);
|
||||
break; // WLEDMM found the right Bus -> so we can stop searching
|
||||
}
|
||||
@@ -1335,7 +1339,7 @@ void __attribute__((cold)) BusManager::setSegmentCCT(int16_t cct, bool allowWBCo
|
||||
}
|
||||
|
||||
uint32_t IRAM_ATTR __attribute__((hot)) BusManager::getPixelColor(uint_fast16_t pix) { // WLEDMM use fast native types, IRAM_ATTR
|
||||
if ((pix >= laststart) && (pix < lastend ) && (lastBus != nullptr)) {
|
||||
if ( !slowMode && (pix >= laststart) && (pix < lastend ) && (lastBus != nullptr)) {
|
||||
// WLEDMM same bus as last time - no need to search again
|
||||
return lastBus->getPixelColor(pix - laststart);
|
||||
}
|
||||
@@ -1345,10 +1349,12 @@ uint32_t IRAM_ATTR __attribute__((hot)) BusManager::getPixelColor(uint_fast16_t
|
||||
uint_fast16_t bstart = b->getStart();
|
||||
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
||||
else {
|
||||
// WLEDMM remember last Bus we took
|
||||
lastBus = b;
|
||||
laststart = bstart;
|
||||
lastend = bstart + b->getLength();
|
||||
if (!slowMode) {
|
||||
// WLEDMM remember last Bus we took
|
||||
lastBus = b;
|
||||
laststart = bstart;
|
||||
lastend = bstart + b->getLength();
|
||||
}
|
||||
return b->getPixelColor(pix - bstart);
|
||||
}
|
||||
}
|
||||
@@ -1356,7 +1362,7 @@ uint32_t IRAM_ATTR __attribute__((hot)) BusManager::getPixelColor(uint_fast16_t
|
||||
}
|
||||
|
||||
uint32_t IRAM_ATTR __attribute__((hot)) BusManager::getPixelColorRestored(uint_fast16_t pix) { // WLEDMM uses bus::getPixelColorRestored()
|
||||
if ((pix >= laststart) && (pix < lastend ) && (lastBus != nullptr)) {
|
||||
if ( !slowMode && (pix >= laststart) && (pix < lastend ) && (lastBus != nullptr)) {
|
||||
// WLEDMM same bus as last time - no need to search again
|
||||
return lastBus->getPixelColorRestored(pix - laststart);
|
||||
}
|
||||
@@ -1366,10 +1372,12 @@ uint32_t IRAM_ATTR __attribute__((hot)) BusManager::getPixelColorRestored(uint_
|
||||
uint_fast16_t bstart = b->getStart();
|
||||
if (pix < bstart || pix >= bstart + b->getLength()) continue;
|
||||
else {
|
||||
// WLEDMM remember last Bus we took
|
||||
lastBus = b;
|
||||
laststart = bstart;
|
||||
lastend = bstart + b->getLength();
|
||||
if (!slowMode) {
|
||||
// WLEDMM remember last Bus we took
|
||||
lastBus = b;
|
||||
laststart = bstart;
|
||||
lastend = bstart + b->getLength();
|
||||
}
|
||||
return b->getPixelColorRestored(pix - bstart);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user