85 Commits

Author SHA1 Message Date
Blaž Kristan
d7be9c9a66 Address issues reported 2025-03-10 07:12:45 +01:00
Blaž Kristan
9bfd34e6b2 Rework color_from_palette()
- respect paletteBlend
- bugfix in ColorFromPaletteWLED()
2025-02-19 11:47:13 +01:00
Blaž Kristan
05cd7d753e Bugfix for color_blend 2025-02-19 11:26:51 +01:00
Blaž Kristan
a8cde3289a Minor speed & size tweaks
- new function fadeToSecondaryBy()
2025-02-19 11:13:52 +01:00
maxi4329
aa3fb7d165 update links to point to the new repo 2025-02-15 20:07:41 +01:00
Damian Schneider
e088f4654a removed unnecessary changes 2025-02-06 11:32:33 +01:00
Damian Schneider
b363b6151c revert using color_fade() as it is slower
- ran a few more tests, it is 30% faster like it was originally so reverting. The conversion to 32bit color appears to be wasteful in resources.
2025-02-06 11:32:33 +01:00
Damian Schneider
3baa4f8223 improved speed and fixed issue
- fixed issue: blending was also done when color was on a key-index-color which is now skipped
- speed improvement: conversion is skipped if color is key-color
2025-02-06 11:32: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
Damian Schneider
5f77478841
Replace PRNG with hardware RNG (#4225)
Both ESP8266 and ESP32 have a hardware random register. This update makes use of that. It is slightly faster than the fastled variants but mostly it is truly random, even when the timing limitations stated in the datasheet are disregarded. Also saves a bit on code size.

- Replaced all random8() and random16() calls with new hw_random() versions
- Not replaced in FX where PRNG is required
2024-12-20 19:12:29 +01:00
Damian Schneider
cae98451e3 Merge remote-tracking branch 'upstream/main' into 0_15__speed_improvements 2024-12-20 09:12:01 +01:00
Damian Schneider
26397ee8ad
Optimization: color_blend() (#4245)
Removing the bool saves on code size and makes the function a tiny bit faster. Also this is a cleaner solution IMHO.

-updated blend function to optimized 8bit calculation
- efficient color blend calculation in fews operations possible
- omitting min / max checks makes it faster on average
- using 8bit for "blend" variable does not significantly influence the resulting color, just transition points are slightly shifted but yield very good results (and better than the original 16bit version using the old fastled math with improper rounding)
- updated drawCircle and drawLine to use 8bit directly instead of 16bit with a shift
2024-12-19 18:20:56 +01:00
Blaž Kristan
be64930ebb Indentation and shadowed variable. 2024-10-07 16:50:51 +02:00
Blaz Kristan
ee380c5377 Replace uint16_t with unsigned for segment data
swap if statements in color_fade
2024-09-30 16:35:40 +02:00
Damian Schneider
7c0fe1285a updated setPixelColor() and getPixelColor() functions
uint16_t to unsigned to make it consisten throughout the hand-down.
colorFromPaletteWLED now returns uint32_t which saves the conversion to CRGB and back to uint32_t (in most uses at least).
also added (preliminary) CRGBW struct. I tried to use it in place of uint32_t colors but it adds a lot of overhead when passing the struct so reverted to uint32_t in most places.
updated a few FX to use the CRGBW struct and also cleaned some code to improve flash useage.
2024-09-28 15:26:14 +02:00
Damian Schneider
a76a895f1d bugfix 2024-09-27 06:17:26 +02:00
Damian Schneider
b404458369 fixed one forgotten replacement of rgb2hsv_approximate 2024-09-26 18:29:31 +02:00
Damian Schneider
bef1ac2668 Added HSV2RGB and RGB2HSV functions for higher accuracy conversions
- also added a struct to handle HSV with 16bit hue better (including some conversions, can be extended easily)
- the functions are optimized for speed and flash use. They are faster and more accurate than what fastled offers (and use much less flash).
- replaced colorHStoRGB() with a call to the new hsv2rgb() function, saving even more flash (new function is untested!)
- the 16bit hue calculations result in an almost perfect conversion from RGB to HSV and back, the maximum error was 1/255 in the cases I tested.
2024-09-26 18:06:41 +02:00
Blaz Kristan
906f8fc2e7 Fix C3 compiler issue. 2024-09-25 18:49:10 +02:00
Blaz Kristan
33cf82a982 Indentations and a few optimisations
Restore addPixelColor() behaviour.
2024-09-23 18:03:17 +02:00
Damian Schneider
a88436c620 revert removal of adding with saturation, renamed 'fast' to 'saturate'
- blurring now uses desaturated adding: it is faster most of the times and blurring adds scaled colors so should rarely (ever?) saturate, I saw no visual difference in tests.
- formatting
2024-09-19 08:49:18 +02:00
Damian Schneider
696290527a cleanup and improved color_add()
- optimized color_add() again: now it is as fast with preserved ratio scaling than the "fast" variant was before (if no scaling is needed, it is even faster). plus it saves 250 bytes of flash
- bugfix in `color_fade()`
- removed a lot of whitespaces
2024-09-18 22:10:27 +02:00
Damian Schneider
686866c6f9 Merge remote-tracking branch 'upstream/0_15' into 0_15__speed_improvements 2024-09-18 08:10:45 +02:00
Damian Schneider
0e5bd4ed74 remove test printout 2024-09-14 14:11:29 +02:00
Damian Schneider
6a37f25c5d memory improvement: dropped static gamma table
- there already is a method to calculate the table on the fly, there is no need to store it in flash, it can just be calculated at bootup (or cfg change)
2024-09-14 14:10:46 +02:00
Damian Schneider
d45b4ad134 fixes and consistency 2024-09-13 19:01:54 +02:00
Damian Schneider
ec938f254c removed old code 2024-09-12 21:25:08 +02:00
Damian Schneider
09428dcade inlined getMappedPixelIndex, improved color_add, bugfix in colorFromPalette
inlining getMappedPixelIndex gets rid of function entry instructions (hopefully) so it should be faster.
also added the 'multi color math' trick to color_add function (it will not make much difference but code shrinks by a few bytes)
2024-09-12 16:34:55 +02:00
Damian Schneider
b07658b460 improved Segment::setPixelColorXY a tiny bit
uses less flash so it should be faster (did not notice any FPS difference though)
also cleaned code in ColorFromPaletteWLED (it is not faster, same amount of code)
2024-09-12 14:09:09 +02:00
Blaž Kristan
23400d0449 Conditional IRAM for gamma 2024-09-12 08:30:46 +02:00
Damian Schneider
feac45fd0a improvement in color_add
its not faster but cleaner (and uses less flash)
2024-09-12 07:45:49 +02:00
Damian Schneider
934176818f more improvements to color_scale() now even faster.
tested and working, also tested video
2024-09-12 06:43:20 +02:00
Damian Schneider
c3f472fbcb some improvements to consider
no real difference in FPS but code is faster.
also 160bytes smaller, meaning it is actually faster
2024-09-11 21:41:42 +02:00
Blaz Kristan
eae5a74a11 color_fade bugfix
impure void remove
optimisations: hot
2024-09-11 17:14:59 +02:00
Blaz Kristan
e82f38e277 Tuning 2024-08-05 16:42:21 +02:00
Blaz Kristan
efa32ed4f6 Size optimisations 2024-07-09 21:50:27 +02:00
Blaz Kristan
693bf4816b Minor tweaks. 2024-06-30 10:44:25 +02:00
Damian Schneider
084fc2fcd1 bugfix & code formatting, removed color_scale
also replaced scale8_video with 32bit calculation in color_fade for consistency and speed.
2024-04-16 10:43:06 +02:00
Damian Schneider
459156fe57 added improvements to color scaling and blurring
-changes save roughly 600bytes of flash
-made blurring faster by not writing the color and then reading it back but keeping it as a variable: on a C3, FX black hole goes from 55FPS to 71FPS
-added optional parameter to blur (smear) that can be used in combination with SEGMENT.clear(), blurring the frame without dimming the current frame (repeated calls without clearing will result in white). this is useful to blur without 'motion blurring' being added
-scale8 is inlined and repeated calls uses flash, plus it is slower than native 32bit, so I added 'color_scale' function which is native 32bit and scales 32bit colors (RGBW).
2024-04-15 21:20:45 +02:00
Blaz Kristan
41e51bbeb5 Configuration item for harmonic palettes
Comment cleanup
2024-02-06 11:06:23 +01:00
Damian Schneider
e0f89beebb slight change to color parameters
added more white, changed function return value of fully random palette function
2024-02-01 20:06:48 +01:00
Damian Schneider
ca05aa84ff changed randomness and added optimizations
-added fully random palette function ('the old way', currently just used for initialization)
-changed randomness values to make it a little less random
-added 10% chance for pastel color palette
-now using swap() from std library for shuffeling
-changed function name
-moved update check from loadPalette() to handleRandomPalette() saving CPU cycles
2024-01-30 22:28:40 +01:00
Damian Schneider
2659055c31 fixed typos 2024-01-29 20:47:09 +01:00
Damian Schneider
f5ed757780 added some minor fixes
-fastled flags
-gamma correction
-pass by reference instead of pointer
2024-01-29 20:47:09 +01:00
Damian Schneider
a9bcc75733 added function to generate random palette based on harmonic color theory 2024-01-29 20:47:08 +01:00
Blaz Kristan
cc68e6b6e6 Squashed commit of the following:
Remove sync receive
Disallow 2D effects on non-2D segments
Optimisations
Sync clarification
AR palettes
Return of 2 audio simulations
Bugfix in sync #3344
    - remove excessive segments
    - ignore inactive segments if not syncing bounds
    - send UDP/WS on segment change
    - pop_back() when removing last segment
Add pairing support for ESP-NOW sync
Reduce string RAM footprint
UDP parse optimisation
Make WizMote work with sync.
ESP-NOW wireless sync POC.
    - caveat: devices have to be on the same channel
    - clashes with WizMote handling ATM
2023-09-10 18:52:14 +02:00
Blaz Kristan
3ca58ee65f Pin dropdowns POC.
NeoPixelBusGammaMethod POC.
PixelMagic POC.
Button reassign POC.
2023-06-10 20:43:27 +02:00
Blaz Kristan
11b687cdc2 Float vs. double. 2023-03-19 11:24:59 +01:00
Blaž Kristan
506b6b51ce whitespace cleanup 2023-01-06 09:24:29 +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