6580 Commits

Author SHA1 Message Date
Frank
deaee37559 (experimental) 2D drawPixel optimizations
* add a dedicated callback for 2D downscaling only (no nested for loop)
   -> up to 10% faster
* minor optimizations for 2D up/downscale drawpixel - move repeated calculations out of the inner loop
  -> small speedup
2025-11-17 14:30:29 +01:00
Frank
d6ee51841b image loader: avoid message flood on error
in case that several "bad" image effect segments competing to use the GIF decoder, we had a flood of repeating user_print messages
2025-11-17 14:27:08 +01:00
Frank
eab946ea87 image loader: allow graceful takeover after error
Allow decoder "takeover" by another segment
a) when last segment has decoding error (unsupported file, etc.)
b) when last segment became inactive
2025-11-17 12:29: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
47153baa0c brackets (typo)
does the same thing as before, but looks clearer.
2025-11-16 19:30:34 +01:00
Frank
16540f58b3 (experimental) adjust image scaling when segment options change during playback
* move scaling calculation and decoder.setDrawPixelCallback() into a separate function
*re-calculate scaling before decoding a new frame
* reset gifWidth and gifHeight to zero in endplayback
2025-11-16 19:18:21 +01:00
Frank
2a120e81f8 image effect: flicker fixer for WS2812b leds driven by RMT
Large file read operations can cause RMT stall leading to flicker.
* wait for RMT driver when lading a new gif, and when decoding a new frame.
2025-11-16 16:08:16 +01:00
Frank
b443c13ad8 revert safety check in cfg.cpp
this leads to UI problems in the LEDs setting page.
2025-11-16 15:28:57 +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
5b52ee612f clean up handling of USB-CDC Serial
when ARDUINO_USB_CDC_ON_BOOT is set, USB-CDC pins are always assigned to 'Serial'.
2025-11-16 14:05:30 +01:00
Frank
53130f7216 conditional USB mode: first check build_unflags
* build_unflags have priority over build_flags, so we first check if the flag is already "unflaged"
This finally seems to catch all cases properly :)
2025-11-16 13:28:28 +01:00
Frank
14f0d0a03c re-enable raw build flags checks for USB mode
only checking CPPDEFINES sometimes misses the flag
2025-11-16 03:02:12 +01:00
Frank
870dc728f1 Disable raw build flags checks for USB mode
Commented out raw build flags checks for USB mode. The results would be wrong, because raw build_flags ignore build_unflags.
2025-11-16 02:13:29 +01:00
Frank
2b0179850c Merge pull request #263 from MoonModules/copilot/fix-255 (fixes #255)
Implement conditional ARDUINO_USB_MODE: dev=1, release=removed for USB-OTG boards with production warnings
2025-11-16 01:25:59 +01:00
Frank
9860dc5ca0 Disable CDC USB on boot for older framework compatibility
Changed ARDUINO_USB_CDC_ON_BOOT flag to disable CDC USB due to issues with the older framework.
2025-11-16 01:19:08 +01:00
Frank
6ccbfe61ab additional debug help 2025-11-16 01:08:27 +01:00
copilot-swe-agent[bot]
c785cb5f6c Fix Serial breakage: remove ARDUINO_USB_MODE instead of setting to 0
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
2025-11-15 23:51:04 +00:00
Frank
2869de215c USB mode script: updated print statements for clarity 2025-11-16 00:35:23 +01:00
copilot-swe-agent[bot]
3bc68c574e Fix conflicting ARDUINO_USB_MODE definitions using BUILD_UNFLAGS
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
2025-11-15 23:24:01 +00:00
Frank
43b0da03aa Update debug messages for USB mode detection 2025-11-15 23:15:44 +01:00
copilot-swe-agent[bot]
0c92e573e1 Improve messaging: conditional warnings and production alerts
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
2025-11-15 21:48:43 +00:00
copilot-swe-agent[bot]
2932644381 Add CDC_ON_BOOT=1 check: only modify USB_MODE for USB-OTG boards
Co-authored-by: softhack007 <91616163+softhack007@users.noreply.github.com>
2025-11-15 21:25:33 +00:00
Frank
8342679d4a Merge pull request #264 from MoonModules/copilot/fix-256 (fixes #256)
Fix AutoPlaylist race condition with AutoChange preset applications - avoid self-deactivation problem
2025-11-15 17:13:14 +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
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
47f96fdd4a post-merge adjustments 2025-11-14 19:51:17 +01:00
Damian Schneider
9b6ce948f2 Adding DDP over WS, moving duplicate WS-connection to common.js (#4997)
- Enabling DDP over WebSocket: this allows for UI or html tools to stream data to the LEDs much faster than through the JSON API.
- first byte of data array is used to determine protocol for future use
- Moved the duplicate function to establish a WS connection from the live-view htm files to common.js
- add better safety check for DDP: prevent OOB reads of buffer
2025-11-14 19:42:50 +01:00
Damian Schneider
ca35e9914a Improved 1D support for GIF images, bugfixes, blur option by @DedeHai & @softhack007
- add better support for 1D gifs: use the full gif, row by row, scale if needed
- add blur slider to image FX
- improved safety checks to avoid crashes
- add "fast path" if image size matches virtual segment size
2025-11-14 19:30:26 +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
Frank
36648d1936 hot path optimization: make gamma correction inline
* make sure that gamma LUT is always initialized
* remove some unnecessary safety checks
* make gamma8() inline, for more speed
* use fast unGamma8 for preview
* add super-fast unGamma8 for HUB75 - old function lost 3-10 fps, this version does not reduce fps at all *grins*
2025-11-10 23:17:16 +01:00
Frank
4a323ba057 align Release Strings with upstream
"server message" on OTA update page follows the new format used by upstream WLED.
2025-11-09 23:19:43 +01:00
netmindz
b94fc7c3f0 Merge pull request #4849 from Arcitec/0_15_x-improve-version-info
(0.15.2 backport): Make version information consistent across update interfaces
2025-11-09 22:05:41 +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
f9a2099240 always use same GifDecoder initialization
Removed conditional compilation for GifDecoder based on PSRAM availability.
After inspecting the library code, it became clear that any parameter changes for GifDecoder will not impact memory needs - decoder.alloc() always requires 24KB.
2025-11-09 20:30:43 +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
01d7f17730 Merge pull request #279 from MoonModules/Gif_MM_plus
gifdecoder bugfixes, up to 30% speedup, and minor improvements
- several optimizations for the drawing a single pixel (hot path)
- Image mode now runs correctly on 2D/matrix layouts with mirroring.
- added an extra slider for Blur intensity; 
- improved per-segment scaling/upscaling and memory-aware decoder behavior on low-RAM devices.
- Robust filename validation, graceful failures for missing/unsupported files or low-memory, better decoding error handling and playback cleanup.
- Better user messages

open ends (will not fix in this PR):
* ".gif" filename compare should be case-insensitive - ".GIF", ".Gif", ".gIf" should be accepted.
   esp32 does not have "stricmp", so we might need a custom solution, maybe with a utility function that internally uses tolower(c) before comparing. Also strip leading / trailing blanks from the filename.
2025-11-07 12:48:23 +01:00
Frank
c1979f8bc7 no fun in Germany ;-)
no fun, just rabbits. Lets stay professional.
2025-11-07 12:08:31 +01:00
Frank
c58c6ef268 minor robustness improvement
If seg.name is at least 32 characters long, strncpy will fill the 32-byte window without appending '\0'. This could lead to sporadic errors.
2025-11-07 11:58:55 +01:00
Frank
9115cd17af tiny cleanup, ready to merge 2025-11-07 11:45:46 +01:00
Frank
f955df0488 camelCase, future support, minor cleanup
* use camelCase for local variables
* furure support: rename drawPixelCallback to draw2DPixelCallback
2025-11-07 11:05:44 +01:00
Frank
9564791640 prevent string underflow
if seg.name is empty or shorter than four characters, ``strlen(lastFilename) - 4``  underflows (size_t), so the pointer passed to strcmp lands far before the buffer and triggers undefined behavior.
This patch catches too-short segment names and aborts decoding.
2025-11-07 00:28:40 +01:00
Frank
25391fe765 try to catch / handle Gif decoder OOM gracefully
... by adding an exception handler that will catch OOM inside decoder.alloc().
not tested yet.
2025-11-07 00:11:14 +01:00
Frank
698da84b4a prevent division by zero when image width or height is 0
catch error early before starting the decode/paint loop
2025-11-06 23:09:09 +01:00
Frank
10b3ac0eb1 gifdecoder speedup and bugfixes
* fixed a bug that caused wrong behavior with segment mirroring
    (effects must use virtualHeight() /  virtualWidth() instead of height() / width())
* added image blur as an option (second slider)
* added very basic error reporting for users
*  up to 25% faster, especially with big animated gifs

* made all local variables "static" (don't pollute global namespace)
* drawPixelCallback: cache calculation that do not depend on x/y position
* reduced memory allocations on boards without PSRAM, to avoid crashes
2025-11-06 22:50:59 +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
a956b22a16 unGamma8() accuracy improvement
based on upstream changes by @DedeHai
2025-11-05 22:01:07 +01:00
MoonModules
5122a80f50 Fix typo in disclaimer about liability 2025-11-05 09:55:50 +01:00