Mercurial > public > ostc4
comparison Discovery/Src/tMenuSystem.c @ 944:44599695df41 Evo_2_23
Restructure Date/Time menu:
To have more space for upcoming optins the selection of the date format (DDMMYY) has been moved into a submenu. In addition the function was upgraded to support multi language handling.
author | Ideenmodellierer |
---|---|
date | Thu, 19 Dec 2024 18:58:18 +0100 |
parents | 9f487ad38170 |
children |
comparison
equal
deleted
inserted
replaced
943:e7f87ade3037 | 944:44599695df41 |
---|---|
47 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | 47 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) |
48 { | 48 { |
49 SSettings *data; | 49 SSettings *data; |
50 int i; | 50 int i; |
51 uint8_t textPointer; | 51 uint8_t textPointer; |
52 uint8_t dateFormat; | |
53 uint8_t RTEhigh, RTElow; | 52 uint8_t RTEhigh, RTElow; |
54 RTC_DateTypeDef Sdate; | 53 RTC_DateTypeDef Sdate; |
55 RTC_TimeTypeDef Stime; | 54 RTC_TimeTypeDef Stime; |
56 const SDiveState * pStateReal = stateRealGetPointer(); | 55 const SDiveState * pStateReal = stateRealGetPointer(); |
57 | 56 |
58 data = settingsGetPointer(); | 57 data = settingsGetPointer(); |
59 textPointer = 0; | 58 textPointer = 0; |
60 *tab = 300; | 59 *tab = 300; |
61 *subtext = 0; | 60 *subtext = 0; |
61 char tmpString[15]; | |
62 | 62 |
63 resetLineMask(StMSYS); | 63 resetLineMask(StMSYS); |
64 | 64 |
65 // dive mode | 65 // dive mode |
66 if(actual_menu_content != MENU_SURFACE) | 66 if(actual_menu_content != MENU_SURFACE) |
126 if((line == 0) || (line == 1)) | 126 if((line == 0) || (line == 1)) |
127 { | 127 { |
128 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | 128 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); |
129 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | 129 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); |
130 | 130 |
131 dateFormat = data->date_format; | 131 text[textPointer++] = TXT_Date; |
132 | 132 getStringOfFormat_DDMMYY(tmpString,15); |
133 textPointer += snprintf(&text[textPointer], 40, | 133 textPointer += snprintf(&text[textPointer], 40,"\016\016 %s ",tmpString); |
134 "Date" | 134 convertStringOfDate_DDMMYY(tmpString,15,Sdate.Date, Sdate.Month, Sdate.Year); |
135 "\016\016" | 135 textPointer += snprintf(&text[textPointer], 40,"\017\t%s ",tmpString); |
136 " " | |
137 ); | |
138 | |
139 if(dateFormat == DDMMYY) | |
140 { | |
141 textPointer += snprintf(&text[textPointer], 40, | |
142 "DDMMYY" | |
143 "\017" | |
144 "\t" | |
145 "%02d-%02d-%02d" | |
146 " " | |
147 , Sdate.Date, Sdate.Month, 2000 + Sdate.Year | |
148 ); | |
149 } | |
150 else | |
151 if(dateFormat == MMDDYY) | |
152 { | |
153 textPointer += snprintf(&text[textPointer], 40, | |
154 "MMDDYY" | |
155 "\017" | |
156 "\t" | |
157 "%02d-%02d-%02d" | |
158 " " | |
159 ,Sdate.Month, Sdate.Date, 2000 + Sdate.Year | |
160 ); | |
161 } | |
162 else | |
163 if(dateFormat == YYMMDD) | |
164 { | |
165 textPointer += snprintf(&text[textPointer], 40, | |
166 "YYMMDD" | |
167 "\017" | |
168 "\t" | |
169 "%02d-%02d-%02d" | |
170 " " | |
171 , 2000 + Sdate.Year, Sdate.Month, Sdate.Date | |
172 ); | |
173 } | |
174 | 136 |
175 textPointer += snprintf(&text[textPointer], 60, | 137 textPointer += snprintf(&text[textPointer], 60, |
176 "%02d:%02d:%02d" | 138 "%02d:%02d:%02d" |
177 "\n\r" | 139 "\n\r" |
178 ,Stime.Hours, Stime.Minutes, Stime.Seconds | 140 ,Stime.Hours, Stime.Minutes, Stime.Seconds |