Commit Graph

10 Commits

Author SHA1 Message Date
Frank
d987206d3b make wled_math functions IRAM_ATTR (faster) 2026-01-17 13:56:29 +01:00
Damian Schneider
532c9b762c replacement for fastled sqrt16() (#4426)
* added bitwise operation based sqrt16

- replacement for fastled, it is about 10% slower for numbers smaller 128 but faster for larger numbers. speed difference is irrelevant to WLED but it saves some flash.

* updated to 32bit, improved for typical WLED use

- making it 32bits allows for larger numbers
- added another initial condition check for medium sized numbers
- increased the "small number" optimization to larger numbers: the function is currently only used to calculate sqrt(x^2+y^2) which even for small segments is larger than the initially used 64, so optimizing for 1024 makes more sense, although the value is arbitrarily chosen
2026-01-17 12:18:35 +01:00
Frank
bc7cf062e8 effect math sppedup - up to 3x faster
-> distortion waves 3x speedup
-> hiphotic 2x speedup
-> waving cell 1.5x speedup

* replace sin8_t by lookup-table with pre-computed values
* moved integer sin and cos to fcn_declare.h (inlined by the compiler)
* moved gamma32 to fcn_declare.h (inlined by the compiler)
* a few other small tweaks
2025-12-17 21:59:22 +01:00
Frank
384cbec86e desperate attempt for 8266 survival
* bring back UREAL_MATH (inaccuate, but smaller flash)
* typing to tune feature sets so they fit into small 8266 models
2025-11-24 15:50:04 +01:00
Damian Schneider
e914417c74 Merge pull request #4181 from DedeHai/0_15_trig_math
Added integer based `sin()/cos()` functions, changed all trig functions to wled_math
2024-11-29 00:23:43 +01:00
Frank
0fcbefb7a5 fixing a few implicit promotions to double
any expression with at least on "double" is evaluated as double, which is slow.
2023-09-17 19:11:31 +02:00
Blaž Kristan
506b6b51ce whitespace cleanup 2023-01-06 09:24:29 +01:00
Blaz Kristan
c14f16bdf1 Merge branch 'master' into master-merge 2022-03-19 21:05:28 +01:00
Blaz Kristan
d4ea30e081 Merge branch 'master' into merge-master 2022-02-10 14:16:55 +01:00
Blaž Kristan
5714578783 Refactoring & code clean-up.
- utility functions
- network functions
- math functions
2021-10-11 14:13:34 +02:00