Fix WS2812 power control (#7090)

This commit is contained in:
Theo Arends 2019-12-02 18:54:08 +01:00
parent 744969d1fb
commit 621204e57f
2 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@
- Fix lost functionality of GPIO9 and GPIO10 on some devices (#7080)
- Fix Zigbee uses Hardware Serial if GPIO 1/3 or GPIO 13/15 and SerialLog 0 (#7071)
- Fix WS2812 power control (#7090)
- Change light color schemes 2, 3 and 4 from color wheel to Hue driven
## Released

View File

@ -1571,6 +1571,7 @@ void LightAnimate(void)
{
uint8_t cur_col[LST_MAX];
uint16_t light_still_on = 0;
bool power_off = false;
Light.strip_timer_counter++;
if (!Light.power) { // All channels powered off
@ -1578,6 +1579,9 @@ void LightAnimate(void)
if (!Light.fade_running) {
sleep = Settings.sleep;
}
if (Settings.light_scheme >= LS_MAX) {
power_off = true;
}
} else {
if (Settings.sleep > PWM_MAX_SLEEP) {
sleep = PWM_MAX_SLEEP; // set a maxumum value of 50 milliseconds to ensure that animations are smooth
@ -1629,7 +1633,7 @@ void LightAnimate(void)
}
}
if (Settings.light_scheme < LS_MAX) { // exclude WS281X Neopixel
if ((Settings.light_scheme < LS_MAX) || power_off) { // exclude WS281X Neopixel schemes
// Apply power modifiers to Light.new_color
LightApplyPower(Light.new_color, Light.power);
@ -1714,7 +1718,7 @@ void LightAnimate(void)
cur_col_10bits[i] = orig_col_10bits[Light.color_remap[i]];
}
if (!Settings.light_fade) { // no fade
if (!Settings.light_fade || power_off) { // no fade
// record the current value for a future Fade
memcpy(Light.fade_start_8, cur_col, sizeof(Light.fade_start_8));
memcpy(Light.fade_start_10, cur_col_10bits, sizeof(Light.fade_start_10));