diff --git a/source/Core/Threads/UI/logic/OperatingModes.h b/source/Core/Threads/UI/logic/OperatingModes.h index 5387f64a6e..a2c08a7d5f 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 93be884194..50508025f4 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; }