From f18dced2f34645b7b99da4071bf12a823868dd6a Mon Sep 17 00:00:00 2001 From: fishbone-git Date: Mon, 5 Apr 2021 16:08:35 +0200 Subject: [PATCH] use constrain to keep in segment limits --- wled00/FX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index f6509e5..eec9192 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -3108,7 +3108,7 @@ uint16_t WS2812FX::mode_drip(void) drops[j].vel += gravity; for (uint16_t i=1;i<7-drops[j].colIndex;i++) { // some minor math so we don't expand bouncing droplets - uint16_t pos = uint16_t(drops[j].pos) +i; //this is BAD, returns a pos >= SEGLEN occasionally + uint16_t pos = constrain(uint16_t(drops[j].pos) +i, 0, SEGLEN-1); //this is BAD, returns a pos >= SEGLEN occasionally setPixelColor(pos,color_blend(BLACK,SEGCOLOR(0),drops[j].col/i)); //spread pixel with fade while falling }