post-merge fixes

* fx.cpp: replace FastLED inoise() with optimized perlin() functions
* minor updates for util.cpp and fcn_declare.h
This commit is contained in:
Frank
2025-12-16 00:28:10 +01:00
parent fe574aef91
commit cdd1141867
3 changed files with 56 additions and 47 deletions

View File

@@ -625,7 +625,7 @@ CRGB getCRGBForBand(int x, uint8_t *fftResult, int pal) {
uint8_t get_random_wheel_index(uint8_t pos) {
uint8_t r = 0, x = 0, y = 0, d = 0;
while (d < 42) {
r = random8();
r = hw_random8();
x = abs(pos - r);
y = 255 - x;
d = MIN(x, y);
@@ -633,6 +633,19 @@ uint8_t get_random_wheel_index(uint8_t pos) {
return r;
}
// float version of map() - WLEDMM not used
//float mapf(float x, float in_min, float in_max, float out_min, float out_max) {
// return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
//}
//uint32_t hashInt(uint32_t s) { // WLEDMM not used
// // borrowed from https://stackoverflow.com/questions/664014/what-integer-hash-function-are-good-that-accepts-an-integer-hash-key
// s = ((s >> 16) ^ s) * 0x45d9f3b;
// s = ((s >> 16) ^ s) * 0x45d9f3b;
// return (s >> 16) ^ s;
//}
// WLEDMM extended "trim string" function to support enumerateLedmaps
// The function takes char* as input, and removes all leading and trailing "decorations" like spaces, tabs, line endings, quotes, colons
// The conversion is "in place" (destructive).
@@ -662,6 +675,7 @@ char *cleanUpName(char *in) {
return(in);
}
// 32 bit hardware random number generator, inlining uses more code, use hw_random16() if speed is critical (see fcn_declare.h)
uint32_t hw_random(uint32_t upperlimit) {
uint32_t rnd = hw_random();