8266: fix flickering during file write (experimental)
8266 also has problems - file.close() will stall interrupts, so we need to wait a bit until leds were updated
This commit is contained in:
@@ -50,13 +50,21 @@ void closeFile() {
|
|||||||
if (!f) {doCloseFile = false; return;} // WLEDMM only do all this hick-hack when f is an open file
|
if (!f) {doCloseFile = false; return;} // WLEDMM only do all this hick-hack when f is an open file
|
||||||
|
|
||||||
bool oldLock = suspendStripService;
|
bool oldLock = suspendStripService;
|
||||||
#if defined(WLEDMM_FILEWAIT) // only wait if we don't have the flicker-free RMTHI driver
|
#if defined(WLEDMM_FILEWAIT) || !defined(ARDUINO_ARCH_ESP32) // only wait if we don't have the flicker-free RMTHI driver
|
||||||
unsigned long t_wait = millis();
|
unsigned long t_wait = millis();
|
||||||
if (strip.isUpdating()) suspendStripService = true; // WLEDMM schedule short pause to prevent LEDs glitching during flash write
|
if (strip.isUpdating()) suspendStripService = true; // WLEDMM schedule short pause to prevent LEDs glitching during flash write
|
||||||
while(strip.isUpdating() && (millis() - t_wait < 72)) delay(1); // WLEDMM try to catch a moment when strip is idle
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
while(strip.isUpdating() && (millis() - t_wait < 96)) delay(0); // try harder
|
while(strip.isUpdating() && (millis() - t_wait < 72)) delay(1); // WLEDMM try to catch a moment when strip is idle
|
||||||
//if (strip.isUpdating()) USER_PRINTLN("closeFile: strip still updating.");
|
while(strip.isUpdating() && (millis() - t_wait < 96)) delay(0); // try harder
|
||||||
delay(2); // might help
|
//if (strip.isUpdating()) USER_PRINTLN("closeFile: strip still updating.");
|
||||||
|
delay(2); // might help
|
||||||
|
#else // 8266: only wait in case that can_yield() tells us we can yield and delay
|
||||||
|
if (can_yield()) {
|
||||||
|
yield();
|
||||||
|
while(strip.isUpdating() && (millis() - t_wait < 96)) delay(1);
|
||||||
|
yield(); // might help
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
bool oldLock = suspendStripService; // fix build f***u* on 8266
|
bool oldLock = suspendStripService; // fix build f***u* on 8266
|
||||||
|
|||||||
Reference in New Issue
Block a user