summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorConfuSomu2021-05-06 09:53:02 -0400
committerConfuSomu2021-05-06 12:35:41 -0400
commit239370ee076e81f392ae124e9543d74dd0500b58 (patch)
treeafdb8b52dddf61ceb4971305c33d4bffa51ff9a5
parent99e82cde75814b9ddc46218fe98b6d467755f2df (diff)
downloadpico-watch-239370ee076e81f392ae124e9543d74dd0500b58.tar
pico-watch-239370ee076e81f392ae124e9543d74dd0500b58.tar.gz
pico-watch-239370ee076e81f392ae124e9543d74dd0500b58.zip
Add cancel option to date/time setting menu
This allows to not save the settings, to avoid time drift, when just looking at them.
-rw-r--r--.vscode/settings.json3
-rw-r--r--apps/settings/main.cpp6
2 files changed, 6 insertions, 3 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 37cfe28..a837a13 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -33,6 +33,7 @@
"typeinfo": "cpp",
"pico.h": "c",
"config.h": "c",
- "config_autogen.h": "c"
+ "config_autogen.h": "c",
+ "ctime": "cpp"
}
} \ No newline at end of file
diff --git a/apps/settings/main.cpp b/apps/settings/main.cpp
index d701d52..36e6cf0 100644
--- a/apps/settings/main.cpp
+++ b/apps/settings/main.cpp
@@ -31,7 +31,7 @@ namespace app_settings {
// Set time
void set0_menu(Api *app_api) {
- static const char *choices[16] = {"Hour", "Minute", "Second", "Year", "Month", "Day", "Day of week", "Apply and close"};
+ static const char *choices[9] = {"Hour", "Minute", "Second", "Year", "Month", "Day", "Day of week", "Apply and close", "Quit without saving"};
uint max_value;
uint min_value;
uint default_value;
@@ -40,7 +40,7 @@ namespace app_settings {
int choice = 0;
while (true) {
- choice = app_api->gui_popup_strchoice(SET0_NAME, SET0_DESC, choices, 8, 0, -1, choice);
+ choice = app_api->gui_popup_strchoice(SET0_NAME, SET0_DESC, choices, 9, 0, -1, choice);
min_value = 0;
switch (choice) {
@@ -68,6 +68,8 @@ namespace app_settings {
case 7: // Apply and exit
app_api->datetime_set(&datetime);
return;
+ case 8: // Quit without saving
+ return;
}
// Display popup for editing value