Skip to content

Commit d189258

Browse files
authored
MQTT fix on inverted shutter (#21663)
* MQTT fix on inverted shutter * MQTT fix on inverted shutter
1 parent 3537d18 commit d189258

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,12 +1868,10 @@ void CmndShutterPosition(void)
18681868
}
18691869

18701870
int8_t target_pos_percent = (XdrvMailbox.payload < 0) ? (XdrvMailbox.payload == -99 ? ShutterRealToPercentPosition(Shutter[index].real_position, index) : 0) : ((XdrvMailbox.payload > 100) ? 100 : XdrvMailbox.payload);
1871-
target_pos_percent = ((ShutterSettings.shutter_options[index] & 1) && ((SRC_MQTT != TasmotaGlobal.last_source) // 1
1872-
&& (SRC_SERIAL != TasmotaGlobal.last_source) // 6
1873-
&& (SRC_WEBGUI != TasmotaGlobal.last_source) // 7
1874-
&& (SRC_WEBCOMMAND != TasmotaGlobal.last_source) // 8
1875-
)) ? 100 - target_pos_percent : target_pos_percent;
1876-
1871+
target_pos_percent = ((ShutterSettings.shutter_options[index] & 1) && ( (SRC_SERIAL != TasmotaGlobal.last_source) // 6
1872+
&& (SRC_WEBGUI != TasmotaGlobal.last_source) // 7
1873+
&& (SRC_WEBCOMMAND != TasmotaGlobal.last_source) // 8
1874+
)) ? 100 - target_pos_percent : target_pos_percent;
18771875
// if position is either 0 or 100 reset the tilt to avoid tilt moving at the end
18781876
if (target_pos_percent == 0 && ShutterRealToPercentPosition(Shutter[index].real_position, index) > 0 ) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[4];}
18791877
if (target_pos_percent == 100 && ShutterRealToPercentPosition(Shutter[index].real_position, index) < 100) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[3];}

tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,11 +1332,10 @@ void CmndShutterPosition(void)
13321332
}
13331333

13341334
int8_t target_pos_percent = (XdrvMailbox.payload < 0) ? (XdrvMailbox.payload == -99 ? ShutterRealToPercentPosition(Shutter[index].real_position, index) : 0) : ((XdrvMailbox.payload > 100) ? 100 : XdrvMailbox.payload);
1335-
target_pos_percent = ((Settings->shutter_options[index] & 1) && ((SRC_MQTT != TasmotaGlobal.last_source)
1336-
&& (SRC_SERIAL != TasmotaGlobal.last_source)
1337-
&& (SRC_WEBGUI != TasmotaGlobal.last_source)
1338-
&& (SRC_WEBCOMMAND != TasmotaGlobal.last_source)
1339-
)) ? 100 - target_pos_percent : target_pos_percent;
1335+
target_pos_percent = ((Settings->shutter_options[index] & 1) && ( (SRC_SERIAL != TasmotaGlobal.last_source)
1336+
&& (SRC_WEBGUI != TasmotaGlobal.last_source)
1337+
&& (SRC_WEBCOMMAND != TasmotaGlobal.last_source)
1338+
)) ? 100 - target_pos_percent : target_pos_percent;
13401339

13411340
// if position is either 0 or 100 reset the tilt to avoid tilt moving at the end
13421341
if (target_pos_percent == 0 && ShutterRealToPercentPosition(Shutter[index].real_position, index) > 0 ) {Shutter[index].tilt_target_pos = Shutter[index].tilt_config[4];}

0 commit comments

Comments
 (0)