From 62b213897f475c7444e6c989ab23b96ba461368f Mon Sep 17 00:00:00 2001 From: Hadinger Date: Wed, 20 Nov 2019 21:08:35 +0100 Subject: [PATCH 1/2] Fix Wifi instability when light is on, due to sleep=0 (#6961, #6608) --- tasmota/_changelog.ino | 1 + tasmota/tasmota.h | 1 - tasmota/xdrv_04_light.ino | 10 +++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tasmota/_changelog.ino b/tasmota/_changelog.ino index 19867ebf8..5c60f17a5 100644 --- a/tasmota/_changelog.ino +++ b/tasmota/_changelog.ino @@ -3,6 +3,7 @@ * Fix boot loop regression * Add command TempOffset -12.6 .. 12.6 to set global temperature sensor offset (#6958) * Fix check deepsleep for valid values in Settings (#6961) + * Fix Wifi instability when light is on, due to sleep=0 (#6961, #6608) * * 7.0.0.4 20191108 * Add command WifiPower 0 .. 20.5 to set Wifi Output Power which will be default set to 17dBm diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h index cbacfbff2..d9e55bd15 100644 --- a/tasmota/tasmota.h +++ b/tasmota/tasmota.h @@ -100,7 +100,6 @@ const uint16_t PWM_MAX = 4000; // [PWM_MAX] Maximum frequency - Def const uint16_t PWM_MIN = 100; // [PWM_MIN] Minimum frequency - Default: 100 // For Dimmers use double of your mains AC frequecy (100 for 50Hz and 120 for 60Hz) // For Controlling Servos use 50 and also set PWM_FREQ as 50 (DO NOT USE THESE VALUES FOR DIMMERS) -//#define PWM_LIGHTSCHEME0_IGNORE_SLEEP // Do not change sleep value for LightAnimate() scheme 0 const uint16_t MAX_POWER_HOLD = 10; // Time in SECONDS to allow max agreed power const uint16_t MAX_POWER_WINDOW = 30; // Time in SECONDS to disable allow max agreed power diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index c6f6b3e33..d83120217 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1617,11 +1617,11 @@ void LightAnimate(void) } } else { -#ifdef PWM_LIGHTSCHEME0_IGNORE_SLEEP - sleep = (LS_POWER == Settings.light_scheme) ? Settings.sleep : 0; // If no animation then use sleep as is -#else - sleep = 0; -#endif // PWM_LIGHTSCHEME0_IGNORE_SLEEP + if (Settings.sleep > 50) { + sleep = 50; // set a minimal value of 50 milliseconds to ensure that animations are smooth + } else { + sleep = Settings.sleep; // or keep the current sleep if it's lower than 50 + } switch (Settings.light_scheme) { case LS_POWER: light_controller.calcLevels(); From d92dd18affa01dff00a99272f8022665bec881d9 Mon Sep 17 00:00:00 2001 From: Hadinger Date: Wed, 20 Nov 2019 22:33:35 +0100 Subject: [PATCH 2/2] Change minimum sleep to 10 milliseconds --- tasmota/xdrv_04_light.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index d83120217..b45be6523 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1617,8 +1617,8 @@ void LightAnimate(void) } } else { - if (Settings.sleep > 50) { - sleep = 50; // set a minimal value of 50 milliseconds to ensure that animations are smooth + if (Settings.sleep > 10) { + sleep = 10; // set a minimal value of 50 milliseconds to ensure that animations are smooth } else { sleep = Settings.sleep; // or keep the current sleep if it's lower than 50 }