From fa6e2175fe059a2dd4a32d2e7b99a3b4fe054ea8 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Wed, 29 Nov 2023 13:33:10 +0100 Subject: [PATCH] Remove re-seeding FastLED random8/random16 in FX --- wled00/FX.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index c26cf3b8..940fae6e 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -4087,6 +4087,7 @@ static const char _data_FX_MODE_PHASEDNOISE[] PROGMEM = "Phased Noise@!,!;!,!;!" uint16_t mode_twinkleup(void) { // A very short twinkle routine with fade-in and dual controls. By Andrew Tuline. + uint16_t prevSeed = random16_get_seed(); // save seed so we can restore it at the end of the function random16_set_seed(535); // The randomizer needs to be re-set each time through the loop in order for the same 'random' numbers to be the same each time through. for (int i = 0; i < SEGLEN; i++) { @@ -4096,6 +4097,7 @@ uint16_t mode_twinkleup(void) { // A very short twinkle routine SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(random8()+strip.now/100, false, PALETTE_SOLID_WRAP, 0), pixBri)); } + random16_set_seed(prevSeed); // restore original seed so other effects can use "random" PRNG return FRAMETIME; } static const char _data_FX_MODE_TWINKLEUP[] PROGMEM = "Twinkleup@!,Intensity;!,!;!;;m12=0";