diff options
author | ConfuSomu | 2021-05-27 19:41:20 -0400 |
---|---|---|
committer | ConfuSomu | 2021-05-27 19:41:20 -0400 |
commit | 51a7257cbabfa608a2f685e634ac9b37a17c4086 (patch) | |
tree | 3ba0d54adda64756c624f0e946accc78728a112a /apps/settings/main.cpp | |
parent | 3f960904fb75b1408ac08863636363653c40dba3 (diff) | |
download | pico-watch-51a7257cbabfa608a2f685e634ac9b37a17c4086.tar pico-watch-51a7257cbabfa608a2f685e634ac9b37a17c4086.tar.gz pico-watch-51a7257cbabfa608a2f685e634ac9b37a17c4086.zip |
Use NUM_CHOICES to avoid having magic number
Diffstat (limited to 'apps/settings/main.cpp')
-rw-r--r-- | apps/settings/main.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/settings/main.cpp b/apps/settings/main.cpp index 5e8857b..f10a65b 100644 --- a/apps/settings/main.cpp +++ b/apps/settings/main.cpp @@ -43,7 +43,8 @@ namespace app_settings { // Time and date settings void set0_menu(Api *app_api) { - static const char *choices[9] = {"Hour", "Minute", "Second", "Year", "Month", "Day", "Day of week", STR_SET_APPLY, STR_SET_CANCEL}; + #define NUM_CHOICES 9 + static const char *choices[NUM_CHOICES] = {"Hour", "Minute", "Second", "Year", "Month", "Day", "Day of week", STR_SET_APPLY, STR_SET_CANCEL}; uint max_value; uint min_value; uint default_value; @@ -52,7 +53,7 @@ namespace app_settings { int choice = 0; while (true) { - choice = app_api->gui_popup_strchoice(SET0_NAME, SET0_DESC, choices, 9, 0, -1, choice); + choice = app_api->gui_popup_strchoice(SET0_NAME, SET0_DESC, choices, NUM_CHOICES, 0, -1, choice); min_value = 0; switch (choice) { @@ -112,6 +113,7 @@ namespace app_settings { case 5: datetime.day = new_value; break; } } + #undef NUM_CHOICES } // Display settings |