* 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.
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.
Release the json buffer lock as soon as we've finished serializing.
This should slightly reduce the number of lock collisions as the
response class isn't destructed until after the last packet is ack'd.
fix for #90
In principle its dangerous to write pixels from the webserver callback, but in this case we should be save - `suspendStripService=true` ensures that strip.service() is not active in the main loopTask.
I've found a code spellchecker, so this is what can be corrected easily. Changes are only affecting comments, readme and a few user-visible strings. So no functional impact expected.