From 35475d9353930f251a32bc89b01d3ce944920082 Mon Sep 17 00:00:00 2001 From: stefanbode Date: Tue, 6 Dec 2022 16:27:34 +0100 Subject: [PATCH] Avoid ghost switching in position 0 and 100 confirming the position and setting the tilt in 0 and 100% causes ghost switching of the relays. #16435 --- tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino index 030f0927c..20971efe0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino @@ -1212,8 +1212,8 @@ void CmndShutterPosition(void) } // if position is either 0 or 100 reset the tilt to avoid tilt moving at the end - if (XdrvMailbox.payload == 0) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[4];} - if (XdrvMailbox.payload == 100) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[3];} + if (XdrvMailbox.payload == 0 && ShutterRealToPercentPosition(Shutter[index].real_position, index) > 0 ) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[4];} + if (XdrvMailbox.payload == 100 && ShutterRealToPercentPosition(Shutter[index].real_position, index) < 100) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[3];} int8_t target_pos_percent = (XdrvMailbox.payload < 0) ? (XdrvMailbox.payload == -99 ? ShutterRealToPercentPosition(Shutter[index].real_position, index) : 0) : ((XdrvMailbox.payload > 100) ? 100 : XdrvMailbox.payload); // webgui still send also on inverted shutter the native position.