diff --git a/wled00/file.cpp b/wled00/file.cpp index 6ac56161..6aa82fab 100644 --- a/wled00/file.cpp +++ b/wled00/file.cpp @@ -49,13 +49,15 @@ void closeFile() { if (!f) {doCloseFile = false; return;} // WLEDMM only do all this hick-hack when f is an open file - unsigned long t_wait = millis(); bool oldLock = suspendStripService; + #if !defined(WLEDMM_NO_FILEWAIT) // not necessary if we have the flicker-free RMTHI driver + unsigned long t_wait = millis(); 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 while(strip.isUpdating() && (millis() - t_wait < 96)) delay(0); // try harder //if (strip.isUpdating()) USER_PRINTLN("closeFile: strip still updating."); delay(2); // might help + #endif #else bool oldLock = suspendStripService; // fix build f***u* on 8266 #endif @@ -548,7 +550,7 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){ #endif // wait for strip to finish updating, accessing FS during sendout causes glitches - #ifdef ARDUINO_ARCH_ESP32 + #if defined(ARDUINO_ARCH_ESP32) && !defined(WLEDMM_NO_FILEWAIT) // not necessary if we have the flicker-free RMTHI driver unsigned wait_start = millis(); while (strip.isUpdating() && (millis() - wait_start < 40)) delay(1); // wait max 40ms #endif diff --git a/wled00/wled.h b/wled00/wled.h index 00218b8c..7e93713b 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -7,7 +7,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2601051 +#define VERSION 2601061 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ @@ -180,6 +180,14 @@ #include "src/dependencies/json/AsyncJson-v6.h" #include "src/dependencies/json/ArduinoJson-v6.h" + +// WLEDMM: Do we have the flicker-free RMTHI driver? +#if defined(ARDUINO_ARCH_ESP32) +#if !defined(WLED_USE_SHARED_RMT) && !defined(__riscv) && (ESP_IDF_VERSION_MAJOR >= 4) +#define WLEDMM_NO_FILEWAIT 1 +#endif +#endif + // ESP32-WROVER features SPI RAM (aka PSRAM) which can be allocated using ps_malloc() // we can create custom PSRAMDynamicJsonDocument to use such feature (replacing DynamicJsonDocument) // The following is a construct to enable code to compile without it.