diff --git a/sonoff/core_esp8266_wiring_pwm.c b/sonoff/core_esp8266_wiring_pwm.c index d7e179b9b..8bd24815c 100644 --- a/sonoff/core_esp8266_wiring_pwm.c +++ b/sonoff/core_esp8266_wiring_pwm.c @@ -191,6 +191,11 @@ extern void __analogWrite(uint8_t pin, int value) prep_pwm_steps(); return; } + if(value == pwm_range) { + digitalWrite(pin, HIGH); + prep_pwm_steps(); + return; + } if((pwm_mask & (1 << pin)) == 0) { if(pwm_mask == 0) { memset(&_pwm_isr_data, 0, sizeof(_pwm_isr_data)); diff --git a/sonoff/xdrv_04_light.ino b/sonoff/xdrv_04_light.ino index bdcb94619..898079762 100644 --- a/sonoff/xdrv_04_light.ino +++ b/sonoff/xdrv_04_light.ino @@ -1640,7 +1640,7 @@ void LightAnimate(void) if (light_type < LT_PWM6) { // only for direct PWM lights, not for Tuya, Armtronix... for (uint8_t i = 0; i < light_subtype; i++) { if (pin[GPIO_PWM1 +i] < 99) { - if ((cur_col_10bits[i] > 1008) && (cur_col_10bits[i] < 1023) { + if ((cur_col_10bits[i] > 1008) && (cur_col_10bits[i] < 1023)) { cur_col_10bits[i] = 1008; // Fix unwanted blinking and PWM watchdog errors for values close to pwm_range (H801, Arilux and BN-SZ01) // if (cur_col_10bits[i] > 0xFC*4) { // cur_col_10bits[i] = 0xFC*4; // Fix unwanted blinking and PWM watchdog errors for values close to pwm_range (H801, Arilux and BN-SZ01)