Skip to content

Commit

Permalink
Fix update for #4193 (twinkle fox & cat)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
DedeHai committed Dec 5, 2024
1 parent e8d9891 commit 076497e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit 076497e

Please sign in to comment.