mirror of https://github.com/arendst/Tasmota.git
Fix switchmode 6 according to issue 7778
This commit is contained in:
parent
b7c6a7bcbb
commit
9498cde5e5
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
"version": "0.2.0",
|
||||
"configurations": []
|
||||
}
|
|
@ -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