Commit Graph

61 Commits

Author SHA1 Message Date
Frank
11b9b6529c 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
2026-03-21 20:37:53 +01:00
Frank Möhle
cce3c0b5d3 psram-aware malloc functions (backport of upstream #4895) (#342)
Introduces new memory allocation functions, based on wled#4895 by @DedeHai

* keep a minimum of 15KB RAM available to UI - improves stability
* S3/S2/C3 automatically use "fast RTC Ram" for small data (reduces fragmentation)
* auto-detects PSRAM (or no PSRAM) when firmware was built with -D BOARD_HAS_PSRAM
* d_malloc() and d_calloc() prefer DRAM if possible (faster), but fall back to PSRAM when free RAM gets low.
2026-02-18 17:57:47 +01:00
Frank
ad0409789e WLEDMM_NO_FILEWAIT => WLEDMM_FILEWAIT
reversed the logic, to make it more straight forward.
2026-01-06 19:02:45 +01:00
Frank
fafcbf9cf4 no file access waiting if we have the flicker-free LEDs driver 2026-01-06 12:30:27 +01:00
Frank
586d3c2732 another attempt to prevent glitches caused by file access
wait for LEDs send out to finish, then access presets.json
2026-01-05 11:22:53 +01:00
Frank
6247ee066d fix presets.json corruption, part 1: avoid re-assigning open file pointer
* this prevents "open after open", that could lead to file corruption when "f" was still holding some changes in its buffer (written out with f.close())
2025-12-29 20:08:34 +01:00
Frank
dcdc05b592 unicode-related robustness improvements
* enable ARDUINOJSON_DECODE_UNICODE (otherwise unicode needs 6(!) bytes for encoding)
* robustness: increase a few tiny string buffers for some extra margin
* Web UI: allow entering up to 64 chars as segment name
2025-11-20 22:36:46 +01:00
Frank
4e2605b2a6 fix for 8266 build error 2025-11-15 00:17:16 +01:00
Frank
dc04ccbde7 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.
2025-11-15 00:11:35 +01:00
Frank
80a6866f16 small bugfix for previous commit (PSRAM caching) 2025-10-24 16:35:11 +02:00
Frank
6ce663784d bugfix to prevent random corruption of presets.json
accroding to the docs of setBufferSize() and svbuf():
> setBufferSize() has to be called right after opening file before any other operation!

so changing buffer sizes on an already opened and partially read file can cause file corruption as the internal buffer is exchanged "mid-flight".

Fix: move all f.setBufferSize() so they appear directly after f.open().
2025-10-24 16:24:33 +02:00
Troy
a24491003c IDFv4 logic for f.setBufferSize() 2025-01-23 14:15:53 -05:00
Troy
46a2bed5b1 f.setBufferSize(FS_BUFSIZE); for buffered file functions 2025-01-23 14:04:11 -05:00
Frank
b2646a8489 Update file.cpp
small optimization, based on upstream 0593a078c6  by willmmiles
2024-04-29 16:11:12 +02:00
Frank
f7504dcc36 presets.json PSRAM caching: consider cacheInvalidate
* trying to make the caching mechanism bulletproof.
`cacheInvalidate` is changed when
- autosave usermod updates presets
- a file was upload
* (coding style) fixed some unitialized variables
2024-04-29 16:05:12 +02:00
Frank
b584962334 clear presets.json cache on upload
needed to avoid inconsistent/corrupted presets after upload or restore.
2024-04-29 13:06:18 +02:00
Frank
55552c3e07 Update file.cpp 2024-04-29 00:23:13 +02:00
Frank
de66ec45b7 make ALL_JSON_TO_PSRAM the default
PSRAM optimizations: always enable ALL_JSON_TO_PSRAM and WLED_USE_PSRAM_JSON
2024-04-28 22:56:06 +02:00
Blaz Kristan
56c76458fd Preset caching on chips with PSRAM
- credit @akaricchi
2024-04-28 22:00:20 +02:00
Frank
d058e33df3 slightly reduce flickering during file access
it seems that reading/writing "larger" files from LittleFS causes LED flickering.

This change adds a simple cache for "file not found" results, so that repeated file.exists() calls are avoided.
2024-04-28 18:57:05 +02:00
Frank
858610e39b trying to reduce flickering
The NeoPixelBus RMT driver seems to get stalled when ESP.get.... functions are called (big kernel lock?). Also its glitching during flash file access.

This change tries to avoid some conflicts by first checking that the driver is not sending.
2024-04-26 21:21:32 +02:00
Ewoud
175375e30d Merge branch 'mdev' into audio_fastpath 2023-05-16 16:02:47 +02:00
Ewoud
d6bc9967d0 Support for large ledmaps
optimize jMapC, enumerateLedmaps and deserializeMap
2023-05-16 13:12:30 +02:00
Frank
d5c33df64f file buffer size: back to default
After some experiments, it seems that 256 is indeed the optimal buffer length.
2023-05-12 17:26:36 +02:00
Ewoud
fede3dd54c Merge remote-tracking branch 'upstream/main' into mdev 2023-05-11 17:39:12 +02:00
Frank
b0118d2d57 use size_t as file index type (might prevent corruption)
* use size_t instead of uint16_t -> prevents random behaviour (corruption) in case that JSON files get larger than 64Kbytes.
* use a constant for max large file space (was UINT16_MAX)
* reduced the scope of some functions and variables to "static" - avoids name clashes and may support better optimization by the compiler
2023-05-09 17:44:26 +02:00
Frank
9a4c020630 reduce file search buffer, to reduce file access delays 2023-05-06 16:05:30 +02:00
Frank
61bbea0e5e bugfix for large JSON files (>64Kb)
WLED was using uint16_t internally to index files, which leads to random behaviour when the real filesize is above 64Kb.

Better to use size_t which is the "right" type that can hold the largest possible size.
2023-05-05 18:07:00 +02:00
Blaž Kristan
506b6b51ce whitespace cleanup 2023-01-06 09:24:29 +01:00
Blaz Kristan
86092541ed Merge branch 'master' into dev 2022-01-25 17:53:22 +01:00
André Klitzing
f8c80283e4 Use arduino-esp32 2.0.2 for ESP32-S2 (#2452)
* Use arduino-esp32 2.0.2 for ESP32-S2

LittleFS is merged into it.

* Fix filesystem error for ESP32-S2

Use platform of tasmota until upstream released it and
use board_build.flash_mode = qio

* Fix empty disk usage

* Add esp32s2_saola to default_envs

* Remove lorol LITTLEFS for esp32dev, too

* Revert "Remove lorol LITTLEFS for esp32dev, too"

This reverts commit 3586d5eef7affa3390bd057232600f6189145706.
2022-01-14 17:19:33 +01:00
Blaz Kristan
dcfbf2b154 Simplified UI and general UI polishing (CSS, HTML & JS).
Boot transition fix.
Local storage invalidation when uploading presets.json.
2021-08-10 17:11:17 +02:00
Blaž Kristan
2e9bd477d9 Upload files & skinning (#2084)
* Skinning WLED & uploading files.
Backup & restore configuration & presets.
External holidays.json

* Option for segment count instead of stop.

* Small fixes and improvements

* Further improvements

* Enable custom CSS by default

Co-authored-by: Christian Schwinne <dev.aircoookie@gmail.com>
2021-07-26 00:10:36 +02:00
Blaz Kristan
bf94febb11 Added configuration backup/restore.
Fixed save dialog compile error.
2021-07-15 18:38:42 +02:00
Blaž Kristan
dbd3bd50df Attempt at forcing Save dialog on preset backup.
Random BG image replaced by holiday BG.
2021-07-15 09:24:10 +02:00
Blaz Kristan
bfd7be543a Merge branch 'master' of https://github.com/aircoookie/WLED into dev
Conflicts:
	tools/cdata.js
	usermods/PIR_sensor_switch/readme.md
	usermods/Temperature/readme.md
	wled00/FX.h
	wled00/FX_fcn.cpp
	wled00/bus_manager.h
	wled00/bus_wrapper.h
	wled00/cfg.cpp
	wled00/const.h
	wled00/data/settings.htm
	wled00/data/settings_leds.htm
	wled00/data/settings_um.htm
	wled00/html_settings.h
	wled00/json.cpp
	wled00/mqtt.cpp
	wled00/set.cpp
	wled00/wled.cpp
	wled00/wled.h
	wled00/wled_eeprom.cpp
	wled00/wled_server.cpp
	wled00/xml.cpp
2021-05-18 15:45:34 +02:00
cschwinne
cb7b7f1dca Add notice if no usermod installed 2021-05-11 23:21:57 +02:00
cschwinne
5ca8bc3f2a Fixed various Codacy code style and logic issues 2021-05-11 14:54:03 +02:00
Blaz Kristan
2e8d5311a5 New font. UI fixes.
Skinning with CSS.
2021-03-28 17:15:26 +02:00
cschwinne
cfc346abad Fix warnings misc fixes 2021-02-27 01:16:06 +01:00
Louis Beaudoin
b460d0f533 Fix Warnings (#1744)
* Remove -w (Suppress all warnings, including those which GNU CPP issues by default.) and add back in -Wall (Turn on all optional warnings which are desirable for normal code.) from build_flags

* Fixes warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]

* Fixes warning: "CONFIG_LITTLEFS_FOR_IDF_3_2" redefined

* Fixes warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]

* Fixes warning: enumeration value 'onoff' not handled in switch [-Wswitch]

* Fixes warning: "ntohl" redefined, warning: "ntohs" redefined, warning: "htonl" redefined, warning: "htons" redefined
- Original fix: 858f8f4ee9

* Fixes warning: unused variable 'mainSeg' [-Wunused-variable]

* Fixes warning: unused variable 'start' [-Wunused-variable]

* (untested!) Fixes warning: operation on '...' may be undefined [-Wsequence-point]

* Fixes warning: unused variable

* Fixes warning: unused variable and warning: narrowing conversion

* Fixes warning: unused variable

* Fixes warning: unused variable

* (untested!) Fixes warning: statement has no effect [-Wunused-value]

* Fixes warning: control reaches end of non-void function

* Fixes warning: unused variable

* Fixes warning: left operand of comma operator has no effect

* Fixes warning: no return statement in function returning non-void

* (untested!) Fixes warning: ISO C++ forbids converting a string constant to 'char*' and fixes warning: unused variable 'nPins'

* Fixes warning: deleting array 'dmxData'

* Fixes warning: unused variable

* Remove all warning suppression buildflags

Co-authored-by: Louis Beaudoin <louis@embedded-creations.com>
Co-authored-by: Aircoookie <dev.aircoookie@gmail.com>
2021-02-27 00:20:31 +01:00
cschwinne
5236625485 A few small fixes 2020-11-15 20:58:04 +01:00
cschwinne
595fd9377c Remove FS defines
Increase boot preset max. to 250
Update changelog
Update readme
2020-11-15 15:45:51 +01:00
cschwinne
7f973ad131 Unaccessible wsec.json and preset loading fix 2020-11-09 11:09:47 +01:00
cschwinne
1f42070104 A few fixes 2020-11-09 00:50:13 +01:00
cschwinne
98e4ac6b27 FS working for ESP8266 2020-11-08 23:44:10 +01:00
cschwinne
8ddae6bba0 wsec start 2020-11-04 17:17:54 +01:00
cschwinne
d583adb958 New quota calculation 2020-10-16 23:59:34 +02:00
cschwinne
eb65eafbe0 Working API commands 2020-10-13 01:39:34 +02:00
cschwinne
b0828a6280 Bigger buffer testing 2020-10-08 00:52:15 +02:00