From ac6d0d864611a4b4cd86fe6ef54669fc3308551b Mon Sep 17 00:00:00 2001 From: clienthax <clienthax@gmail.com> Date: Sun, 22 Nov 2020 17:55:51 +0000 Subject: [PATCH] Fix randomDots. #68 Previously the while would trip the watchdog. --- esp8266-fastled-iot-webserver.ino | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/esp8266-fastled-iot-webserver.ino b/esp8266-fastled-iot-webserver.ino index d43770f..ce719f0 100644 --- a/esp8266-fastled-iot-webserver.ino +++ b/esp8266-fastled-iot-webserver.ino @@ -516,7 +516,7 @@ PatternAndNameList patterns = { { rainbowBeat, "Rainbow Beat" }, { randomPaletteFades, "Palette Fades" }, { rainbowChase, "Rainbow Chase" }, - //{ randomDots, "Rainbow Dots" }, // disabled see issue 68# + { randomDots, "Rainbow Dots" }, { randomFades, "Rainbow Fades" }, { policeLights, "Police Lights" }, { glitter, "Glitter" }, @@ -1983,12 +1983,12 @@ void rainbowChase() void randomDots() // Similar to randomFades(), colors flash on/off quickly { uint16_t pos; - do + pos = random16(0, (NUM_LEDS - 1)); + if (CRGB(0, 0, 0) == CRGB(leds[pos])) { - pos = random16(0, (NUM_LEDS - 1)); - } while (CRGB(0, 0, 0) != CRGB(leds[pos])); + leds[pos] = CHSV((random8() % 256), 200, 255); + } fadeToBlackBy(leds, NUM_LEDS, 64); - leds[pos] = CHSV((random8() % 256), 200, 255); } // Same as randomPaletteFades() but with completely random colors -- GitLab