another attempt to reduces flickering
* BusManager::show(): explicitly wait until the bus driver is idle (done by NPB show, too, but in a different way) * BusManager::removeAll(): use delay() instead of yield() - yield() does _not_ free the processor on esp32!
This commit is contained in:
@@ -1268,7 +1268,11 @@ int BusManager::add(BusConfig &bc) {
|
|||||||
void BusManager::removeAll() {
|
void BusManager::removeAll() {
|
||||||
DEBUG_PRINTLN(F("Removing all."));
|
DEBUG_PRINTLN(F("Removing all."));
|
||||||
//prevents crashes due to deleting busses while in use.
|
//prevents crashes due to deleting busses while in use.
|
||||||
|
#if !defined(ARDUINO_ARCH_ESP32)
|
||||||
while (!canAllShow()) yield();
|
while (!canAllShow()) yield();
|
||||||
|
#else
|
||||||
|
while (!canAllShow()) delay(2); // WLEDMM on esp32, yield() doesn't work as you think it would
|
||||||
|
#endif
|
||||||
for (uint8_t i = 0; i < numBusses; i++) delete busses[i];
|
for (uint8_t i = 0; i < numBusses; i++) delete busses[i];
|
||||||
numBusses = 0;
|
numBusses = 0;
|
||||||
// WLEDMM clear cached Bus info
|
// WLEDMM clear cached Bus info
|
||||||
@@ -1279,6 +1283,10 @@ void BusManager::removeAll() {
|
|||||||
|
|
||||||
void __attribute__((hot)) BusManager::show() {
|
void __attribute__((hot)) BusManager::show() {
|
||||||
for (unsigned i = 0; i < numBusses; i++) {
|
for (unsigned i = 0; i < numBusses; i++) {
|
||||||
|
#if 1 && defined(ARDUINO_ARCH_ESP32)
|
||||||
|
unsigned long t0 = millis();
|
||||||
|
while ((busses[i]->canShow() == false) && (millis() - t0 < 80)) delay(1); // WLEDMM experimental: wait until bus driver is ready (max 80ms) - costs us 1-2 fps but reduces flickering
|
||||||
|
#endif
|
||||||
busses[i]->show();
|
busses[i]->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user