Skip to content

Commit b64cd36

Browse files
committed
fixes trail flickering randomly. thx @blazoncek for discovering
1 parent 32a75c1 commit b64cd36

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

wled00/FX.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -2358,12 +2358,14 @@ uint16_t mode_meteor() {
23582358
for (unsigned i = 0; i < SEGLEN; i++) {
23592359
uint32_t col;
23602360
if (hw_random8() <= 255 - SEGMENT.intensity) {
2361-
if(meteorSmooth) {
2362-
int change = trail[i] + 4 - hw_random8(24); //change each time between -20 and +4
2363-
trail[i] = constrain(change, 0, max);
2364-
col = SEGMENT.check1 ? SEGMENT.color_from_palette(i, true, false, 0, trail[i]) : SEGMENT.color_from_palette(trail[i], false, true, 255);
2361+
if(meteorSmooth) {
2362+
if (trail[i] > 0) {
2363+
int change = trail[i] + 4 - hw_random8(24); //change each time between -20 and +4
2364+
trail[i] = constrain(change, 0, max);
23652365
}
2366-
else {
2366+
col = SEGMENT.check1 ? SEGMENT.color_from_palette(i, true, false, 0, trail[i]) : SEGMENT.color_from_palette(trail[i], false, true, 255);
2367+
}
2368+
else {
23672369
trail[i] = scale8(trail[i], 128 + hw_random8(127));
23682370
int index = trail[i];
23692371
int idx = 255;

0 commit comments

Comments
 (0)