diff options
author | discip <[email protected]> | 2024-08-13 22:24:20 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-13 22:24:20 +0200 |
commit | adfc521122590ac6f54702e52b8d6cf7e3d963eb (patch) | |
tree | a153e52fce7ea0cc40436125431d30306746c32f | |
parent | 2bce5b710e181a46bdcb49a7fa5d9023f9e0a81f (diff) | |
parent | 42d7f8d4c5065060d90a7cc4b40adbf949b86cc8 (diff) | |
download | IronOS-adfc521122590ac6f54702e52b8d6cf7e3d963eb.tar.gz IronOS-adfc521122590ac6f54702e52b8d6cf7e3d963eb.zip |
Merge pull request #1957 from neon12345/dev
Keep the locked warning for some time
-rw-r--r-- | source/Core/Threads/UI/logic/OperatingModes.h | 1 | ||||
-rw-r--r-- | source/Core/Threads/UI/logic/Soldering.cpp | 31 |
2 files changed, 23 insertions, 9 deletions
diff --git a/source/Core/Threads/UI/logic/OperatingModes.h b/source/Core/Threads/UI/logic/OperatingModes.h index 5387f64a..a2c08a7d 100644 --- a/source/Core/Threads/UI/logic/OperatingModes.h +++ b/source/Core/Threads/UI/logic/OperatingModes.h @@ -62,6 +62,7 @@ struct guiContext { uint32_t state4; // 32 bit state scratch uint16_t state5; // 16 bit state scratch uint16_t state6; // 16 bit state scratch + uint32_t state7; // 32 bit state scratch } scratch_state; }; diff --git a/source/Core/Threads/UI/logic/Soldering.cpp b/source/Core/Threads/UI/logic/Soldering.cpp index 93be8841..50508025 100644 --- a/source/Core/Threads/UI/logic/Soldering.cpp +++ b/source/Core/Threads/UI/logic/Soldering.cpp @@ -9,26 +9,39 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) { if (cxt->scratch_state.state1 >= 2) { // Buttons are currently locked - switch (buttons) { - case BUTTON_F_LONG: - if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) { - cxt->scratch_state.state2 = 1; - } - break; - case BUTTON_BOTH_LONG: + if (buttons == BUTTON_BOTH_LONG) { if (cxt->scratch_state.state1 == 3) { // Unlocking if (warnUser(translatedString(Tr->UnlockingKeysString), buttons)) { cxt->scratch_state.state1 = 1; + cxt->scratch_state.state7 = 0; } } else { + warnUser(translatedString(Tr->LockingKeysString), buttons); + } + return OperatingMode::Soldering; + } + if (cxt->scratch_state.state7 != 0) { + // show locked until timer is up + if (xTaskGetTickCount() >= cxt->scratch_state.state7) { + cxt->scratch_state.state7 = 0; + } else { warnUser(translatedString(Tr->WarningKeysLockedString), buttons); + return OperatingMode::Soldering; } - break; + } + switch (buttons) { case BUTTON_NONE: cxt->scratch_state.state1 = 3; break; - default: // Do nothing and display a lock warning + case BUTTON_F_LONG: + if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) { + cxt->scratch_state.state2 = 1; + break; + } + /*Fall through*/ + default: // Set timer for and display a lock warning + cxt->scratch_state.state7 = xTaskGetTickCount() + TICKS_SECOND; warnUser(translatedString(Tr->WarningKeysLockedString), buttons); break; } |