Commit Graph

662 Commits

Author SHA1 Message Date
Frank
35c847404c Merge branch 'mdev' into pixelforge_backport 2025-12-29 19:47:51 +01:00
Frank
103e7db83f post merge fix, build 2512291 2025-12-29 14:45:11 +01:00
Will Tatam
45e8c63c2c Merge pull request #5031 from wled/add-check-diff
Add segment checkmarks to `differs()` check
2025-12-29 14:30:49 +01:00
Frank
4345b32f97 protect WS2812FX::resetSegments boundsOnly path
the "boundsOnly" case can lead to ldsrgb re-allocation - better to protect it with segmentMux, too
2025-12-22 18:33:46 +01:00
Frank
39344382c7 WS2812FX::service() cleanup
- _isServicing is not critical any more -> move back into bitfield
- remove experimental deactivated code from WS2812FX::service()
2025-12-22 18:10:51 +01:00
Frank
68a76ff442 minor refactoring of critical sections
- define dummy macros for 8266, to avoid #ifdef ESP32
- small hint for readers who were not able to play arcade games in the 1980's ;-)
2025-12-22 17:59:22 +01:00
Frank
cb94cfafae extra debug message when Segment::setUp cannot get the mutex 2025-12-22 00:59:57 +01:00
Frank
1038421544 atomic pointer swap in allocLeds() 2025-12-22 00:31:53 +01:00
Frank
50cc6f4c28 comment correction 2025-12-22 00:07:27 +01:00
Frank
73c54d7a57 replace potentially infinite wait with 2100ms max
better to end with an inconsistent state, than risk a lock-up until reset
2025-12-22 00:05:54 +01:00
Frank
30fcd6efad segment & bus.show mutex redesign
* 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
2025-12-21 23:56:09 +01:00
Frank
577d80d2ef segment drawing robustness improvements
* segment::fill() is also called outside the service loop - make sure that size is always calculated correctly
* leave _currentSeg in a meaningful state after strip.service()
2025-12-21 23:08:50 +01:00
Frank
7df63db744 and mutex for all
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
2025-12-20 17:13:52 +01:00
Frank
c25f082231 improve stability of DDP via tcp_task (websockets)
* protect pixel buffer changes with critical section
* protect segment list modification with critical section
* make _isServicing and _triggered atomic (move out of packed bitarray)
* allow custom timeout for waitUntilIdle - DDP needs a longer timeout
* protect strip.show() and effect drawing functions with mutex, to prevent crashes
2025-12-19 18:13:20 +01:00
Frank
5849e02e23 no effect data limits for PSRAM boards (upstream backport) 2025-12-17 01:19:24 +01:00
Frank
87fc226213 more segment data for PSRAM boards 2025-12-17 01:10:05 +01:00
Frank
02d23b3316 fixing some compiler warnings
signed vs. unsigned, deprecated functions, printf parameter size mismatch
2025-12-17 00:03:18 +01:00
Frank
1ba2749343 more renaming
to avoid name clashes with vLength()
2025-12-16 23:26:02 +01:00
Frank
15451c16f9 reduce debug noise on serial
downgraded a few USER_PRINT to DEBUG_PRINT
2025-11-30 01:22:34 +01:00
Frank
c36e493b47 Fix strlcpy destination size parameters 2025-11-21 00:16:25 +01:00
Frank
7ef94bc6c7 use strlcpy instead of strcpy 2025-11-21 00:08:15 +01:00
Frank
e63dc7e71e longer segment names
* 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
2025-11-20 23:49:26 +01:00
Frank
1583452c86 oops
fixes a mistake in previous commit
2025-11-18 23:19:25 +01:00
Frank
bc7a96d7d4 strip wait function: increase idle wait time to 120ms
Updated strip wait function to use longer idle wait time (similar to the timeout used by upstream WLED 0.16)
2025-11-18 23:13:47 +01:00
Damian Schneider
e5ab0b6077 Bugfix for gif player WRT inactive segment and bugfix in copy FX
- if a segment is destroyed or turned inactive, disable the gif player: only one gif player instance can run at a time, if a inactive or destroyed segment uses it, the effect is broken for other segments.

- copy FX ironically copied the source segment on each call, should use reference not a copy!
2025-11-16 20:48:27 +01:00
Frank
737b7cc471 bus robustness improvement
ABL and SerializeConfig explicitly check bus->isOK(), instead of relying on bus->getLength() == 0
2025-11-16 14:52:18 +01:00
Frank
9f31f2444f some precautions to prevent buffer out-of-bounds access and concurrency problems
* make sure that filenames can hold 32chars of segment.name
* fix logic error in Segment::drawCharacter
* protect free(Segment::_globalLeds) with a critical section
2025-11-14 22:43:44 +01:00
Frank
a833cb5706 JMap robustness and use-after-free fixes
* increased ArrayAndSize.size from 8bit to 16bit
* prevent out-of-bounds access in JMapC::getPixelColor
* do not delete[] SEGMENT.name from outside of segment class !!
2025-11-11 23:17:50 +01:00
Frank
1e14e4b4e5 fix minor bug (errorflag reset not working)
typo: == instead of =
2025-11-11 23:09:09 +01:00
Frank
e4c964ebaf deserializeMap robustness improvements
* make sure that fileName is big enough for segmentName".json"
* fix possible buffer overflow in f.readBytesUntil
* stop reading map{ } entries when customMappingSize is reached
* raise "low mem" error when malloc failed
2025-11-11 21:59:19 +01:00
Damian Schneider
71b7121ded bugfix: do not reset segments if unchanged #4969
lines were swapped, causing segment reset on every preset call.
2025-11-09 21:57:12 +01:00
Frank
d78ea5ae2e prevent bad filenames in "segment names as ledmap names"
Increase buffer size for fileName to accommodate long segment names (max 32 chars) without producing broken filenames.
2025-11-07 15:07:13 +01:00
Frank
5177ebd271 fix false warnings when temporarily exceeding MAX_SEGMENT_DATA
The segment copy constructors can temporarily exceed the budget of MAX_SEGMENT_DATA. The original segment will be de-allocated a few milliseconds later.
This change introduced an "overdraft" budget of 50% that can be used for temporary segment copies.
2025-11-06 22:09:11 +01:00
Frank
bb44dd8616 robustness improvements for image presets
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)
2025-11-04 20:28:26 +01:00
Frank
40064490ad strip level setPixelColor and getPixelColor optimization
* moved sPC and gPC functions out of their .cpp files into FX.h, so the compiler can optimize better.

depending of effect used, this gives a 2% up to 8% speedup.
2025-11-01 16:50:20 +01:00
Frank
3752409b46 no more ORANGE on effect memory failure
For maintainers of custom effects: replace "return mode_solid()" with "return mode_oops()"

Effect errors fall back to Akemi (2D) or Rainbow(1D) instead of SOLID ORANGE.
2025-10-27 11:24:12 +01:00
Frank
56380ce04c slightly faster to keep IRAM_ATTR for sPC and color_add 2025-10-26 01:41:30 +02:00
Frank
4713f26bb8 additional constants to improve upstream compatibility
* a few new error constants
*  WLED_O2_ATTR - ask the compiler for stronger optimization of a single function
*  WLED_O3_ATTR (WLEDMM) optimize even more
2025-10-25 23:43:44 +02:00
Will Tatam
c5a28c2977 only call endImagePlayback if reset true in resetIfRequired 2025-06-15 12:13:16 +01:00
Will Tatam
d9ab878503 Swap to WLED_ENABLE_GIF 2025-02-22 12:56:47 +00:00
Christian Schwinne
9caa7cb4e9 Fix missing GIF enable macros 2025-02-22 12:40:42 +00:00
Christian Schwinne
b8a29bcbf8 GIFs work again in principle 2025-02-22 12:37:13 +00:00
Frank
2c0063dc5b tiny optimization
* use bitmask operations in getBitFromArray, setBitInArray
* make currentBri "const"
2025-01-17 21:13:27 +01:00
Frank
8daf9d9ffb transition optimization (small speedup)
* move "progress()" into FX.h so the compiler can inline it
* removed redundant checks in  currentBri()
2025-01-16 18:26:10 +01:00
Frank
8317c891c1 better transitions overspeed bugfix
when the user wants less than 42 fps, respect this limit during transitions.
2025-01-10 13:50:25 +01:00
Frank
d9153854c4 bugfix: avoid effect speedups during transitions 2025-01-10 13:09:19 +01:00
Frank
f8a673ce81 code robustness improvements plus minor speedup
* 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
2025-01-07 15:58:38 +01:00
Frank
02f51d4582 realtime mode bugfixes
- busses: ignore not valid bus instances
- "use main segment only": prevent flickering du to intermitted strip.service().
2024-12-20 17:47:07 +01:00
Frank
40bfe619b9 bugfix: avoid double blanking segments
if both seg.reset and seg.needsBlank were set, this caused a second (unwanted) blanking in frame 1.
2024-12-11 18:52:02 +01:00
Frank
972257a7ee minor code cleanup
* removed dead code
* prevent promotion to double
* made constants constexpr
* made some methods const
* fixed a few typo's
2024-12-04 22:18:39 +01:00