1
0
forked from me/IronOS

Add early exit to settings menu

Adds pressing both buttons to exit settings menu. #53
This commit is contained in:
Ben V. Brown
2017-08-09 15:14:06 +10:00
parent f3c1fafccc
commit d2efa0dc05

View File

@@ -150,12 +150,19 @@ void ProcessUI() {
//The user pressed the button to breakout of the settings help prompt //The user pressed the button to breakout of the settings help prompt
StatusFlags = 0; StatusFlags = 0;
} else { } else {
if (Buttons & BUT_B) { if (Buttons == (BUT_A | BUT_B)) {
//Both buttons were pressed, exit back to the startup screen
settingsPage = 0; //reset
operatingMode = STARTUP; //reset back to the startup
saveSettings(); //Save the settings
} else if (Buttons & BUT_B) {
//A key iterates through the menu //A key iterates through the menu
if (settingsPage == SETTINGSOPTIONSCOUNT) { if (settingsPage == SETTINGSOPTIONSCOUNT) {
//Roll off the end //Roll off the end
settingsPage = 0; //reset settingsPage = 0; //reset
operatingMode = STARTUP; //reset back to the startup operatingMode = STARTUP; //reset back to the startup
saveSettings(); //Save the settings saveSettings(); //Save the settings
} else { } else {
++settingsPage; //move to the next option ++settingsPage; //move to the next option
@@ -165,7 +172,7 @@ void ProcessUI() {
switch (settingsPage) { switch (settingsPage) {
case UVCO: case UVCO:
//we are incrementing the cutout voltage //we are incrementing the cutout voltage
systemSettings.cutoutSetting += 1; //Go up 1V at a jump systemSettings.cutoutSetting += 1; //Go up 1V at a jump
systemSettings.cutoutSetting %= 5; //wrap 0->4 systemSettings.cutoutSetting %= 5; //wrap 0->4
break; break;
case SLEEP_TEMP: case SLEEP_TEMP:
@@ -182,7 +189,7 @@ void ProcessUI() {
case SHUTDOWN_TIME: case SHUTDOWN_TIME:
++systemSettings.ShutdownTime; ++systemSettings.ShutdownTime;
if (systemSettings.ShutdownTime > 60) if (systemSettings.ShutdownTime > 60)
systemSettings.ShutdownTime = 0; //wrap to off systemSettings.ShutdownTime = 0; //wrap to off
break; break;
case TEMPDISPLAY: case TEMPDISPLAY:
systemSettings.displayTempInF = systemSettings.displayTempInF =
@@ -440,7 +447,7 @@ void DrawUI() {
Oled_DisplayOff(); Oled_DisplayOff();
} else { } else {
Oled_DisplayOn(); Oled_DisplayOn();
OLED_DrawIDLELogo(); //Draw the icons for prompting the user OLED_DrawIDLELogo(); //Draw the icons for prompting the user
} }
break; break;
case SOLDERING: case SOLDERING: