543 Commits

Author SHA1 Message Date
Blaž Kristan
aa2c4f8cd5 More tuning
- replaced POD new/delete with malloc/free
- some more SEGLEN <= 1
- some gnu::pure
- more const attributes
- some static attributes
2025-01-09 13:29:06 +01:00
Frank
5acbb85748 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-07 20:33:10 +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
07cc3aa5c0
FX improvements and cleanup (#4145)
Improvements & merges of FX

- Scrolling Text: Gradient Palette support added
- Waving Cell: Improved with higher temporal resolution (smoother at lower speeds) and added additional mode setting and optional blurring
- Julia: added blur option
- Squared Swirl: added fade option

- Added smearing option to:
    - DNA
    - DNA Spiral
    - Drift
    - Drift Rose
    - Crazy Bees
    - Ripple
    - Colored Bursts
    - Frizzles
    - Lissajous
    - Sindots
    - Spaceships

- Added palette support to:
    - Crazy Bees
    - Polar Lights
    - Drift Rose

- Changed default palette handling (no more special treatment for some FX)
- Merged puddles and puddlepeak
- Merged Gravcenter, Gravcentric, Gravfreq and Gravimeter (saves 1.2k of flash)
- Merged meteor and meteor smooth
- Renamed police_base into mode_two_dots as that was just an alias
- Added 'Traffic Light' palette (originally defined in Polar Lights FX)
-  Firenoise: removed local palette, use fire palette -> slight change in looks (+bugfix)
- Some code cleanup (removed unused / commented stuff)
- Moved dev info for AR to the top so ist easier to find as a reference, also added link to KB there
2024-12-20 14:13:53 +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
Damian Schneider
e57c701837 fix for repeating glitch
glitch appeared every 65s due to missing uint16_t overflow.
2024-12-19 09:21:57 +01:00
Damian Schneider
076497e14d Fix update for #4193 (twinkle fox & cat)
- previous fix worked but there was still an overflow after some time passed. there were still missing roll-overs apparently: reverting these two variables back to 16bit/8bit should fix it for good.
2024-12-05 06:54:30 +01:00
Damian Schneider
4902d7fb9e Fix for #4193 (twinkle fox & cat) 2024-12-04 17:10:44 +01:00
Frank
ae8c3b02d0
blends FX - hotfix for black pixels
fixing an off-by-one error to solve #4335
2024-12-02 21:35:48 +01:00
Damian Schneider
fa4c23b76e minor improvement 2024-11-27 22:23:48 +01:00
Damian Schneider
a0a46850f5 Merge remote-tracking branch 'upstream/0_15' into 0_15_trig_math 2024-11-27 22:22:50 +01:00
Damian Schneider
4cd0563a93 changed 90° offset to hex, fixed potential bug in FX using sin/cos with incrementing number
- sin/cos calls with incrementing numbers can lead to bad outcomes, the functions (_approx or original sinf/cosf) return bad values for very large float inputs
2024-11-27 21:53:32 +01:00
netmindz
b83f0f461c
Merge pull request #4263 from DedeHai/palette_FX_fix
fixed palette FX to more closely match original 1D version
2024-11-27 19:48:00 +00:00
Frank
5b989adebc
Allow TV Simulator on single LED segments
I've checked the code - nothing preventing the effect to run with SEGLEN=1
2024-11-25 15:27:53 +01:00
Damian Schneider
32dc54ce72 reverted rotation scale, offset only on static rotation, inverted shift direction
- inverting the shift direction in signed int is computationally safe as it is cast into an uint8_t and it matches the original FX in 1D
2024-11-22 08:43:45 +01:00
Will Miles
a765903a41 Fix array overflow in exploding_fireworks
Attempt to allocate enough room for the "minimum" sparks; and ensure
that we never overrun the allocated array size.

Fixes #4120
2024-11-16 17:10:30 -05:00
Damian Schneider
536444f9d1 fixed palette FX to more closely match original 1D version
- rotation scale is now exactly 180° (divide slider input by 255 instead of 256)
- removed shift offset: offset is now zero at slider 0, to hit 128 on touch input devices is really hard
- added a 90° shift to input rotation, enabling to rotate from 0 to 180° instead of +90 to -90 (which is not useful in 1D)
- changed default settings values to more closely match the old 1D effect
2024-11-09 16:38:18 +01:00
Blaž Kristan
5c2bac4b9d Merge branch '0_15' into 0_15__speed_improvements 2024-11-09 10:53:27 +01:00
Damian Schneider
2703c9899a Bugfix in FX ripple_base() 2024-10-27 15:08:25 +01:00
Christian Schwinne
e9d2182390
Re-license the WLED project from MIT to EUPL (#4194) 2024-10-16 00:07:19 +02:00
Damian Schneider
5e29f2c1b7 fixed atan2_t
approximation was incorrect, now doing it right.
also removed hypotf() from octopus, saving a little flash.
2024-10-15 20:11:33 +02:00
Damian Schneider
44e28f96e0 Fix for Octopus on ESP32 C3
Apparently the C3 can not convert negative floats to uint8_t directly, casting it into an int first fixes it.
2024-10-15 13:49:58 +02:00
Blaz Kristan
1b0ce9a123 Fix for #4179 2024-10-05 15:00:58 +02:00
Damian Schneider
7b855c851d Added integer based sin()/cos() functions, changed all trig functions to wled_math
- `sin16_t() / cos16_t()` are faster and more accurate than fastled versions
- `sin_approx() / cos_approx()` are float wrappers for `sin16_t() / cos16_t()` and are accurate enough to replace `sinf()/cosf()`
- `atan2()` is used only in octopus to calculate center offset, new approximated version saves flash
- `tan(), atan(), asin(), acos(), floor(), fmod()` are used only for sunrise/sunset calculation, using wled_math version saves flash
- `beatsinx()` replacements are to make use of new `sin16_t()/sin8_t()` functions to reduce flash size
- Extensively tested surnise/sunset calculation: deviation is 1min. max
- Tested some of the relevant FX and found no visual difference: Julia, 2D Drift, Drift Rose, Ghost rider, Rotozoomer, Palette, Arc 1D expansion
- total flash savings: 7.4k
2024-10-05 12:32:41 +02:00
Frank
402fba734a
bugfix for holes in 2D DNA Spiral
Holes were visible at height > 32. Root cause: "lerp8x8" seems to be inaccurate --> replaced by a simple linear calculation.
2024-10-02 16:34:36 +02:00
Frank
262af0678f
colored burst effect bugfix (swapped XY dimensions)
fixing a bug where width and height got swapped (visible on non-square panels)
2024-09-30 18:35:14 +02:00
Frank
3765d558b6
akemi bugfix fix
map2 --> map
2024-09-30 18:26:00 +02:00
Frank
4ed8ded502
Akemi bugfix for panel width > 32
due to a math accident, Akemi did not show proper GEQ bands in its hands when width>32
2024-09-30 17:44:38 +02:00
Damian Schneider
ffbc8c5f70 Reverting addition of bool unScale, added new improvements and fixes
- Added pre-calculation for segment brightness: stored in _segBri. The impact on FPS is not huge but measurable (~1-2FPS in my test conditions)
- Removed `bool unScaled` from `setPixelColor()` function again (it has no/minimal impact on speed but huge impact on flash usage: +850 bytes)
- Removed negative checking in `setPixelColorXY()` and replaced it with a local typecast to unsigned, saves a few instructions (tested and working)
- Changed int8_t to int in `moveX()` and `moveY()`
- Removed a few functions from IRAM as they are now not called for every pixel but only once per segment update
- Removed a `virtualWidth()` call from `ripple_base()`
- Bugfix in `mode_colortwinkle()`
2024-09-29 13:55:00 +02:00
Blaz Kristan
c842994df5 Pre-calculate virtual
- move SEGCOLOR() to Segment class
- add SEG_H, SEG_W macros
- try to speed up virtualXxxxx()
- compile warning fixes
2024-09-28 18:14:43 +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
Blaz Kristan
b50e6e0d90 Static PinManager & UsermodManager
- saves a few bytes of flash
2024-09-19 21:44:11 +02:00
Blaz Kristan
65a8dbfe41 FX: Usermod Temperature effect 2024-09-15 11:04:02 +02:00
Blaž Kristan
c35e82e59f
Merge branch '0_15' into pixel-dice-usermod 2024-08-18 13:20:45 +02:00
Blaž Kristan
8688777ae1
Merge pull request #4103 from netmindz/FX-cleanup
Remove repeating code to fetch audio data
2024-08-16 17:39:49 +02:00
Will Tatam
24ecf1a166 Move getAudioData to static 2024-08-15 17:58:19 +01:00
Will Tatam
e68375a71e Remove repeating code to fetch audio data 2024-08-15 09:08:57 +01:00
Blaz Kristan
cec67d8eff Const and 2D box blur
- added 2D blur
2024-08-14 22:15:48 +02:00
jdiamond
b73f049484 Clean up addEffect() changes. 2024-08-13 04:40:59 +00:00
Frank
db5e66a9b0 playing with Fire2012
* speedup: add functions to only blur rows or columns (50% faster)

* fire2012: tinkering with bur options. Vertical blur only when slider < 64 (faster); extra blur for  slider values >192 (bush burn)
2024-08-09 12:53:41 +02:00
jdiamond
96c7716d3e Added a usermod for interacting with BLE Pixels Dice. 2024-08-08 03:13:33 +00:00
Blaž Kristan
49976ae35a
Merge pull request #4078 from apanteleev/fire-blur-control
Add a parameter for blur amount in the Fire 2012 effect
2024-07-29 07:31:33 +02:00
Alexey Panteleev
0af1ec3bde Added a parameter for blur amount in the Fire 2012 effect. 2024-07-27 12:33:59 -07:00
Adrian Schröter
343d766ddd
2DGEQ: Getting same sized bar width on 32x32 display
before a x=32 (n times of 16) had not equal sized bars, but first was
a single pixel and later a bar had 3 pixel width. This solves it to
have always 2 pixel sized bars.

I have to admit that I did not test with other pixel dimensions.
2024-07-27 12:44:16 +02:00
Blaz Kristan
887254f5da Bugfixes
- LED memory calculation (not UI)
- potential fix for #4040
- compiler warning in FX
2024-07-07 14:18:51 +02:00
Blaz Kristan
5874b78349 Bugfixes
- FX: Breathe, Meteor
- IR: use Segment
- UI: palette search, LED settings
2024-07-05 21:22:05 +02:00
Blaz Kristan
693bf4816b Minor tweaks. 2024-06-30 10:44:25 +02:00
Blaz Kristan
f4475b9d2a Dynamic parallel I2S output
- update NeoPixelBus to v2.8.0
- use single/mono I2S + 4x RMT for 5 outputs or less
- use parallel x8 I2S + 8x RMT for >5 outputs (limit of 300 LEDs per output)
2024-06-12 18:00:00 +02:00
Blaz Kristan
25ade86994 Filter/sort bugfix 2024-06-04 17:05:11 +02:00