Skip to content

Commit

Permalink
Merge pull request #1957 from neon12345/dev
Browse files Browse the repository at this point in the history
Keep the locked warning for some time
  • Loading branch information
discip authored Aug 13, 2024
2 parents 2bce5b7 + 42d7f8d commit adfc521
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
1 change: 1 addition & 0 deletions source/Core/Threads/UI/logic/OperatingModes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
31 changes: 22 additions & 9 deletions source/Core/Threads/UI/logic/Soldering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit adfc521

Please sign in to comment.