248 Commits

Author SHA1 Message Date
Frank Möhle
cce3c0b5d3 psram-aware malloc functions (backport of upstream #4895) (#342)
Introduces new memory allocation functions, based on wled#4895 by @DedeHai

* keep a minimum of 15KB RAM available to UI - improves stability
* S3/S2/C3 automatically use "fast RTC Ram" for small data (reduces fragmentation)
* auto-detects PSRAM (or no PSRAM) when firmware was built with -D BOARD_HAS_PSRAM
* d_malloc() and d_calloc() prefer DRAM if possible (faster), but fall back to PSRAM when free RAM gets low.
2026-02-18 17:57:47 +01:00
Frank
bbe8e6eb0f remove static functions (Philips HUE)
fixes the build error
2026-01-28 22:17:25 +01:00
Frank
88acb54241 some more attributes
for better optimization by the compiler
2026-01-17 14:08:11 +01:00
Frank
d987206d3b make wled_math functions IRAM_ATTR (faster) 2026-01-17 13:56:29 +01:00
Damian Schneider
532c9b762c replacement for fastled sqrt16() (#4426)
* added bitwise operation based sqrt16

- replacement for fastled, it is about 10% slower for numbers smaller 128 but faster for larger numbers. speed difference is irrelevant to WLED but it saves some flash.

* updated to 32bit, improved for typical WLED use

- making it 32bits allows for larger numbers
- added another initial condition check for medium sized numbers
- increased the "small number" optimization to larger numbers: the function is currently only used to calculate sqrt(x^2+y^2) which even for small segments is larger than the initially used 64, so optimizing for 1024 makes more sense, although the value is arbitrarily chosen
2026-01-17 12:18:35 +01:00
Frank
80b906999b requestJSONBufferLock() variable timeout
* default timeout = 1800ms
* reduced timeout for ws (300ms)
2025-12-30 01:57:46 +01:00
Frank
bc7cf062e8 effect math sppedup - up to 3x faster
-> distortion waves 3x speedup
-> hiphotic 2x speedup
-> waving cell 1.5x speedup

* replace sin8_t by lookup-table with pre-computed values
* moved integer sin and cos to fcn_declare.h (inlined by the compiler)
* moved gamma32 to fcn_declare.h (inlined by the compiler)
* a few other small tweaks
2025-12-17 21:59:22 +01:00
Frank
462e4cb805 post-merge
* add missing "cool" option in twinklefox
* upstream compatibility defines for gamma32inv() and gamma8inv()
2025-12-16 01:11:40 +01:00
Frank
cdd1141867 post-merge fixes
* fx.cpp: replace FastLED inoise() with optimized perlin() functions
* minor updates for util.cpp and fcn_declare.h
2025-12-16 00:28:10 +01:00
Damian Schneider
fe574aef91 Merge pull request #4594 from DedeHai/perlin_noise
Adding perlin noise replacement for fastled functions
2025-12-15 23:52:22 +01:00
Frank
384cbec86e desperate attempt for 8266 survival
* bring back UREAL_MATH (inaccuate, but smaller flash)
* typing to tune feature sets so they fit into small 8266 models
2025-11-24 15:50:04 +01:00
Will Tatam
2c0510b5b9 Merge pull request #284 from netmindz/deviceId-MM
Add deviceId
2025-11-22 12:31:16 +00:00
Will Tatam
d047ee0984 Add deviceId 2025-11-21 08:39:50 +00: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
297a2c2b9c bring back lost function ColorFromPaletteWLED (WLEDMM_SAVE_FLASH only)
this change was somehow lost - ColorFromPaletteWLED existed in colorTools.hpp (for fast inline) but was missing in colors.cpp (WLEDMM_SAVE_FLASH fallback).
2025-11-01 14:16:47 +01:00
Frank
8067f1f70c bus.setPicelColor optimization: move colorBalanceFromKelvin into busmanager.cpp
colorBalanceFromKelvin() is only called from inside bus_manager.cpp, so we can help the compiler optimize by making it a local (static) fuction
2025-10-20 21:49:09 +02:00
netmindz
a9cdc56f51 Merge pull request #226 from netmindz/gif-MM
GIF Playback
2025-06-29 20:12:20 +01:00
Damian Schneider
66e2e4d900 Adding Particle System (port from AC)
- port from AC
- also adding hardware random functions
2025-04-18 17:04:14 +02:00
Will Tatam
d9ab878503 Swap to WLED_ENABLE_GIF 2025-02-22 12:56:47 +00:00
Christian Schwinne
b8a29bcbf8 GIFs work again in principle 2025-02-22 12:37:13 +00:00
Christian Schwinne
e8c09104e1 GIF testing 2025-02-22 12:21:59 +00:00
Frank
985fa1fd3f inline frequently used color utilities (up to 15% faster)
* moving color_blend, color_add, and color_fade to a seperate file, to allow the compiler to inline the functions.

* inlining slightly increases firmware size - original non-inline functions get used on 8266, or when WLEDMM_SAVE_FLASH is defined.
2025-01-17 21:42:26 +01:00
Damian Schneider
e914417c74 Merge pull request #4181 from DedeHai/0_15_trig_math
Added integer based `sin()/cos()` functions, changed all trig functions to wled_math
2024-11-29 00:23:43 +01:00
Troy
44c6a0d73b Proper Art-Net Settings 2024-11-07 13:12:15 -05:00
Frank
18b35d11f8 usermod manager - small optimization
* use native types only (faster, smaller)
2024-09-21 20:42:03 +02:00
Frank
f1088bb5c0 (experimental) loop2 to get fresh audio just before drawing
* introducing usermod::loop2() - runs just before strip.service()
--> expecting to reduce lagging between audio and visual to an absolute minimum.
2024-09-21 20:41:05 +02:00
Frank
7f9da309c9 const const const
adding hints for the compiler for optimization.
In case your custom build complains about "const", just remove the keyword. based on e82f38e277, but going further :-)

* "const" class functions : function does not modify any class attributes ( --> "this" becomes const)

* __attribute__((pure)) :  function return value depends only on the parameters and/or global variables. The function does not modify any global or static variables.
* __attribute__((const)) : function only examines arguments (no globals), and has no effects except the return value. This slightly more strict than "pure"
* hot: tells the compiler "this functions is called very often"
* cold: the opposite of hot
2024-08-07 14:58:38 +02:00
Frank
078bd70775 HUB75 speedups and minor improvements
* HUB75: allow to use native driver gamma correction - requires to undo WLED gamma
* added unGamma24() function
* HUB75: optimized setPixelColor()
* some experimental HUB75 stuff
2024-08-05 17:28:03 +02:00
Frank
29013a3f83 auto-replace long functions with short names
adI = addInfo
adD = addDropdown
adO = addOption
adF = addField

before: String buffer usage: 3183 of 4037 bytes
after:    String buffer usage: 2805 of 4037 bytes
2024-07-01 22:54:24 +02:00
Frank
d058e33df3 slightly reduce flickering during file access
it seems that reading/writing "larger" files from LittleFS causes LED flickering.

This change adds a simple cache for "file not found" results, so that repeated file.exists() calls are avoided.
2024-04-28 18:57:05 +02:00
Frank
93b8c63e2b post PR3904 fixes and improvements
* fix compiler warnings (uninitialized vars, ambiguous  functions calls)
* restore some lost function prototypes
* avoid negative pixel indices
* only use "fast" color_add when there is no risk of  "overshooting" results
* minor optimizations
2024-04-18 21:09:14 +02:00
netmindz
0f79e9b7ff Merge pull request #124 from netmindz/auto-playlist
New Usermod - Auto Playlist
2024-04-16 22:38:56 +01:00
Frank
acfbe890b3 suspend playlist engine while auto-change is active
* adding suspendPlaylist() to playlist engine code
* autoplaylist usermod calls suspendPlaylist() before switching to another preset
* fix a potential overflow on `lfc` (uint8_t -> uint16_t)
2024-04-16 13:25:21 +02: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
netmindz
42109fe606 Merge branch 'mdev' into dmx_input 2024-01-16 13:27:42 +00:00
Blaž Kristan
3b6100a057 Merge pull request #3648 from willmmiles/json-response-locking
Expand JSON buffer lock scope to entire web reply
2024-01-08 11:54:58 +01:00
Arne
7cccb2e181 rename initDmx() -> initDmxOutput() 2023-09-24 13:30:17 +02:00
Arne
6efd7457e0 rename handleDMX() handleDMXOutput() 2023-09-24 13:30:17 +02:00
Arne
b4bbf0a5cb Extract dmx_input from dmx.cpp into dmx_input.cpp.
This greatly improves readability because it gets rid of most of the
ifdefs.
2023-09-24 13:30:09 +02:00
Christian Schwinne
d3f3f6330b Add WiFi network scan RPC command to Improv Serial (#3271) 2023-09-01 18:07:00 +02:00
Frank
f010adfe24 experimental: preview with gamma correction
.... actually we undo gamma adjustments, because screens (laptop, pad, etc) will apply their own gamma corrections.

Activate in LED settings: "Use Gamma correction for preview"

Colors in WLED are sometimes gamma corrected, sometimes not. This change tries to make the best out of the color mess, but its still not working properly in all configurations.
2023-08-04 22:03:53 +02:00
Clayton Sims
5e20f94b8e Support for ESP-NOW Wireless Remote Control (#3237)
* Initial checkin for ESP-NOW remote feature

* cleanup irrelevant comment

* don't bring in espnow package includes when feature disabled

* Formatting and removing inaccurate call mode hardcoding

* Fork ESP Now code by platform (8266 v. esp32)

* compiled html update

* Disable ESP-NOW remote by default on ESP32 until tested

* Enable ESP-NOW remote for ESP32

* Rename ESP NOW define

---------

Co-authored-by: cschwinne <dev.aircoookie@gmail.com>
2023-07-27 17:17:41 +02:00
Frank
a9cdd21da9 prevent strip flickering
* it seems that NPB is very sensitive when being interrupted during LEDs driving.  This change tries to avoid flash (file) writes when the strip is active.
* minor optimization: yield is completely unnecessary on ESP32 (we have a real OS).
2023-06-12 23:27:09 +02:00
Frank
d4a37ecaea clean up ledmap names when directly reading from file 2023-06-09 17:26:44 +02:00
Frank
40c96c14f5 a bunch of smaller speedups to core functions
*  make local functions "static"
* use fast_ int types where possible
* use native min/max instead of MIN/MAX macros. Macros evaluate each parameter TWICE!!
* adding __attribute__((pure)) and __attribute((const)) to help the compiler optimize
* ws.cpp: reduce max "live leds" in fastpath mode
2023-04-30 18:41:30 +02:00
Frank
9130e4be54 minor optimization of core LED functions
* use _fast_ integer types in loops - in contrast to "uint16_t" etc, the compiler can leave out range/overflow corrections, so it might run faster.
* fcn_declare.h: revive "WLED_USE_REAL_MATH" option, which can be a bit faster on ESP32.
2023-04-21 16:44:58 +02:00
MoonModules
7ffe25d55c Merge branch 'mdev' into DMX-Input-esp_dmx 2023-04-06 20:51:20 +02:00
Ewoud
eead626dd5 0.14.0-b15.21 release! 2023-04-02 13:22:38 +02:00
Will Tatam
733740da8f Code cleanup 2023-03-24 09:55:25 +00:00
netmindz
bda95faafd Merge branch 'MoonModules:mdev' into DMX-Input-esp_dmx 2023-03-23 21:40:14 +00:00