diff options
Diffstat (limited to 'apps/screens.c')
-rw-r--r-- | apps/screens.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/screens.c b/apps/screens.c index f3a969a838..2d3a521a88 100644 --- a/apps/screens.c +++ b/apps/screens.c @@ -123,7 +123,7 @@ static void say_time(int cursorpos, const struct tm *tm) #define OFF_YEAR 9 #define OFF_DAY 14 -bool set_time_screen(const char* title, struct tm *tm) +bool set_time_screen(const char* title, struct tm *tm, bool set_date) { struct viewport viewports[NB_SCREENS]; bool done = false, usb = false; @@ -139,6 +139,10 @@ bool set_time_screen(const char* title, struct tm *tm) offsets_ptr[IDX_DAY] = OFF_YEAR; } + int last_item = IDX_DAY; /*time & date*/ + if (!set_date) + last_item = IDX_SECONDS; /*time*/ + /* speak selection when screen is entered */ say_time(cursorpos, tm); @@ -161,6 +165,7 @@ bool set_time_screen(const char* title, struct tm *tm) unsigned char buffer[20]; #endif int *valptr = NULL; + static unsigned char daysinmonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; @@ -320,11 +325,11 @@ bool set_time_screen(const char* title, struct tm *tm) button = get_action(CONTEXT_SETTINGS_TIME, TIMEOUT_BLOCK); switch ( button ) { case ACTION_STD_PREV: - cursorpos = clamp_value_wrap(--cursorpos, 5, 0); + cursorpos = clamp_value_wrap(--cursorpos, last_item, 0); say_time(cursorpos, tm); break; case ACTION_STD_NEXT: - cursorpos = clamp_value_wrap(++cursorpos, 5, 0); + cursorpos = clamp_value_wrap(++cursorpos, last_item, 0); say_time(cursorpos, tm); break; case ACTION_SETTINGS_INC: |