From 076497e14da2fc268f8424809dfc3479f2dda235 Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Thu, 5 Dec 2024 06:49:17 +0100 Subject: [PATCH] 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. --- wled00/FX.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 76df81d2c..fd2118fd0 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -2566,10 +2566,10 @@ static CRGB twinklefox_one_twinkle(uint32_t ms, uint8_t salt, bool cat) // Overall twinkle speed (changed) unsigned ticks = ms / SEGENV.aux0; unsigned fastcycle8 = uint8_t(ticks); - unsigned slowcycle16 = uint16_t((ticks >> 8) + salt); + uint16_t slowcycle16 = (ticks >> 8) + salt; slowcycle16 += sin8_t(slowcycle16); slowcycle16 = (slowcycle16 * 2053) + 1384; - unsigned slowcycle8 = (slowcycle16 & 0xFF) + (slowcycle16 >> 8); + uint8_t slowcycle8 = (slowcycle16 & 0xFF) + (slowcycle16 >> 8); // Overall twinkle density. // 0 (NONE lit) to 8 (ALL lit at once).