summaryrefslogtreecommitdiff
path: root/apps/screens.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/screens.c')
-rw-r--r--apps/screens.c11
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)
123#define OFF_YEAR 9 123#define OFF_YEAR 9
124#define OFF_DAY 14 124#define OFF_DAY 14
125 125
126bool set_time_screen(const char* title, struct tm *tm) 126bool set_time_screen(const char* title, struct tm *tm, bool set_date)
127{ 127{
128 struct viewport viewports[NB_SCREENS]; 128 struct viewport viewports[NB_SCREENS];
129 bool done = false, usb = false; 129 bool done = false, usb = false;
@@ -139,6 +139,10 @@ bool set_time_screen(const char* title, struct tm *tm)
139 offsets_ptr[IDX_DAY] = OFF_YEAR; 139 offsets_ptr[IDX_DAY] = OFF_YEAR;
140 } 140 }
141 141
142 int last_item = IDX_DAY; /*time & date*/
143 if (!set_date)
144 last_item = IDX_SECONDS; /*time*/
145
142 /* speak selection when screen is entered */ 146 /* speak selection when screen is entered */
143 say_time(cursorpos, tm); 147 say_time(cursorpos, tm);
144 148
@@ -161,6 +165,7 @@ bool set_time_screen(const char* title, struct tm *tm)
161 unsigned char buffer[20]; 165 unsigned char buffer[20];
162#endif 166#endif
163 int *valptr = NULL; 167 int *valptr = NULL;
168
164 static unsigned char daysinmonth[] = 169 static unsigned char daysinmonth[] =
165 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 170 {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
166 171
@@ -320,11 +325,11 @@ bool set_time_screen(const char* title, struct tm *tm)
320 button = get_action(CONTEXT_SETTINGS_TIME, TIMEOUT_BLOCK); 325 button = get_action(CONTEXT_SETTINGS_TIME, TIMEOUT_BLOCK);
321 switch ( button ) { 326 switch ( button ) {
322 case ACTION_STD_PREV: 327 case ACTION_STD_PREV:
323 cursorpos = clamp_value_wrap(--cursorpos, 5, 0); 328 cursorpos = clamp_value_wrap(--cursorpos, last_item, 0);
324 say_time(cursorpos, tm); 329 say_time(cursorpos, tm);
325 break; 330 break;
326 case ACTION_STD_NEXT: 331 case ACTION_STD_NEXT:
327 cursorpos = clamp_value_wrap(++cursorpos, 5, 0); 332 cursorpos = clamp_value_wrap(++cursorpos, last_item, 0);
328 say_time(cursorpos, tm); 333 say_time(cursorpos, tm);
329 break; 334 break;
330 case ACTION_SETTINGS_INC: 335 case ACTION_SETTINGS_INC: