mirror of https://github.com/arendst/Tasmota.git
Merge pull request #7831 from Phonog/development
Fix switchmode 6 according to issue 7778
This commit is contained in:
commit
c40fce0099
|
@ -214,20 +214,20 @@ void SwitchHandler(uint8_t mode)
|
|||
break;
|
||||
case PUSHBUTTONHOLD:
|
||||
if ((PRESSED == button) && (NOT_PRESSED == Switch.last_state[i])) {
|
||||
Switch.hold_timer[i] = loops_per_second * Settings.param[P_HOLD_TIME] / 10;
|
||||
Switch.hold_timer[i] = loops_per_second * Settings.param[P_HOLD_TIME] / 10; // Start timer on button press
|
||||
}
|
||||
if ((NOT_PRESSED == button) && (PRESSED == Switch.last_state[i]) && (Switch.hold_timer[i])) {
|
||||
Switch.hold_timer[i] = 0;
|
||||
switchflag = POWER_TOGGLE; // Toggle with pushbutton to Gnd
|
||||
Switch.hold_timer[i] = 0; // Button released and hold timer not expired : stop timer...
|
||||
switchflag = POWER_TOGGLE; // ...and Toggle
|
||||
}
|
||||
break;
|
||||
case PUSHBUTTONHOLD_INV:
|
||||
if ((NOT_PRESSED == button) && (PRESSED == Switch.last_state[i])) {
|
||||
Switch.hold_timer[i] = loops_per_second * Settings.param[P_HOLD_TIME] / 10;
|
||||
if ((PRESSED == button) && (NOT_PRESSED == Switch.last_state[i])) {
|
||||
Switch.hold_timer[i] = loops_per_second * Settings.param[P_HOLD_TIME] / 10; // Start timer on button press...
|
||||
switchflag = POWER_TOGGLE; // ...and Toggle
|
||||
}
|
||||
if ((PRESSED == button) && (NOT_PRESSED == Switch.last_state[i]) && (Switch.hold_timer[i])) {
|
||||
Switch.hold_timer[i] = 0;
|
||||
switchflag = POWER_TOGGLE; // Toggle with pushbutton to Gnd
|
||||
if ((NOT_PRESSED == button) && (PRESSED == Switch.last_state[i])) {
|
||||
Switch.hold_timer[i] = 0; // Button released : stop timer.
|
||||
}
|
||||
break;
|
||||
case TOGGLEMULTI:
|
||||
|
|
Loading…
Reference in New Issue