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.
* separate mutexes for improved performance:
- busses.show and effect drawing
- critical changes to segment vector
- block out critical segment changes while strip.service() loops over segments
* UDP realtime acquires mutex before drawing
- prevents corrupted outputs, caused by parallel tasks updating pixels while busses.show() runs
revised mutex and critical section handling for segment drawing
- simplified code with macros (no more #if ESP32 ... #endif)
- remove some critical sections (prevents interrupt stalling)
- added mutex to functions that change the list of segments
- added mutexes to all (potential) background drawing code
- use recursive mutexes to prevent accidental self-locking of tasks
Temporarily disable deviceID retrieval to prevent crashes on some ESP32 boards. This prevents the DeviceID from being added to /json/info, until we find a solution that does not crash my esp32.
* introducing WLED_MAX_SEGNAME_LEN from upstream
* default: max name length = 48
* hopefully found all places where the segment name length was hardcoded (32, 33, 34)
* some comments still refer to "32" but wtf
prevent errors / crashes when drawing "i" images from a preset.
- prevent out-of-bounds writing (segment smaller than image)
- make sure that segment properties are cached correctly
- always do "show" when strip was triggered (avoids lost frames)
* make XY() and _setPixelColorXY_raw() const (minor speedup)
* segment is a struct not a class: friend class Segment --> friend struct Segment
* fix missing braces around two macros
* use non-throwing "new" where possible
* improve robustness of transition code
... transpose, mirror, reverse, grouping, spacing, size
* unlike AC WLED, when calling seg.fill(BLACK) from webserver context this usually has no effect --> added markForBlank() that shedules segment blanking at the next drawing cycle
* fill previous segment with black when size, grouping or spacing changes
* new setting in UI page: "Don't use effect palette and segment parameters" - only meaningful when "Use effect default parameters" is enabled, too.
--> effect slider defaults will still be applied, however palette, 1D2D mapping mode and other segment settings will not change.
There were three problems here:
- AsyncWebServer is going to copy to a heap buffer anyways, so we might
as well just pass it one it can use
- The buffer size estimate was wrong -- we need 9 bytes per pixel
("RRGGBB",), so the buffer could overflow, and it was not
considering the extra 2D requirements
- On ESP8266, the stack allocation was overflowing the stack, causing
corruption and crashes.