Skip to content

Commit fafcbf9

Browse files
committed
no file access waiting if we have the flicker-free LEDs driver
1 parent d70a3a8 commit fafcbf9

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

wled00/file.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,15 @@ void closeFile() {
4949

5050
if (!f) {doCloseFile = false; return;} // WLEDMM only do all this hick-hack when f is an open file
5151

52-
unsigned long t_wait = millis();
5352
bool oldLock = suspendStripService;
53+
#if !defined(WLEDMM_NO_FILEWAIT) // not necessary if we have the flicker-free RMTHI driver
54+
unsigned long t_wait = millis();
5455
if (strip.isUpdating()) suspendStripService = true; // WLEDMM schedule short pause to prevent LEDs glitching during flash write
5556
while(strip.isUpdating() && (millis() - t_wait < 72)) delay(1); // WLEDMM try to catch a moment when strip is idle
5657
while(strip.isUpdating() && (millis() - t_wait < 96)) delay(0); // try harder
5758
//if (strip.isUpdating()) USER_PRINTLN("closeFile: strip still updating.");
5859
delay(2); // might help
60+
#endif
5961
#else
6062
bool oldLock = suspendStripService; // fix build f***u* on 8266
6163
#endif
@@ -548,7 +550,7 @@ bool handleFileRead(AsyncWebServerRequest* request, String path){
548550
#endif
549551

550552
// wait for strip to finish updating, accessing FS during sendout causes glitches
551-
#ifdef ARDUINO_ARCH_ESP32
553+
#if defined(ARDUINO_ARCH_ESP32) && !defined(WLEDMM_NO_FILEWAIT) // not necessary if we have the flicker-free RMTHI driver
552554
unsigned wait_start = millis();
553555
while (strip.isUpdating() && (millis() - wait_start < 40)) delay(1); // wait max 40ms
554556
#endif

wled00/wled.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
// version code in format yymmddb (b = daily build)
10-
#define VERSION 2601051
10+
#define VERSION 2601061
1111

1212
// 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.
1313
#define _MoonModules_WLED_
@@ -180,6 +180,14 @@
180180
#include "src/dependencies/json/AsyncJson-v6.h"
181181
#include "src/dependencies/json/ArduinoJson-v6.h"
182182

183+
184+
// WLEDMM: Do we have the flicker-free RMTHI driver?
185+
#if defined(ARDUINO_ARCH_ESP32)
186+
#if !defined(WLED_USE_SHARED_RMT) && !defined(__riscv) && (ESP_IDF_VERSION_MAJOR >= 4)
187+
#define WLEDMM_NO_FILEWAIT 1
188+
#endif
189+
#endif
190+
183191
// ESP32-WROVER features SPI RAM (aka PSRAM) which can be allocated using ps_malloc()
184192
// we can create custom PSRAMDynamicJsonDocument to use such feature (replacing DynamicJsonDocument)
185193
// The following is a construct to enable code to compile without it.

0 commit comments

Comments
 (0)