diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index f55d35d28..4878def08 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -1450,6 +1450,10 @@ void CmndPwmfrequency(void) if ((1 == XdrvMailbox.payload) || ((XdrvMailbox.payload >= PWM_MIN) && (XdrvMailbox.payload <= PWM_MAX))) { Settings->pwm_frequency = (1 == XdrvMailbox.payload) ? PWM_FREQ : XdrvMailbox.payload; analogWriteFreq(Settings->pwm_frequency); // Default is 1000 (core_esp8266_wiring_pwm.c) +#ifdef USE_LIGHT + LightReapplyColor(); + LightAnimate(); +#endif // USE_LIGHT } ResponseCmndNumber(Settings->pwm_frequency); } diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index ff344df17..342e4fafa 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1656,6 +1656,13 @@ uint8_t LightGetSpeedSetting(void) { return Settings->light_speed; } +// Force to reapply color, for example when PWM Frequency changed +void LightReapplyColor(void) { + for (uint32_t i = 0; i < LST_MAX; i++) { + Light.last_color[i] = 0; + } +} + // On entry Light.new_color[5] contains the color to be displayed // and Light.last_color[5] the color currently displayed // Light.power tells which lights or channels (SetOption68) are on/off