Change shutterbutton hold behavior with grouptopic (#19263)

* 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
This commit is contained in:
stefanbode 2023-08-05 14:51:56 +02:00 committed by GitHub
parent 7c3c3855c4
commit 959d105413
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -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

View File

@ -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);