no file access waiting if we have the flicker-free LEDs driver

This commit is contained in:
Frank
2026-01-06 12:30:27 +01:00
parent d70a3a84e8
commit fafcbf9cf4
2 changed files with 13 additions and 3 deletions

View File

@@ -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

View File

@@ -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.