From 73ca612cbbe11a4d34dcd7f14191ee946790300b Mon Sep 17 00:00:00 2001 From: Bob Loeffler Date: Fri, 3 Apr 2026 01:11:53 -0700 Subject: [PATCH 1/4] Minor changes to bring it up to the latest version on github --- usermods/user_fx/user_fx.cpp | 38 +++++++++++++++++------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/usermods/user_fx/user_fx.cpp b/usermods/user_fx/user_fx.cpp index 2258b8ad4f..719bd433dc 100644 --- a/usermods/user_fx/user_fx.cpp +++ b/usermods/user_fx/user_fx.cpp @@ -117,7 +117,7 @@ static const char _data_FX_MODE_DIFFUSIONFIRE[] PROGMEM = "Diffusion Fire@!,Spar static void mode_spinning_wheel(void) { if (SEGLEN < 1) FX_FALLBACK_STATIC; - + unsigned strips = SEGMENT.nrOfVStrips(); if (strips == 0) FX_FALLBACK_STATIC; @@ -148,7 +148,6 @@ static void mode_spinning_wheel(void) { // Handle random seeding globally (outside the virtual strip) if (SEGENV.call == 0) { - random16_set_seed(hw_random16()); SEGENV.aux1 = (255 << 8) / SEGLEN; // Cache the color scaling } @@ -156,7 +155,6 @@ static void mode_spinning_wheel(void) { uint32_t settingssum = SEGMENT.speed + SEGMENT.intensity + SEGMENT.custom1 + SEGMENT.custom3 + SEGMENT.check1 + SEGMENT.check3; bool settingsChanged = (SEGENV.aux0 != settingssum); if (settingsChanged) { - random16_add_entropy(hw_random16()); SEGENV.aux0 = settingssum; } @@ -166,7 +164,7 @@ static void mode_spinning_wheel(void) { uint8_t spinnerSize = map(SEGMENT.custom1, 0, 255, 1, 10); uint16_t spin_delay = map(SEGMENT.custom3, 0, 31, 2000, 15000); uint32_t now = strip.now; - + for (unsigned stripNr = 0; stripNr < strips; stripNr += spinnerSize) { uint32_t* stripState = &state[stripNr * stateVarsPerStrip]; // Check if this spinner is stopped AND has waited its delay @@ -181,7 +179,7 @@ static void mode_spinning_wheel(void) { } } } - + struct virtualStrip { static void runStrip(uint16_t stripNr, uint32_t* state, bool settingsChanged, bool allReadyToRestart, unsigned strips) { uint8_t phase = state[PHASE_IDX]; @@ -211,23 +209,23 @@ static void mode_spinning_wheel(void) { // Initialize or restart if (needsReset && SEGMENT.check1) { // spin the spinner(s) only if the "Spin me!" checkbox is enabled state[CUR_POS_IDX] = 0; - + // Set velocity uint16_t speed = map(SEGMENT.speed, 0, 255, 300, 800); if (speed == 300) { // random speed (user selected 0 on speed slider) - state[VELOCITY_IDX] = random16(200, 900) * 655; // fixed-point velocity scaling (approx. 65536/100) + state[VELOCITY_IDX] = hw_random16(200, 900) * 655; // fixed-point velocity scaling (approx. 65536/100) } else { - state[VELOCITY_IDX] = random16(speed - 100, speed + 100) * 655; + state[VELOCITY_IDX] = hw_random16(speed - 100, speed + 100) * 655; } - + // Set slowdown start time uint16_t slowdown = map(SEGMENT.intensity, 0, 255, 3000, 5000); if (slowdown == 3000) { // random slowdown start time (user selected 0 on intensity slider) - state[SLOWDOWN_TIME_IDX] = now + random16(2000, 6000); + state[SLOWDOWN_TIME_IDX] = now + hw_random16(2000, 6000); } else { - state[SLOWDOWN_TIME_IDX] = now + random16(slowdown - 1000, slowdown + 1000); + state[SLOWDOWN_TIME_IDX] = now + hw_random16(slowdown - 1000, slowdown + 1000); } - + state[PHASE_IDX] = 0; state[STOP_TIME_IDX] = 0; state[WOBBLE_STEP_IDX] = 0; @@ -238,7 +236,7 @@ static void mode_spinning_wheel(void) { uint32_t pos_fixed = state[CUR_POS_IDX]; uint32_t velocity = state[VELOCITY_IDX]; - + // Phase management if (phase == 0) { // Fast spinning phase @@ -250,10 +248,10 @@ static void mode_spinning_wheel(void) { // Slowing phase - apply deceleration uint32_t decel = velocity / 80; if (decel < 100) decel = 100; - + velocity = (velocity > decel) ? velocity - decel : 0; state[VELOCITY_IDX] = velocity; - + // Check if stopped if (velocity < 2000) { velocity = 0; @@ -270,7 +268,7 @@ static void mode_spinning_wheel(void) { uint32_t wobble_step = state[WOBBLE_STEP_IDX]; uint16_t stop_pos = state[STOP_POS_IDX]; uint32_t elapsed = now - state[WOBBLE_TIME_IDX]; - + if (wobble_step == 0 && elapsed >= 200) { // Move back one LED from stop position uint16_t back_pos = (stop_pos == 0) ? SEGLEN - 1 : stop_pos - 1; @@ -291,13 +289,13 @@ static void mode_spinning_wheel(void) { state[STOP_TIME_IDX] = now; } } - + // Update position (phases 0 and 1 only) if (phase == 0 || phase == 1) { pos_fixed += velocity; state[CUR_POS_IDX] = pos_fixed; } - + // Draw LED for all phases uint16_t pos = (pos_fixed >> 16) % SEGLEN; @@ -314,14 +312,14 @@ static void mode_spinning_wheel(void) { hue = (SEGENV.aux1 * pos) >> 8; } - uint32_t color = ColorFromPaletteWLED(SEGPALETTE, hue, 255, LINEARBLEND); + uint32_t color = ColorFromPalette(SEGPALETTE, hue, 255, LINEARBLEND); // Draw the spinner with configurable size (1-10 LEDs) for (int8_t x = 0; x < spinnerSize; x++) { for (uint8_t y = 0; y < spinnerSize; y++) { uint16_t drawPos = (pos + y) % SEGLEN; int16_t drawStrip = stripNr + x; - + // Wrap horizontally if needed, or skip if out of bounds if (drawStrip >= 0 && drawStrip < strips) { SEGMENT.setPixelColor(indexToVStrip(drawPos, drawStrip), color); From 549cde0cfbe9cdc34920db6e0251e486aaeef6dc Mon Sep 17 00:00:00 2001 From: Bob Loeffler Date: Fri, 24 Apr 2026 01:51:32 -0700 Subject: [PATCH 2/4] Expose loadPalette() by moving from Protected section to Public section --- wled00/FX.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wled00/FX.h b/wled00/FX.h index 9fd3a04d8a..ef1c49b924 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -541,7 +541,6 @@ class Segment { inline uint32_t getPixelColorXYRaw(unsigned x, unsigned y) const { auto XY = [](unsigned X, unsigned Y){ return X + Y*Segment::vWidth(); }; return pixels[XY(x,y)]; }; #endif void resetIfRequired(); // sets all SEGENV variables to 0 and clears data buffer - void loadPalette(CRGBPalette16 &tgt, uint8_t pal); // transition functions void stopTransition(); // ends transition mode by destroying transition structure (does nothing if not in transition) @@ -654,6 +653,8 @@ class Segment { inline static uint32_t getCurrentColor(unsigned i) { return Segment::_currentColors[i Date: Sat, 25 Apr 2026 01:51:19 -0700 Subject: [PATCH 3/4] Moved loadPalette() line up one line --- wled00/FX.h | 1 - 1 file changed, 1 deletion(-) diff --git a/wled00/FX.h b/wled00/FX.h index ef1c49b924..3e57b665b0 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -652,7 +652,6 @@ class Segment { inline static unsigned vHeight() { return Segment::_vHeight; } inline static uint32_t getCurrentColor(unsigned i) { return Segment::_currentColors[i Date: Sat, 25 Apr 2026 01:54:35 -0700 Subject: [PATCH 4/4] Reverted 2 blank lines/spaces back to the way they were --- usermods/user_fx/user_fx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usermods/user_fx/user_fx.cpp b/usermods/user_fx/user_fx.cpp index 9827fc4116..cf7a651db6 100644 --- a/usermods/user_fx/user_fx.cpp +++ b/usermods/user_fx/user_fx.cpp @@ -179,7 +179,7 @@ static void mode_spinning_wheel(void) { } } } - + struct virtualStrip { static void runStrip(uint16_t stripNr, uint32_t* state, bool settingsChanged, bool allReadyToRestart, unsigned strips) { uint8_t phase = state[PHASE_IDX]; @@ -236,7 +236,7 @@ static void mode_spinning_wheel(void) { uint32_t pos_fixed = state[CUR_POS_IDX]; uint32_t velocity = state[VELOCITY_IDX]; - + // Phase management if (phase == 0) { // Fast spinning phase