mirror of https://github.com/arendst/Tasmota.git
Merge pull request #10088 from vic42/prepare_pr
This is a fix for issue #10038 (first LED in a WS2812 string flicks c…
This commit is contained in:
commit
2fcc8589f3
|
@ -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, ¤tColor, 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, ¤tColor, 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;
|
||||
}
|
||||
|
@ -586,4 +579,4 @@ bool Xlgt01(uint8_t function)
|
|||
}
|
||||
|
||||
#endif // USE_WS2812
|
||||
#endif // USE_LIGHT
|
||||
#endif // USE_LIGHT
|
||||
|
|
Loading…
Reference in New Issue