1
0
forked from me/IronOS

Better home screen button handler

This commit is contained in:
Ben V. Brown
2023-07-18 08:06:12 +10:00
parent ae5b9e9717
commit 553f5fd273
4 changed files with 6 additions and 9 deletions

View File

@@ -18,6 +18,9 @@ The use of these gives a notion of "direction" when navigating the menu.
``` ```
The downside of supporting transitions is that for these to work, the code should render the screen _first_ then return the new state.
This ensures there is a good working copy in the buffer before the transition changes the view.
## TODO notes ## TODO notes
On settings menu exit: On settings menu exit:

View File

@@ -208,6 +208,6 @@ void startGUITask(void const *argument) {
for (;;) { for (;;) {
guiRenderLoop(); guiRenderLoop();
resetWatchdog(); resetWatchdog();
vTaskDelayUntil(&startRender, TICKS_100MS / 2); vTaskDelayUntil(&startRender, TICKS_100MS / 2); // Try and maintain 20fps ish update rate, way to fast but if we can its nice
} }
} }

View File

@@ -167,11 +167,6 @@ void drawSimplifiedHomeScreen(uint32_t tipTemp) {
} }
OperatingMode drawHomeScreen(const ButtonState buttons, guiContext *cxt) { OperatingMode drawHomeScreen(const ButtonState buttons, guiContext *cxt) {
OperatingMode newMode = handleHomeButtons(buttons, cxt);
if (newMode != OperatingMode::HomeScreen) {
return newMode;
}
currentTempTargetDegC = 0; // ensure tip is off currentTempTargetDegC = 0; // ensure tip is off
getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0); getInputVoltageX10(getSettingValue(SettingsOptions::VoltageDiv), 0);
uint32_t tipTemp = TipThermoModel::getTipInC(); uint32_t tipTemp = TipThermoModel::getTipInC();
@@ -187,6 +182,5 @@ OperatingMode drawHomeScreen(const ButtonState buttons, guiContext *cxt) {
} else { } else {
drawSimplifiedHomeScreen(tipTemp); drawSimplifiedHomeScreen(tipTemp);
} }
return handleHomeButtons(buttons, cxt);
return OperatingMode::HomeScreen;
} }

View File

@@ -4,5 +4,5 @@ OperatingMode gui_SettingsMenu(const ButtonState buttons, guiContext *cxt) {
// State 1 -> Root menu // State 1 -> Root menu
// State 2 -> Sub entry // State 2 -> Sub entry
return OperatingMode::SettingsMenu; return OperatingMode::HomeScreen;
} }