Commit Graph

576 Commits

Author SHA1 Message Date
Frank
22b16ab542 Align all licensing statements with EUPL-1.2 2024-10-14 21:52:52 +02:00
Frank
2aa0d47036 adding getPixelColorRestored()
similar to getPixelColor, but returns the original pixel without brightness adjustments.

* getPixelColorRestored is used by segment::sPC and segment::gPC
* getPixelColor is still used by ABL (auto brightness limiter)
2024-09-28 02:43:12 +02:00
Frank
b245112d2a some drawing speedups
* speedups for addPixelColorXY, fadePixelColorXY, fadeToBlackBy
2024-09-28 02:19:53 +02:00
Frank
ffc9ec3cfb exclude HUB75 from auto brightness limiter
For a 64x64 panel, ABL assumes 4A of standby current. This does not make any sense.
2024-09-22 17:07:26 +02:00
Frank
80a2f2b85b minor corrections
* fix some override problems bus_manager (canShow() must not be const!!!)
* fixing some "comparing integer with different signedness" warnings
2024-09-21 19:41:51 +02:00
Troy
645b45a22d Added WLEDMM_NO_MAP_RESET
Allows use of ledmaps with segments without messing with the segments. LEDs can remain remapped even with segments on top of them. (For Dom)
2024-09-16 14:19:06 -04:00
Frank
fc2e1263cb new option don't use effect-specific palette or mapping modes
* new setting in UI page: "Don't use effect palette and segment parameters" - only meaningful when "Use effect default parameters" is enabled, too.

--> effect slider defaults will still be applied, however palette, 1D2D mapping mode and other segment settings will not change.
2024-09-06 13:06:28 +02:00
Frank
bef964dcba bugfix: prevent clearing of segment settings when changing effects
in multi-segment setups, the segment options reverse, reverseY, mirror, and mirrorY were accidentally overwritten  when changing effects.
2024-09-06 12:54:27 +02:00
Frank
b47c55db90 fix 8266 builds
wled00/FX_fcn.cpp:974:16: error: '_isSuperSimpleSegment' was not declared in this scope
2024-08-18 13:21:55 +02:00
Troy
1ef13c2077 Arc 1D Expand uses drawArc if the segment is not "super simple"
WLEDMM: drawArc() is faster if it's NOT "super simple" as the regular M12_pArc code can do "useSymmetry" to speed things along on larger 2D layouts, but a more "complicated" segment likely uses mirroring which generates a symmetry speed-up, or other things which mean less pixels are calculated.
2024-08-17 13:05:23 -04:00
Troy
f23df9dfbc Revert functionality change to M12_pArc
Left the new code in for reference
2024-08-17 08:28:08 -04:00
Frank
030a7cee53 another small speedup, and segment stability improvement
* removed a few sanity check that are done again later in getPixelColor
* stability: prevent crashes when changing segments settings or effect options
2024-08-16 17:54:11 +02:00
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