From e9d0d9bb6389f5adb582bf87308d46044f20c850 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sun, 24 Jan 2021 18:32:34 +0800 Subject: [PATCH 1/3] Fix temp. change auto repleat accel. not being reset --- source/Core/Threads/GUIThread.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index 1a1dbbf3..5f1355bf 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -194,6 +194,7 @@ static void gui_solderingTempAdjust() { switch (buttons) { case BUTTON_NONE: // stay + autoRepeatAcceleration = 0; break; case BUTTON_BOTH: // exit From ff95a1c0d93ead59c82872314d7c50cb0a9a8dcc Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Tue, 26 Jan 2021 16:32:54 +0800 Subject: [PATCH 2/3] Fix long-press on idle screen immediately changing temp. Fixes #825 --- source/Core/Threads/GUIThread.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index 5f1355bf..a142c8ba 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -184,13 +184,25 @@ static void gui_solderingTempAdjust() { currentTempTargetDegC = 0; uint32_t autoRepeatTimer = 0; uint8_t autoRepeatAcceleration = 0; + bool waitForRelease = false; + ButtonState buttons = getButtonState(); + if (buttons != BUTTON_NONE) { + // Temp adjust entered by long-pressing F button. + waitForRelease = true; + } for (;;) { OLED::setCursor(0, 0); OLED::clearScreen(); OLED::setFont(0); - ButtonState buttons = getButtonState(); - if (buttons) + buttons = getButtonState(); + if (buttons) { + if (waitForRelease) { + buttons = BUTTON_NONE; + } lastChange = xTaskGetTickCount(); + } else { + waitForRelease = false; + } switch (buttons) { case BUTTON_NONE: // stay From dcd40a1bc726a1d24aa85f17ede4bbfbb77bb117 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Tue, 26 Jan 2021 16:33:21 +0800 Subject: [PATCH 3/3] Format code with clang-format --- source/Core/Threads/GUIThread.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp index a142c8ba..34fd22de 100644 --- a/source/Core/Threads/GUIThread.cpp +++ b/source/Core/Threads/GUIThread.cpp @@ -180,12 +180,12 @@ static void gui_drawBatteryIcon() { #endif } static void gui_solderingTempAdjust() { - uint32_t lastChange = xTaskGetTickCount(); - currentTempTargetDegC = 0; - uint32_t autoRepeatTimer = 0; - uint8_t autoRepeatAcceleration = 0; - bool waitForRelease = false; - ButtonState buttons = getButtonState(); + uint32_t lastChange = xTaskGetTickCount(); + currentTempTargetDegC = 0; + uint32_t autoRepeatTimer = 0; + uint8_t autoRepeatAcceleration = 0; + bool waitForRelease = false; + ButtonState buttons = getButtonState(); if (buttons != BUTTON_NONE) { // Temp adjust entered by long-pressing F button. waitForRelease = true;