Merge pull request #7831 from Phonog/development

Fix switchmode 6 according to issue 7778
This commit is contained in:
Theo Arends 2020-03-01 13:52:18 +01:00 committed by GitHub
commit c40fce0099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 8 deletions

View File

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