Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This is a fix for issue #10038 (first LED in a WS2812 string flicks c… #10088

Merged
merged 1 commit into from
Dec 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions tasmota/xlgt_01_ws2812.ino
Original file line number Diff line number Diff line change
Expand Up @@ -304,22 +304,15 @@ void Ws2812Gradient(uint32_t schemenr)
WsColor oldColor, currentColor;
Ws2812GradientColor(schemenr, &oldColor, range, gradRange, offset);
currentColor = oldColor;
speed = speed ? speed : 1; // should never happen, just avoid div0
for (uint32_t i = 0; i < Settings.light_pixels; i++) {
if (kWsRepeat[Settings.light_width] > 1) {
Ws2812GradientColor(schemenr, &currentColor, range, gradRange, i +offset);
}
if (Settings.light_speed > 0) {
// Blend old and current color based on time for smooth movement.
c.R = map(Light.strip_timer_counter % speed, 0, speed, oldColor.red, currentColor.red);
c.G = map(Light.strip_timer_counter % speed, 0, speed, oldColor.green, currentColor.green);
c.B = map(Light.strip_timer_counter % speed, 0, speed, oldColor.blue, currentColor.blue);
}
else {
// No animation, just use the current color.
c.R = currentColor.red;
c.G = currentColor.green;
c.B = currentColor.blue;
Ws2812GradientColor(schemenr, &currentColor, range, gradRange, i + offset + 1);
}
// Blend old and current color based on time for smooth movement.
c.R = map(Light.strip_timer_counter % speed, 0, speed, oldColor.red, currentColor.red);
c.G = map(Light.strip_timer_counter % speed, 0, speed, oldColor.green, currentColor.green);
c.B = map(Light.strip_timer_counter % speed, 0, speed, oldColor.blue, currentColor.blue);
strip->SetPixelColor(i, c);
oldColor = currentColor;
}
Expand Down Expand Up @@ -586,4 +579,4 @@ bool Xlgt01(uint8_t function)
}

#endif // USE_WS2812
#endif // USE_LIGHT
#endif // USE_LIGHT