From 835ccafa527b4a0572ab9086fa9c8af6cdea70ea Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Tue, 18 Jul 2023 20:38:36 +1000 Subject: [PATCH] Update SettingsMenu.cpp --- .../Threads/OperatingModes/SettingsMenu.cpp | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/source/Core/Threads/OperatingModes/SettingsMenu.cpp b/source/Core/Threads/OperatingModes/SettingsMenu.cpp index 67a2674218..042587be16 100644 --- a/source/Core/Threads/OperatingModes/SettingsMenu.cpp +++ b/source/Core/Threads/OperatingModes/SettingsMenu.cpp @@ -1,4 +1,39 @@ #include "OperatingModes.h" + +OperatingMode handleSettingsButtons(const ButtonState buttons, guiContext *cxt) { + switch (buttons) { + case BUTTON_NONE: + // Do nothing + break; + case BUTTON_BOTH: + break; + + case BUTTON_B_LONG: + return OperatingMode::DebugMenuReadout; + break; + case BUTTON_F_LONG: +#ifdef PROFILE_SUPPORT + if (!isTipDisconnected()) { + return OperatingMode::SolderingProfile; + } +#else + return OperatingMode::TemperatureAdjust; +#endif + break; + case BUTTON_F_SHORT: + if (!isTipDisconnected()) { + return OperatingMode::Soldering; + } + break; + case BUTTON_B_SHORT: + return OperatingMode::SettingsMenu; + break; + default: + break; + } + return OperatingMode::HomeScreen; +} + OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) { // Render out the current settings menu // State 1 -> Root menu @@ -6,5 +41,5 @@ OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) { uint16_t *mainEntry = &(cxt->scratch_state.state1); uint16_t *subEntry = &(cxt->scratch_state.state2); - return OperatingMode::HomeScreen; + return handleSettingsButtons(buttons, cxt); } \ No newline at end of file