Commit Graph

564 Commits

Author SHA1 Message Date
Frank
90dd048878 revert fadeToBlackBy optimization
causes problems with overlay text (scrolling text)
2024-08-08 17:41:05 +02:00
Frank
b2844645c6 pinwheel mapping XXL - no holes at 64x64 2024-08-07 16:53:25 +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
42919f9daf blob effect improvements, and a dirty hack for HUB75 double buffer
* mode_2Dfloatingblobs() improvements for large panels
* Segment::fillCircle() speed optimizations
* HUB75 hack (disabled by default): skip first fill(BLACK) when using double buffering (as the buffer gets cleared after each frame)
2024-08-06 15:53:46 +02:00
Frank
5240c3450b Segment drawing optimizations (FASTPATH only)
* cache width, height, and a few more values that are normally re-calculated for each pixel
* make normal sPC a bit faster
* Segment::fade_out() optimization

--> only active in FASTPATH mode, to preserve flash on small devices (8266)
--> code still needs some polishing
--> up to 20% speedup with some 2D effects (esp32,  flash qio 80Mhz, -O2)
2024-08-05 21:30:25 +02:00
Frank
5f4834dec4 small improvements
* optimized fadeToBlackBy() - don't repaint unchanged pixels
* made MIN_HEAP_SIZE configurable by build_flags
* specific error message when not enough memory for LEDs buffer
2024-08-05 17:06:38 +02:00
Frank
9260111cd7 use drawLine for 1D2D mapping modes
thanks @troyhacks for providing the idea.
2024-07-16 23:22:50 +02:00
Frank
7a83f1759d removed a/b testing via Reverse X (segment option) 2024-07-16 20:26:52 +02:00
Frank
961040849e speedup for pinwheel mapping
fast sPC() in pinwheel mapping -> ~10% speedup
2024-07-15 18:06:25 +02:00
Frank
6aaf7a908d more sPC optimizations
* made setPixelColorXY_fast private
* optimized Segment::fill() to use setPixelColorXY_fast
* "bar" 1D expand optimization
2024-07-14 23:49:37 +02:00
Frank
1b9b2dcffe minimal Auto segment creation bugfix
based on 13bfda56ef
2024-05-18 21:49:09 +02:00
Blaz Kristan
64b1d76893 Palette loading optimisation
- fixes #3978
- FX: Firenoise can use selected palette
2024-05-16 00:07:18 +02:00
Frank
e17c30ebd7 Merge pull request #3961 from Brandon502/0_15
Added Pinwheel Expand 1D ->2D effect mapping mode
2024-05-15 22:35:18 +02:00
Frank
e886ece189 Segment::setPixelColorXY optimization
use a shortcut when the segment is "simple" and just a single pixel needs to be set on HW level.
2024-04-20 22:02:15 +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
netmindz
0f79e9b7ff Merge pull request #124 from netmindz/auto-playlist
New Usermod - Auto Playlist
2024-04-16 22:38:56 +01:00
Frank
019cafc5e0 report out-of-memory situations to the user 2024-04-16 19:10:46 +02:00
Frank
8e84dba644 post-merge
this one was almost lost
2024-04-09 21:01:44 +02:00
Frank
0bb0b7f036 Custom palette gamma (fixes #126)
based on upstream 7f6486c77d
2024-04-09 20:02:06 +02:00
Troy
1f9e800957 Update FX_fcn.cpp
Accidental find/replace
2024-04-04 21:45:46 -04:00
Troy
a90c9f0f2a Update FX_fcn.cpp
Removed temp debug suppression
2024-04-04 21:39:58 -04:00
Troy
22be977df8 IfDefs to quiet some other debug lines during debugging. 2024-03-25 12:19:13 -04:00
Troy
b52773c1d3 comments and some temp removal of other debug 2024-03-25 08:27:12 -04:00
Frank
1350a4111d Arc optimization: symmety at 45degress
If the segment is wider than 20 pixels, we optimize calculations due to symmetry - for smaller arcs the result looks better without optimization.

As a side-effect, we have enough computing power left to go through the complete circumference, avoiding holes.
2024-02-25 22:02:51 +01:00
Frank
8a0b97e0a8 ARC mapping optimization
The biggest optimization was to avoid sin_t / cos_t.
Now let's try to help the compiler optimize the drawing loop.
2024-02-25 19:46:53 +01:00
Frank
e0f08864a2 remove slow and inaccurate math from time critical code
as it turns out, the "_t" functions (from wled_math.cpp) are about 3 times (!!!) slower than the standard functions.

* mapping modes : Arc and Circle
* effects: 2D Drift, 2D Drift Rose
2024-02-25 19:36:29 +01:00
Frank
ff56cf0ee9 Pinwheel speed optimizations
* use "float" math only - sinf(), cosf(), roundf()
* use fewer "rays" for medium-sized matrix (<=32 pixels wide/high)
* ray drawing optimized to use fixed point

up to 80% faster on esp32 and esp32-S3; -S2/-C3 should also see benefits, as these do not have floating point support in hardware.
2024-02-25 18:00:19 +01:00
Frank
96d275e2b9 minor optimization for PinWheel mapping
use "float" math functions. These are slightly faster. By avoiding to pull in "double" math we also save some flash space.
2024-02-23 12:34:14 +01:00
Brandon502
017b572897 Expand1D PinWheel changes 2024-02-21 17:44:08 -05:00
Brandon502
3e131014b2 Added PinWheel Expand1D Effect 2024-02-20 17:26:36 -05:00
Frank
86b0eeafb7 Ledmaps loading bugfix (wrong size, memory corruption)
* File.readbytesuntil does not terminate strings. So the string buffer needs to be filled with zero's before reading.
* fix crashes (mem corruption) when ledmap file has too many / too few entries.
* initialize unused map places with "identity" (same led) mapping

before fix:
> Reading LED map from /ledmap1.json
> ("width": 60edmap1.json)  ("height": 90edmap1.json)
> resetSegments 1 60x90
> allocLeds (0,0 to 60,90), 16200 from 0
> allocLeds (0,0 to 60,90), 16200 from 6
> deserializeMap 60 x 90 customMappingTable alloc 5400 from 0

after:
> Reading LED map from /ledmap1.json
> ("width": 60)  ("height": 9)
> resetSegments 1 60x9
> allocLeds (0,0 to 60,9), 1620 from 0
> allocLeds (0,0 to 60,9), 1620 from 6
> deserializeMap 60 x 9
> deserializemap customMappingTable alloc 540 from 0
2024-02-20 15:10:25 +01:00
Frank
c9b416a4fe prevent flickering during OTA
I've almost toasted my wiring due to uncontrolled LED flickering during OTA.
So here is the fix - it prevents any strip updates when OTA is ongoing.
2024-02-12 21:53:59 +01:00
Frank
302f18fbfe small speedup
* currentBri() is called for any setpixelColor(), so we can speed up everything (a bit) by allowing the compiler to inline which saves a few cycles of call/return overhead.
* aligned the function with upstream, and added another optimization by only calling progress() when a transition is active.
2024-01-26 17:08:37 +01:00
Frank
01c187f8aa bugfix for #104
this avoids heap corruption, by double-checking that "use global leds" is not configured, before trying to free ledsrgb[].

It is still a mystery why Segment::_globalLeds == nullptr.
2024-01-02 15:52:00 +01:00
Blaz Kristan
f7bfaf02a8 Possible bugfix for #3609 #3616 2023-12-29 17:46:24 +01:00
Frank
684bf0bd8b random palette bugfix
if random palette was used in the startup preset, all LEDs were orange until the first palette cycling happened.
This fix ensures that there is no all-orange palette initially.
2023-12-16 18:44:54 +01:00
Frank
8905992a89 code spell checking - part4 (MM specific) 2023-12-15 00:14:57 +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
3eb360dfe1 Fix for #3403 2023-10-06 17:19:25 +02:00
Ewoud
342f99ca27 Effects to Instances: effects non-deterministic: now instead of millis
index.js
- genPresets: Temporary for deterministic effects test: Set to 11/Raibow instead of 1/Random smooth palette

FX.cpp
- replace all millis() by strip.now
2023-09-30 12:23:53 +02:00
Frank
e6e30abfeb 8266: improve accuracy of FPS calculation
based on a similar correction I made in upstream recently.
2023-08-25 16:51:07 +02:00
Frank
eecb0e700b quickfix for effect "double startup" problem
temporary workaround until fixed in upstream.

--> Please disable "Crossfade" in LEDs settings.
2023-08-10 13:58:57 +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
9a3a97eff1 pre-merge
cleanup:
- version increase
- clean up debug messages
- minor fixes in platformio.ini
- fix compilation with -D WLED_DISABLE_2D

helping the compiler to optimize:
- a few more __attribute__((pure))
- fx.cpp marked a few local functions as "static"
2023-07-13 19:58:48 +02:00
Frank
0fb5edc4a2 robustness improvements from upstream
(from upstream alt-buffer branch)
* prevent drawing into inactive segments
* robustness improvements for transitions
2023-07-13 18:34:46 +02:00
Frank
c64f74a611 fix for random crashes on changing presets (UI)
Segments are created/deleted on-the-fly; it seems that "local leds" buffers did not follow properly.
* revise segment copy/move constructors
* de-optimize use of local leds (as they need to be re-allocated when segment size changes)
* minor stability improvements
2023-07-08 22:40:43 +02:00
Frank
a45306b141 blur speedup
it seems that SEGMENT.blur() is the main bottleneck for many 2D effects.

This change optimizes performance of the function:
* avoid to re-write unchanged pixels
* early exit when blur_amount == 0 (=nothing to do)
* use _fast_ types where possible

I've seen up to 20% speedup with this change.
2023-07-08 20:06:52 +02:00
Frank
5fe12eef5a Merge branch 'mdev' into audio_fastpath 2023-07-08 19:23:36 +02:00
Frank
2562f308ca fix power calculation for NeoPixelBusLg
power estimation results from estimateCurrentAndLimitBri() were too low (example: estimated 1.3Amp, measured 1.6Amp). This change corrects the power calculation. Due to the changed behavior of getPixelColor, powerSum must be used as-is, not scaled down again by brightness.
2023-07-08 19:13:20 +02:00