Commit Graph

155 Commits

Author SHA1 Message Date
Copilot
d9e8203276 DDP input: reject packets with unsupported data type or non-display destination (#5390)
* Fix: reject invalid DDP packets with wrong destination or unsupported data type

Co-authored-by: DedeHai <6280424+DedeHai@users.noreply.github.com>
2026-03-29 19:04:32 +02:00
Frank
1210881bd8 reduce risk of crashes (stack smashing) due calls to notify()
The function uses a UDP buffer of ~1200 bytes on stack, which is only needed when actually sending out notifications.
-> separate activation checks and actual sending into two functions, to reduce stack pressure.
2026-01-29 13:00:53 +01:00
Frank
35c847404c Merge branch 'mdev' into pixelforge_backport 2025-12-29 19:47:51 +01:00
Damian Schneider
3785ae9a20 fix FX checkmark sync 2025-12-29 14:37:36 +01:00
Frank
7459cbd2e2 setRealtimePixel robustness improvement
avoid drawing negative pixel addresses (could happen when  arlsOffset is < 0)
2025-12-22 01:38:49 +01:00
Frank
d3291cc5e5 fix off-by-one in dnrgbw handler 2025-12-22 01:32:47 +01:00
Frank
6993de1c8a debug message when realtimeLock fails, and fixing a few typos 2025-12-22 01:21:33 +01:00
Frank
f510bb075c bugfix: allow udp realtime mode 5 (dnrgbw)
previous condition would prevent the existing handler from actually executing
2025-12-22 01:07:42 +01:00
Frank
bf6dbf0da4 fix realtimeOverride behaviour
the previous condition was not aligned with the override condition used in other places
2025-12-22 00:52:24 +01:00
Frank
af8eba6dfa use critical section in exitRealtime
the critical section ensures that cache clearing is performed as an atomic operation without task switch
2025-12-22 00:20:34 +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
c520d75729 prevent race conditions in realtimeLock / exitRealtime 2025-12-21 23:48:19 +01:00
Frank
21a452333e setRealtimePixel speedup
cache strip.getMainSegment(),  strip.getLengthTotal()), seg.length() instead of re-calculating them for each pixel
2025-12-21 23:11:15 +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
Troy
18b33df5a4 Use "start universe" from Sync Setup for Art-Net output start universe. 2025-04-16 14:34:57 -04:00
Troy
db2d50e6cd Change to 100 microsecond delay for Art-Net
Seems like a 10 microsecond delay on boards like the ESP32-P4 may not be enough, causing some issues with UDP audio sync being delayed or appearing "buffered".  Oddly 10 microseconds was fine with the ESP32 and ESP32-S3, so it may also be an underlying IDF v5.3 change. 

Practically, 10 microseconds or 100 microseconds isn't a real difference when we're dealing in frames per second.
2025-01-16 13:15:10 -05:00
Frank
d58cb495e4 fix for realtime mode with "use main segment only" 2024-12-30 23:31:13 +01:00
Frank
2cff35e26b stupid bug fix. 2024-12-20 17:50:39 +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
fd2bce521b fix for outputs not working any more when receiving DDP or art-net pixels
This disables bus caching (and related speedups) while receiving realtime UDP pixels.

Its still totally unclear to me what happens, and why disabling the cache solves problems.
2024-12-20 01:57:02 +01:00
Troy
b62a22e4e6 Remove unused variable 2024-11-17 18:26:04 -05:00
Troy
6b2c4aec2f Code Review Fixes 2024-11-10 08:58:01 -05:00
Troy
e7fb8f5748 IRAM_ATTR_YN for ES8266 2024-11-07 17:03:24 -05:00
Troy
7bf3f4aee0 Fixes for ESP8266 2024-11-07 13:48:17 -05:00
Troy
3f02ba73df Art-Net Color Order Maps, RGBW 2024-11-07 13:26:14 -05:00
Troy
732ae38005 Art-Net P4 Tidy 2024-11-07 13:13:51 -05:00
Troy
44c6a0d73b Proper Art-Net Settings 2024-11-07 13:12:15 -05:00
Frank
bc249379f0 minor improvements from upstream
* add checkSettingsPIN() and get_random_wheel_index() functions
* add on/off state to UDP data
* small robustness improvements
2024-04-09 15:43:46 +02:00
Blaz Kristan
e7285c7a03 Possible fix for #3589 & partial fix for #3605 2024-02-12 22:13:17 +01:00
Blaz Kristan
854425eb9c Fix for #3672 2024-01-15 15:37:21 +01:00
Frank
ced03f1f08 code spell checking - part1 (core)
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.
2023-12-14 22:05:55 +01:00
Blaz Kristan
b14f7f74ce Fix for udp sync (#3487) 2023-11-11 23:11:45 +01:00
Frank
92e64b797a 8266 hotfix: solving connectivity problems
* it seems that `WiFiUDP.flsuh()` does something completely different from 8266, and  its actually causing WLED to stall on UI calls. So not usable on 8266.
* fixing a few compiler warnings about "comparing signed and unsigned"

NB: its a hotfix, we have to check if there are other problems on 8266. Also its definitely ugly, but it helps as a band aid.
2023-08-22 22:55:05 +02:00
Frank
708cd8e73d free udp receive buffers before parsePacket
robustness improvement - parsepacket() will fail if the udp handler still has an active receive buffer.
2023-06-21 00:29:16 +02:00
Frank
3127c60b41 Merge branch 'mdev' into audio_fastpath 2023-06-15 20:54:57 +02:00
Ewoud
b95ff2d74f Merge remote-tracking branch 'upstream/main' into mdev 2023-06-07 20:54:04 +02:00
Frank
7465be7d42 heap mud scrum
Avoid heap fragmentation.
Use static UDP buffers on ESP32, instead of allocating them from the heap repeatedly.
2023-06-07 18:21:16 +02:00
Frank
d8a68890d4 build fix
removing some bonus colons.
2023-06-07 17:16:49 +02:00
Frank
af6091b493 fixing some memory leaks
* audio_reactive.h: catch memory errors from WiFiUDP
* udp: explicitly flush unused receive buffers.
* wled.cpp: additional debug info about "largest available block"
* FX_fcn.cpp: free _globalLeds before running purgeSegments().
2023-06-07 17:10:32 +02:00
Ewoud
40d120146f Merge branch 'mdev' into audio_fastpath 2023-05-17 11:58:43 +02:00
Ewoud
c0d5cad198 Merge remote-tracking branch 'upstream/main' into mdev 2023-05-17 11:15:50 +02:00
Blaz Kristan
4a567ab97c Merge branch 'main' into seg-groups 2023-05-15 17:06:38 +02:00
Blaz Kristan
90431b662b Rename "group" to "set" 2023-05-15 17:06:29 +02:00
Blaz Kristan
1c8f349a62 Bugfix.
- prevent LED flash on realtime end
2023-05-14 20:30:57 +02:00
Frank
7d0e627e14 some effect optimizations
* getpixelcolor: attribute pure - it reads memory, but does not write
* some optimizations for SEGMENT.blur() and SEGMENT.fadeToBlackBy()

* FX.c:pp remove double calls to blur() and fade_out()
* FX.cpp: SEGMENT.setUpLeds() added to effects, to enable LED buffering (safe some time because getPixelColor does not need to access NeopixelBus)

* a few other optimizations to safe time and avoid "expensive" operations
* set I2C bus speed to 400kHz (default is 100Khz)

* a few other small optimizations and tweaks
* pio: esp32 V4 builds use "patch5" toolchain version, which contains a few bugfixes especially for memory management.
2023-05-03 20:33:23 +02:00
Blaz Kristan
274f5f2f1f Bugfix. 2023-04-22 16:06:13 +02:00
TroyHacks
b7f1373e7d DDP Transmit RGBW Fix 2023-04-14 15:05:41 -04:00
Frank
996d041581 bugfix for art-net transmit
art-net transmit was not sending out LEDs, but only transmitted headers repeatedly (thanks @troyhacks for noticing).

Actually such problems can be found by newer compilers, so i've added the warning option to [esp32_idf_V4].

wled00/udp.cpp: In function 'uint8_t realtimeBroadcast(uint8_t, IPAddress, uint16_t, uint8_t*, uint8_t, bool)':
wled00/udp.cpp:824:40: warning: declaration of 'byte buffer [12]' shadows a parameter [-Wshadow=compatible-local]
         byte buffer[ART_NET_HEADER_SIZE];
                                        ^
wled00/udp.cpp:720:85: note: shadowed declaration is here
 uint8_t realtimeBroadcast(uint8_t type, IPAddress client, uint16_t length, uint8_t *buffer, uint8_t bri, bool isRGBW)  {
2023-04-14 11:39:12 +02:00
TroyHacks
deb09c288a Unmessing an optimization to the header - which caused the header to be sent over and over. 2023-04-12 18:00:35 -04:00
Ewoud
ab808c5522 Merge remote-tracking branch 'upstream/main' into mdev 2023-03-12 20:53:22 +01:00