From 59fd20097c3f5d07154038fc5d9de65d31913d8e Mon Sep 17 00:00:00 2001 From: stefanbode Date: Sun, 7 Aug 2022 18:32:23 +0200 Subject: [PATCH] Enhance behavior of tilt changes at end points 0% and 100% #15974 mentioned there is unexpected behavior when direction changes and end points are not left. --- tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino index 1cc517940..153a54f38 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino @@ -980,6 +980,10 @@ void ShutterButtonHandler(void) XdrvMailbox.payload = XdrvMailbox.index; CmndShutterToggle(); } else { + if (position == ShutterRealToPercentPosition(Shutter[XdrvMailbox.index-1].real_position, XdrvMailbox.index-1) ) { + Shutter[XdrvMailbox.index -1].tilt_target_pos = position==0? Shutter[XdrvMailbox.index -1].tilt_config[0]:(position==100?Shutter[XdrvMailbox.index -1].tilt_config[1]:Shutter[XdrvMailbox.index -1].tilt_target_pos); + //AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d -> Endpoint movement detected at %d. Set Tilt: %d"), shutter_index+1, position, Shutter[XdrvMailbox.index -1].tilt_target_pos); + } CmndShutterPosition(); } if (Settings->shutter_button[button_index] & ((0x01<<26)<