From 3487c4969a8daabc082aabd2d032264a86998720 Mon Sep 17 00:00:00 2001 From: stefanbode Date: Tue, 15 Dec 2020 12:40:47 +0100 Subject: [PATCH 1/2] optimize switch off time Detailed analysis of where time is used during stop and optimize stop. --- tasmota/xdrv_27_shutter.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/xdrv_27_shutter.ino b/tasmota/xdrv_27_shutter.ino index d20c7700a..1937ff348 100644 --- a/tasmota/xdrv_27_shutter.ino +++ b/tasmota/xdrv_27_shutter.ino @@ -616,7 +616,7 @@ void ShutterRelayChanged(void) break; default: TasmotaGlobal.last_source = SRC_SHUTTER; // avoid switch off in the next loop - if (Shutter[i].direction != 0 ) ShutterUpdatePosition(); + if (Shutter[i].direction != 0 ) Shutter[i].target_position = Shutter[i].real_position; } switch (ShutterGlobal.position_mode) { // enum Shutterposition_mode {SHT_TIME, SHT_TIME_UP_DOWN, SHT_TIME_GARAGE, SHT_COUNTER, SHT_PWM_VALUE, SHT_PWM_TIME,}; @@ -983,7 +983,7 @@ void CmndShutterStop(void) AddLog_P(LOG_LEVEL_DEBUG, PSTR("SHT: Stop moving %d: dir: %d"), XdrvMailbox.index, Shutter[i].direction); int32_t temp_realpos = ShutterCalculatePosition(i); - XdrvMailbox.payload = ShutterRealToPercentPosition(temp_realpos, i); + XdrvMailbox.payload = ShutterRealToPercentPosition(temp_realpos, i)-Shutter[i].direction; TasmotaGlobal.last_source = SRC_WEBGUI; CmndShutterPosition(); } else { From 79c3d625f5e07ff52ac0f1bf080ced4194f34096 Mon Sep 17 00:00:00 2001 From: stefanbode Date: Tue, 15 Dec 2020 12:44:49 +0100 Subject: [PATCH 2/2] Correct Pulsetime error to switch same relay two times --- tasmota/xdrv_27_shutter.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xdrv_27_shutter.ino b/tasmota/xdrv_27_shutter.ino index 1937ff348..9b8df0762 100644 --- a/tasmota/xdrv_27_shutter.ino +++ b/tasmota/xdrv_27_shutter.ino @@ -445,7 +445,7 @@ void ShutterPowerOff(uint8_t i) { if ((SRC_PULSETIMER == TasmotaGlobal.last_source || SRC_SHUTTER == TasmotaGlobal.last_source || SRC_WEBGUI == TasmotaGlobal.last_source)) { ExecuteCommandPowerShutter(cur_relay, 1, SRC_SHUTTER); // switch off direction relay to make it power less - if ((1 << (Settings.shutter_startrelay[i])) & TasmotaGlobal.power) { + if (((1 << (Settings.shutter_startrelay[i])) & TasmotaGlobal.power) && Settings.shutter_startrelay[i]+1 != cur_relay) { ExecuteCommandPowerShutter(Settings.shutter_startrelay[i]+1, 0, SRC_SHUTTER); } } else {