another attempt to avoid LED glitches during file writing

* mark synchronization variables volatile (thread-safe)
* additional logic in closeFile() to avoid file write while leds are pushed out by NPB driver
* some comments and analysis
* replace "yield()" after file ops with "delay(0)" before operations.
This commit is contained in:
Frank
2025-11-15 00:11:35 +01:00
parent 9f31f2444f
commit dc04ccbde7
3 changed files with 42 additions and 8 deletions

View File

@@ -714,9 +714,9 @@ WLED_GLOBAL uint16_t olen _INIT(0);
// General filesystem
WLED_GLOBAL size_t fsBytesUsed _INIT(0);
WLED_GLOBAL size_t fsBytesTotal _INIT(0);
WLED_GLOBAL unsigned long presetsModifiedTime _INIT(0L);
WLED_GLOBAL volatile unsigned long presetsModifiedTime _INIT(0L);
WLED_GLOBAL JsonDocument* fileDoc;
WLED_GLOBAL bool doCloseFile _INIT(false);
WLED_GLOBAL volatile bool doCloseFile _INIT(false);
// presets
WLED_GLOBAL byte currentPreset _INIT(0);