Commit Graph

62 Commits

Author SHA1 Message Date
Frank
9968ed9a22 fix merge error 2025-10-25 22:17:13 +02:00
Damian Schneider
82ba119402 fix low brightness gradient "jumpyness"
during testing at low brightness I noticed that gradients can be "jumping" in colors quite wildly, turning a smooth gradient into a flickering mess. This is due to the color hue preservation being inaccurate and a bit too aggressive. This can be seen for example using a gradient palette and "Running" FX.
Removing the hue preservation completely fixes it but leaves color artefacts for example visible in PS Fire at very low brightness: the bright part of the flames gets a pink hue. This change is a compromise to fix both problems to a "good enough" state
2025-10-25 22:08:09 +02: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
Frank
d6dedd025d color_fade optimizations
* removed unnecessary conditions
* optimized bit-shifting logic
* use uint16_t for colors, to prevent the compiler from using 64bit integer
2024-11-15 20:12:01 +01:00
Frank
6ef0578613 color_blend accuracy improvements
For 8bit blends, we adopt the new blend8() logic from FastLED.

The WLED color_clend function is based on very old FastLED code, that was replaced 3 years ago due to serious rounding problems.
2024-11-15 15:14:44 +01:00
Frank
81facea82f color_fade small improvement
avoids over-blending, and gives a tiny speedup.
2024-11-14 14:14:36 +01:00
Frank
4aa9c2607d prevent overflow in color_blend 2024-10-23 14:22:57 +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
2edfcb3343 small optimization for color_blend
* Early exit when color1 == color2 (nothing to blend)
* pre-calculate `blendmax - blend` (repeated 4 times)
2024-06-20 12:26:43 +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
Blaž Kristan
48c64aecff Merge pull request #3904 from DedeHai/FX_fcn_improvements
added improvements to color scaling and blurring
2024-04-18 19:26:57 +02:00
Frank
8905992a89 code spell checking - part4 (MM specific) 2023-12-15 00:14:57 +01:00
Frank
8e678ffa5e allow gamma corrected preview without gamma corrected LEDs 2023-08-05 00:06:58 +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
Frank
adb3a12129 small speedup: IRAM_ATTR_YN colorBalanceFromKelvin 2023-07-28 21:04:59 +02:00
Frank
4984c578cc minor speedups
* added IRAM_ATTR_YN to some frequently used color functions
* small optimization for fade_out: pixel already has "target color"
2023-07-21 15:59:32 +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
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
292c4e25ba small updates
* colors.cpp: disable gamma calculation if CIE table mode is active (WLED_USE_CIE_BRIGHTNESS_TABLE)
* fx.cpp: small improvement to FreqMap, and bugfix for effects that modify binNum / maxVol
* pio: update for Line-In shield pins (final hardware version)
2023-04-01 22:13:46 +02:00
Ewoud
8485be27f2 Merge remote-tracking branch 'upstream/main' into mdev 2023-03-21 11:39:30 +01:00
Blaz Kristan
11b687cdc2 Float vs. double. 2023-03-19 11:24:59 +01:00
Ewoud
66b15d32d9 Merge remote-tracking branch 'upstream/main' into mdev 2023-01-07 12:01:03 +01:00
Blaž Kristan
506b6b51ce whitespace cleanup 2023-01-06 09:24:29 +01:00
Frank
125017f57d small updates
- colors: add clarification that alternative table does not affect NeopPixelBus colors
- npm run build
- build number up
2022-11-29 22:20:37 +01:00
Frank
c8bc917aaf color management: experimental CIE1931 lookup table
CIE table is better to preserve low brightness colors (original gamma table will map many low values to 0)
2022-11-29 21:26:34 +01:00
Blaz Kristan
b141ec7ea7 Fix for #2880 (stateChanged on segment on/off)
Added comments.
Added X1, X2, X3, M1, M2, M3 segment options to HTTP API.
Added "on" handling with "ps".
2022-11-13 12:13:49 +01:00
Blaz Kristan
787f5f06df Global gamma.
Randomcycle palette bugfix.
2022-09-04 20:17:05 +02:00
Blaz Kristan
d0a08a55d1 Memory management! 2022-08-03 21:36:47 +02:00
Blaz Kristan
f02616acd1 Some fixes. 2022-07-31 19:52:07 +02:00
Blaz Kristan
d328db543e Bugfixes.
- gamma on *Color palettes
- gamma moved out of WS2812FX
- palette fade (JSON) fix
2022-07-30 23:58:29 +02:00
Blaz Kristan
d9f2c2b968 Segment API
- moved all drawing logic to segment
- moved transitions to segment
Conditional 2D compile.
Rearranged effect IDs.
Implemented dynamic effect arrays.
2022-07-10 22:23:25 +02:00
Blaz Kristan
64fd207533 Refactoring WS2812FX class.
- effect functions no longer part of class
- methods to access private members
- separate Segment, Segment_runtime, ColorTransition from WS2812FX
2022-07-06 13:13:54 +02:00
Blaz Kristan
4d10c9de95 Removed unnecessary set call.
Fixed incorrect colorUpdated call.
Fixed white +/- in IR40 remote.
2022-02-27 16:18:37 +01:00
Blaž Kristan
8af445e72b Merge branch 'master' into merge-master 2022-02-22 10:42:00 +01:00
Blaz Kristan
41b6f3ffa7 Merge branch 'master' into merge-master 2022-02-20 22:24:11 +01:00
cschwinne
7b969bb8c2 Various state changed logic simplifications
Changed main segment, must be selected
2022-02-16 21:12:33 +01:00
Blaz Kristan
a5b19bbc83 Multiple changes:
- added segment capabilities utility
- removed colorFromUinXX functions
- rewritten IR color handling (changeColor())
2022-02-10 13:24:51 +01:00
Blaz Kristan
e35ad7551b Apply IR to main or selected segments.
Refactored IR code.
2022-02-07 00:40:45 +01:00
Blaz Kristan
6c943a7158 IR button & W color fix. 2022-02-06 13:15:35 +01:00
Blaz Kristan
7eb029dcb6 Complete segment syncing.
Reduced complexity of colorUpdated regarding effect/color change.
Minor optimizations.
2022-01-15 14:04:16 +01:00
Blaž Kristan
1ab555b590 Cleaning colorUpdated() & UDP segment syncing.
Added selected segments only save.
2022-01-14 14:27:11 +01:00
Blaz Kristan
156b499f93 Merge branch 'master' of https://github.com/aircoookie/WLED into dev 2021-12-07 17:18:38 +01:00
Christian Schwinne
66bad2b6f8 Single json buffer (#2336)
* Single/static JSON buffer for all requests.

* Missing json.cpp changes.

* Async fix.

* Added conditional compile (WLED_USE_DYNAMIC_JSON).

* Advanced locking with time-out.

* Missing releaseJSONBufferLock() on error response.

* Fix for config saving.

* Fixes and optimisations.
Dadded debugging information.

* Fix for ledmaps.

* No unsolicited serial sending if GPIO1 allocated

* Stray semicolons

* Fix JSON ledmap

Co-authored-by: Blaz Kristan <blaz@kristan-sp.si>
2021-12-04 01:05:01 +01:00
Blaž Kristan
aa34df7a4c Merge branch 'master' of https://github.com/Aircoookie/WLED into new-CCT 2021-12-01 14:51:45 +01:00
cschwinne
ea0f37f5b9 CCT bus manager logic simplification
CCT from RGB if none set (-1)
2021-11-24 11:02:25 +01:00
cschwinne
b3324d22f5 allowCCT performance improvement 2021-11-21 23:46:44 +01:00
Blaz Kristan
a696afaeb8 Color mangling macros.
Removed legacy Auto White caclulation.
2021-10-26 20:35:45 +02:00
Blaz Kristan
8ca298b299 Removed legacy auto-white calculation.
Introduced color mangling macros.
Minor optimizations/fixes.
2021-10-26 19:17:42 +02:00
Blaz Kristan
090e29effd Moved auto white calculation to bus manager.
Other minor fixes.
2021-10-25 20:15:42 +02:00