From 297205aa06242f5c1c0ba73a237c9ee406262075 Mon Sep 17 00:00:00 2001 From: neon12345 <784389+neon12345@users.noreply.github.com> Date: Wed, 31 Jul 2024 05:52:32 +0200 Subject: [PATCH 1/5] Update Soldering.cpp add additional release state for locking --- source/Core/Threads/UI/logic/Soldering.cpp | 32 ++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/source/Core/Threads/UI/logic/Soldering.cpp b/source/Core/Threads/UI/logic/Soldering.cpp index 4b794943f6..c1fffbc05c 100644 --- a/source/Core/Threads/UI/logic/Soldering.cpp +++ b/source/Core/Threads/UI/logic/Soldering.cpp @@ -2,25 +2,32 @@ #include "OperatingModes.h" #include "SolderingCommon.h" #include "ui_drawing.hpp" -// State 1 = button locking +// State 1 = button locking (0:unlocked, 1:unlocked+released, 2:locked, 3:locked+released) // State 2 = boost mode // State 3 = buzzer timer OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) { - if (cxt->scratch_state.state1 == 1) { - // Buttons are currently locked - if (buttons == BUTTON_F_LONG) { + if (cxt->scratch_state.state1 >= 2) { + switch (Buttons) { + case BUTTON_F_LONG: // Buttons are currently locked if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) { cxt->scratch_state.state2 = 1; } - } else if (buttons == BUTTON_BOTH_LONG) { - // Unlocking - if (warnUser(translatedString(Tr->UnlockingKeysString), buttons)) { - cxt->scratch_state.state1 = 0; + break; + case BUTTON_BOTH_LONG: + if (cxt->scratch_state.state1 == 3) { + // Unlocking + if (warnUser(translatedString(Tr->UnlockingKeysString), buttons)) { + cxt->scratch_state.state1 = 1; + } } - } else if (buttons != BUTTON_NONE) { - // Do nothing and display a lock warning + break; + case BUTTON_NONE: + cxt->scratch_state.state1 = 3; + break; + default: // Do nothing and display a lock warning warnUser(translatedString(Tr->WarningKeysLockedString), buttons); + break; } return OperatingMode::Soldering; } @@ -28,6 +35,7 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) switch (buttons) { case BUTTON_NONE: cxt->scratch_state.state2 = 0; + cxt->scratch_state.state1 = 0; break; case BUTTON_BOTH: /*Fall through*/ @@ -47,7 +55,9 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) case BUTTON_BOTH_LONG: if (getSettingValue(SettingsOptions::LockingMode) && warnUser(translatedString(Tr->LockingKeysString), buttons)) { // Lock buttons - cxt->scratch_state.state1 = 1; + if (cxt->scratch_state.state1 == 0) { + cxt->scratch_state.state1 = 2; + } } break; default: From 2a5ba2b057d60f77ab18d0c499ea0897dcf75a91 Mon Sep 17 00:00:00 2001 From: neon12345 <784389+neon12345@users.noreply.github.com> Date: Wed, 31 Jul 2024 06:06:45 +0200 Subject: [PATCH 2/5] Update Soldering.cpp fix typo --- source/Core/Threads/UI/logic/Soldering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Core/Threads/UI/logic/Soldering.cpp b/source/Core/Threads/UI/logic/Soldering.cpp index c1fffbc05c..73f0a46e9b 100644 --- a/source/Core/Threads/UI/logic/Soldering.cpp +++ b/source/Core/Threads/UI/logic/Soldering.cpp @@ -8,7 +8,7 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) { if (cxt->scratch_state.state1 >= 2) { - switch (Buttons) { + switch (buttons) { case BUTTON_F_LONG: // Buttons are currently locked if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) { cxt->scratch_state.state2 = 1; From 616db16b00bc7fb7aa5d556622c1a8156e668d50 Mon Sep 17 00:00:00 2001 From: neon12345 <784389+neon12345@users.noreply.github.com> Date: Wed, 31 Jul 2024 06:16:51 +0200 Subject: [PATCH 3/5] Update Soldering.cpp logic description fix --- source/Core/Threads/UI/logic/Soldering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Core/Threads/UI/logic/Soldering.cpp b/source/Core/Threads/UI/logic/Soldering.cpp index 73f0a46e9b..a0e883130e 100644 --- a/source/Core/Threads/UI/logic/Soldering.cpp +++ b/source/Core/Threads/UI/logic/Soldering.cpp @@ -2,7 +2,7 @@ #include "OperatingModes.h" #include "SolderingCommon.h" #include "ui_drawing.hpp" -// State 1 = button locking (0:unlocked, 1:unlocked+released, 2:locked, 3:locked+released) +// State 1 = button locking (0:unlocked+released, 1:unlocked, 2:locked, 3:locked+released) // State 2 = boost mode // State 3 = buzzer timer From f0fa2719400e5d776140170db1c7265a99418063 Mon Sep 17 00:00:00 2001 From: neon12345 <784389+neon12345@users.noreply.github.com> Date: Wed, 31 Jul 2024 12:28:57 +0200 Subject: [PATCH 4/5] Update Soldering.cpp move comment --- source/Core/Threads/UI/logic/Soldering.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/Core/Threads/UI/logic/Soldering.cpp b/source/Core/Threads/UI/logic/Soldering.cpp index a0e883130e..f4406c91cd 100644 --- a/source/Core/Threads/UI/logic/Soldering.cpp +++ b/source/Core/Threads/UI/logic/Soldering.cpp @@ -8,8 +8,9 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) { if (cxt->scratch_state.state1 >= 2) { + // Buttons are currently locked switch (buttons) { - case BUTTON_F_LONG: // Buttons are currently locked + case BUTTON_F_LONG: if (getSettingValue(SettingsOptions::BoostTemp) && (getSettingValue(SettingsOptions::LockingMode) == lockingMode_t::BOOST)) { cxt->scratch_state.state2 = 1; } From 6a2f2dc3449f4f0b5d0a6662880daeef25348c5e Mon Sep 17 00:00:00 2001 From: neon12345 <784389+neon12345@users.noreply.github.com> Date: Wed, 31 Jul 2024 13:28:26 +0200 Subject: [PATCH 5/5] Update Soldering.cpp optimize lock/unlock display information --- source/Core/Threads/UI/logic/Soldering.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/Core/Threads/UI/logic/Soldering.cpp b/source/Core/Threads/UI/logic/Soldering.cpp index f4406c91cd..93be884194 100644 --- a/source/Core/Threads/UI/logic/Soldering.cpp +++ b/source/Core/Threads/UI/logic/Soldering.cpp @@ -21,6 +21,8 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) if (warnUser(translatedString(Tr->UnlockingKeysString), buttons)) { cxt->scratch_state.state1 = 1; } + } else { + warnUser(translatedString(Tr->WarningKeysLockedString), buttons); } break; case BUTTON_NONE: @@ -54,10 +56,15 @@ OperatingMode handleSolderingButtons(const ButtonState buttons, guiContext *cxt) cxt->transitionMode = TransitionAnimation::Left; return OperatingMode::TemperatureAdjust; case BUTTON_BOTH_LONG: - if (getSettingValue(SettingsOptions::LockingMode) && warnUser(translatedString(Tr->LockingKeysString), buttons)) { + if (getSettingValue(SettingsOptions::LockingMode)) { // Lock buttons if (cxt->scratch_state.state1 == 0) { - cxt->scratch_state.state1 = 2; + if (warnUser(translatedString(Tr->LockingKeysString), buttons)) { + cxt->scratch_state.state1 = 2; + } + } else { + // FIXME should be WarningKeysUnlockedString + warnUser(translatedString(Tr->UnlockingKeysString), buttons); } } break;