Skip to content

Commit

Permalink
Change shutterbutton hold behavior with grouptopic (#19263)
Browse files Browse the repository at this point in the history
* skip stop on hold if grouptopic

If shutterbutton is defined with a grouptopic send on HOLD, there is no stop on releasing the button. All shutters will move to defined position

* do not stop on hold release if group submitt

If mqtt broadcast is defined on hold then release the hold button will not anymore stop the local shutter. All shutter will move to defined position
  • Loading branch information
stefanbode committed Aug 5, 2023
1 parent 7c3c385 commit 959d105
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,8 @@ bool ShutterButtonHandler(void)
// handle on button release: start shutter on shortpress and stop running shutter after longpress.
if (NOT_PRESSED == button
&& Shutter[shutter_index].direction != 0 // only act on shutters activly moving
&& Button.hold_timer[button_index] > 0) // kick in on first release of botton. do not check for multipress
&& Button.hold_timer[button_index] > 0 // kick in on first release of botton. do not check for multipress
&& !ShutterSettings.shutter_button[button_index].position[3].mqtt_broadcast ) // do not stop on hold release if broadcast
{
XdrvMailbox.index = shutter_index +1;
XdrvMailbox.payload = -99; // reset any payload to invalid
Expand Down
6 changes: 5 additions & 1 deletion tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,11 @@ bool ShutterButtonHandler(void)

if (NOT_PRESSED == button) {
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d, Button %d, hold %d, dir %d, index %d, payload %d"), shutter_index+1, button_index+1, Button.hold_timer[button_index],Shutter[shutter_index].direction,XdrvMailbox.index,XdrvMailbox.payload);
if (Shutter[shutter_index].direction && (Button.hold_timer[button_index] > 0 && (!Settings->flag.button_single || Button.hold_timer[button_index] > 20))) {
if (Shutter[shutter_index].direction
&& (Button.hold_timer[button_index] > 0
&& (!Settings->flag.button_single
|| Button.hold_timer[button_index] > 20))
&& !(Settings->shutter_button[button_index] & (0x01<<29))) {
XdrvMailbox.index = shutter_index +1;
XdrvMailbox.payload = XdrvMailbox.index;
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Shtr%d, Button %d, hold %d, dir %d, index %d, payload %d"), shutter_index+1, button_index+1, Button.hold_timer[button_index],Shutter[shutter_index].direction,XdrvMailbox.index,XdrvMailbox.payload);
Expand Down

0 comments on commit 959d105

Please sign in to comment.