Commit Graph

170 Commits

Author SHA1 Message Date
Frank Möhle
e3bc32a823 remove dead (and dangerous) mutex macros in bus_manager.cpp (#5364)
these macros are
* not used any more
* dangerous because they don't time out
* dangerous because they use an internal mutex of the ledc driver (not part of the LEDC API)
2026-02-09 11:14:58 +01:00
Damian Schneider
af8db57f02 Fix for cfg exceeding LED limit (#4939)
* Safety Checks for UI, fix for cfg exceeding LED limit
* improvements to low heap check
* add `isPlaceholder()` to bus, some fixes
* remove `disableForceReconnect` for better future implementation
* add "glitch gating" for C3 and check heapy every 5 seconds instead of every secondd
* replace magic number with the correct define, more robust bus defer by look-ahead

In the event that a Bus fails to initialize, or the memory validation
fails, keep the configuration around so the settings contents don't
change out from under the user.

---------

Co-authored-by: Will Miles <will@willmiles.net>
2026-01-19 19:33:06 +01:00
Damian Schneider
60e1698ed2 Improvements & fixes for HUB75 (#5026)
* Improvements & fixes for HUB75

- added proper config parameters to allow multiple panels
- added config checks
- fixed crashes on S3
- changed constant variables to constexpr
- added "wled.h" to bus_manager.cpp and removed local function prototypes (needed for buffer allocations)
- speed optimisations: yields about 10% higher FPS
- updated platformio_override.sample.ini
- some code cleanup
2026-01-03 09:56:10 +01:00
Damian Schneider
8b3975752c speed optimisations, fix for restoreColorLossy, code cleanup (#4895)
- speed optimization in color_add, PS fast_color_add and blur functions
- applying more bit and shift manipulation tricks to squeeze out just a bit more speed on color manipulation functions.
- Optimization on blur is based on work by @blazoncek
- Renamed PS fast_color_add() to fast_color_scaleAdd()
2025-09-23 20:15:42 +02:00
Damian Schneider
4d39dd0a5e Fix LED buffer size calculation (#4928)
* Attempt at better bus memory calculation and estimation
* Remov double buffer count for ESP8266 (thanks @dedehai)
* improve UI calculation
* adding mendatory LED buffers to UI memory calculation
* adding buffer for transitions to memory calculation, change "error" to "warning"
* bugfixes in settings_leds.htm
* fix getDataSize() forESP8266, ESP8266 does not use double buffering.
* update led settings: fix parsing by @blazoncek
* new warnings for LED buffer use, deny adding a bus if it exceeds limits
* adds recommendations for users (reboot, disable transitions)

Co-authored-by: Blaž Kristan <blaz@kristan-sp.si>
2025-09-21 22:48:09 +02:00
Will Tatam
c5119c8aa6 Remove NO_CIE1931 to better sit with other Gamma correction changes in WLED 2025-09-20 16:41:36 +01:00
Will Tatam
6c718c3558 Remove legacy code for double buffer 2025-09-20 15:30:36 +01:00
Will Tatam
75481d3251 Disable VirtualMatrixPanel, CHAIN_BOTTOM_LEFT_UP incomplete 2025-09-20 15:20:38 +01:00
Will Tatam
3a7de8275f Merge pull request #3777 from netmindz/HUB75-AC
Add HUB75 support
2025-09-20 13:05:48 +01:00
Damian Schneider
76cb2e9988 Improvements to heap-memory and PSRAM handling (#4791)
* Improved heap and PSRAM handling

- Segment `allocateData()` uses more elaborate DRAM checking to reduce fragmentation and allow for larger setups to run on low heap
- Segment data allocation fails if minimum contiguous block size runs low to keep the UI working
- Increased `MAX_SEGMENT_DATA` to account for better segment data handling
- Memory allocation functions try to keep enough DRAM for segment data
- Added constant `PSRAM_THRESHOLD` to improve PSARM usage
- Increase MIN_HEAP_SIZE to reduce risk of breaking UI due to low memory for JSON response
- ESP32 makes use of IRAM (no 8bit access) for pixeluffers, freeing up to 50kB of RAM
- Fix to properly get available heap on all platforms: added function `getFreeHeapSize()`
- Bugfix for effects that divide by SEGLEN: don't run FX in service() if segment is not active
-Syntax fix in AR: calloc() uses (numelements, size) as arguments

* Added new functions for allocation and heap checking

- added `allocate_buffer()` function that can be used to allocate large buffers: takes parameters to set preferred ram location, including 32bit accessible RAM on ESP32. Returns null if heap runs low or switches to PSRAM
- getFreeHeapSize() and getContiguousFreeHeap() helper functions for all platforms to correctly report free useable heap
- updated some constants
- updated segment data allocation to free the data if it is large

- replaced "psramsafe" variable with it's #ifdef: BOARD_HAS_PSRAM and made accomodating changes
- added some compile-time checks to handle invalid env. definitions
- updated all allocation functions and some of the logic behind them
- added use of fast RTC-Memory where available
- increased MIN_HEAP_SIZE for all systems (improved stability in tests)
- updated memory calculation in web-UI to account for required segment buffer
- added UI alerts if buffer allocation fails
- made getUsedSegmentData() non-private (used in buffer alloc function)
- changed MAX_SEGMENT_DATA
- added more detailed memory log to DEBUG output
- added debug output to buffer alloc function
2025-09-16 19:46:16 +02:00
netmindz
a79ae25621 null check in setBrightness
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-09-13 14:10:04 +01:00
netmindz
46e60b4d0a Only read pinArray if initialized
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-09-13 11:08:35 +01:00
Will Tatam
199bc45ae2 Merge branch 'main' into HUB75-AC 2025-08-31 12:53:25 +01:00
Damian Schneider
d5d7fde30f use video scaling instead of NPB luminance & new ABL (#4798)
* updated color scaling to preserve hue at low brightness resulting in much better colors
* replace NPBlg with NPB, moved brightness scaling to bus manager
* improved gamma table calculation: fixed mismatch in inverting gamma table calculation: inversion should now be as good as it gets
* code cleanup, fixed gamma being applied in unnecessary places

Improvements to ABL handling:
- removed strip level handling, ist now all done on bus level
- limiter now respects pixel mapping
- proper handling of white channel
- improved current estimation
- current is now always correctly reported to UI
- minimal FPS impact if the ABL is not limiting but slighly higher impact for global ABL limit due to double-scaling

- moved brightness scaling to BusDigital
- created new header file colors.h to be able to access color functions in bus-manager.
- updated colo_fade() with better video scaling to preserve hue's at low brightness
- added IRAM_ATTR to color_fade (negligible speed impact when compared to inline and benefits other functions)
- added IRAM_ATTR to color_blend as it is used a lot throughout the code, did not test speed impact but adding it to color_fade made it almost on-par with an inlined function

Additional changes:
- fixes for properly handling `scaledBri()` (by @blazoncek)
- also use bit-shift instead of division in blending for ESP8266
- improvements for faster "softlight" calculation in blending
- changed some variables to uint8_t to maybe let the compiler optimize better, uint8_t can be faster if read, store and set are all done in uint8_t, which is the case in the ones I changed
- various minor code formatting changes
2025-08-29 17:12:10 +02:00
Blaž Kristan
374d90629d Merge pull request #4768 from wled/fix-4268
Add mDNS resolution for network bus
2025-08-02 23:12:23 +02:00
Damian Schneider
e2f5becdd0 Bugfixes in FX data allocation (#4783)
- Bugfixes in FX data allocation: realloc was not handled properly.
- Added *intermediate* fix for waitForIt(), see https://github.com/wled/WLED/issues/4779
- Bugfix in 1D->2D expansions: corner-expansion MUST be boundary checked as it blindly writes the max dimension
- removed some realloc(), improving fragmentation on large setups
- increased min heap constant
- ESP32 C3 has no PSRAM, it now uses default alloc functions
- also added missing UI info for "Error 7"
2025-07-23 06:42:06 +02:00
Blaz Kristan
e7157e542a Add mDNS resolution for network bus 2025-07-12 18:44:38 +02:00
Blaž Kristan
a24420ae70 Fix #4268 2025-07-12 18:18:49 +02:00
Blaž Kristan
929a5a8d80 Fix for wled#4759 2025-07-08 13:28:24 +02:00
Will Tatam
127c700a99 Define starting heap with lastHeap 2025-07-06 16:22:44 +01:00
Will Tatam
f9a6a3d36f Return if pinallocation fails 2025-07-06 16:22:44 +01:00
Damian Schneider
9eb0c3c8e5 Bugfix: convert cctBlend value back to "%" for UI (#4737)
* Bugfix: convert cctBlend value back to "%" for UI
2025-07-06 16:22:44 +01:00
Damian Schneider
05557ca790 Bugfix: convert cctBlend value back to "%" for UI (#4737)
* Bugfix: convert cctBlend value back to "%" for UI
2025-06-20 10:55:53 +02:00
Will Tatam
3dc45b80ba Fix b pin for Default pins 2025-06-16 22:27:42 +01:00
Will Tatam
fb469d7b24 esp32S3_PSRAM_HUB75 2025-06-16 21:29:19 +01:00
Will Tatam
009950e28f Update Hug75 to reflect changes in 0.16 2025-06-16 20:04:07 +01:00
Will Tatam
8ee12620f0 Merge branch 'main' into HUB75-AC 2025-06-16 20:03:34 +01:00
Blaž Kristan
c934776f45 Address issues reported 2025-04-26 20:08:15 +02:00
Blaž Kristan
ee9ac947a1 Segment layering & effect blending improvements
- Photoshop-style segment/layer blending
- return of strip ABL
- remove global LED buffer in favour of segment-local buffer
- new effect blending modes/transitions
- custom palettes moved out of WS2812FX class
- increased limits (matrix size, LED RAM)
- added "rainbow"-mode colorwheel
- replaced palettes with gamma unmodified ones
- move gamma adjustment to last step before sending to LEDs
- Segment & WS2812FX class reorganisation (mutable members, reordered members, protected members)
2025-04-22 22:37:18 +02:00
Blaž Kristan
4271588ecd unique_ptr fix 2025-02-25 16:06:13 +01:00
Blaž Kristan
a66f5d660d Merge branch 'main' into unlimited-bus 2025-02-25 13:54:42 +01:00
maxi4329
aa3fb7d165 update links to point to the new repo 2025-02-15 20:07:41 +01:00
Blaž Kristan
a0c55c6406 Merge pull request #4484 from blazoncek/parallel-I2S
WWA strip support & parallel I2S for S2/S3 (bumping outputs from 5/4 to 12)
2025-02-13 19:10:37 +01:00
Blaž Kristan
f3de45c6ad Remove reference to custom allocators 2025-02-09 21:43:35 +01:00
Blaž Kristan
ed91c54654 Uninitialised _data bugfix 2025-02-09 18:24:10 +01:00
Blaž Kristan
c43d09c8b1 Move _data and allocation to derived class
- as suggested by @TripleWhy
- minimum length guard

Conflicts:
	wled00/bus_manager.cpp
	wled00/bus_manager.h
2025-02-07 16:18:53 +01:00
Blaž Kristan
1db3359b84 Replace unsigned with size_t 2025-02-01 12:07:31 +01:00
Blaž Kristan
5b7bab6752 Compile fixes 2025-01-30 20:46:26 +01:00
Blaž Kristan
bf69d37cbe Revert getBus() changes 2025-01-30 19:35:36 +01:00
Blaž Kristan
ee7ec20f29 Convert BusManager class to namespace
- use unique_ptr/make_unique for busses
2025-01-30 19:31:09 +01:00
Will Miles
4c50119ac2 Merge remote-tracking branch 'upstream/main' into esp8266-pwm-phase 2025-01-23 19:39:01 -05:00
Blaž Kristan
a98685d89e Remove numBusses, RMT idle bugfix
- experiment with std::unique_ptr
2025-01-19 21:37:34 +01:00
Blaž Kristan
1c4ba20646 Merge branch 'bus-improvements' into parallel-I2S 2025-01-19 12:41:17 +01:00
Blaž Kristan
7daea18907 Merge fixes & updates
- Segment::setName()
- S2 limits
- bus debug macros
- remove cctBlending from strip
2025-01-19 11:37:57 +01:00
Blaž Kristan
0c84235a95 Bus rework
- Implement vector in bus manager
- Memory calculation according to explanation from @Makuna
- Prefer 8 RMT before 8 I2S on ESP32 (fixes #4380)
- speed improvements in ABL
- verbose debugging
- get bus size from NPB (prototype)
- Parallel I2S output bugfix
- automatic selection of appropriate I2S bus (`X1xxxxxxMethod`)
- removed I2S0 on ESP32 (used by AudioReactive)
- renumbered internal bus numbers (iType)
- added buffer size reporting
2025-01-19 10:17:33 +01:00
Frank
013684b5ca making some parameters const, plus minor improvements
* changed some parameters to "pointer to const", so compiler can better optimize code size and performance -  because data behind a const pointer will never be modified by the called function.
* made setPixelColor `const`

* fixed a few potentially uninitialized local vars (the may have random values if not initialized)

* avoid shadowing "state" in handleSerial()
* plus a few very minor improvements
2025-01-19 07:35:46 +01:00
Blaž Kristan
cc011e39ce Bus creation bugfix
- speed improvements in ABL
- verbose debugging
2025-01-13 17:27:33 +01:00
Blaž Kristan
adead9b578 Bus wrapper modifications
- NeoPixelBus update 2.8.3
- automatic selection of appropriate I2S bus (`X1xxxxxxMethod`)
- removed I2S0 on ESP32 (used by AudioReactive)
- renumbered internal bus numbers (iType)
- added buffer size reporting

Bus modifications
- WWA strip support
- bus initialisation rewrite
- optional parallel I2S (ESP32, S2 & S3)
2025-01-12 15:17:22 +01:00
Will Tatam
f447df9873 Merge branch 'main' into HUB75-AC 2025-01-06 12:07:45 +00:00
Damian Schneider
0ad65f4748 fixed CIE brightness calculation for PWM outputs 2024-12-23 14:57:22 +01:00