Mercurial > public > ostc4
annotate Discovery/Src/tMenuSystem.c @ 347:77de014928d6 FlightMode_Improvment
Added option to manually leave dive mode to system menu
Added multilanguage strings and removed some outdated ones
author | ideenmodellierer |
---|---|
date | Thu, 03 Oct 2019 21:33:47 +0200 |
parents | b2a9e9b02df0 |
children | 0dbf550dc743 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuSystem.c | |
5 /// \brief Main Template file for Menu Page System settings | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 05-Aug-2014 | |
8 /// | |
9 /// \details | |
10 /// | |
11 /// $Id$ | |
12 /////////////////////////////////////////////////////////////////////////////// | |
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
14 /// | |
15 /// This program is free software: you can redistribute it and/or modify | |
16 /// it under the terms of the GNU General Public License as published by | |
17 /// the Free Software Foundation, either version 3 of the License, or | |
18 /// (at your option) any later version. | |
19 /// | |
20 /// This program is distributed in the hope that it will be useful, | |
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 /// GNU General Public License for more details. | |
24 /// | |
25 /// You should have received a copy of the GNU General Public License | |
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>. | |
27 ////////////////////////////////////////////////////////////////////////////// | |
28 | |
29 /* Includes ------------------------------------------------------------------*/ | |
30 #include "tMenu.h" | |
31 #include "tMenuSystem.h" | |
32 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() | |
33 | |
34 /* Private function prototypes -----------------------------------------------*/ | |
35 char customview_TXT2BYTE_helper(uint8_t customViewId); | |
36 | |
37 /* Exported functions --------------------------------------------------------*/ | |
38 | |
39 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
40 { | |
41 SSettings *data; | |
42 uint8_t textPointer; | |
43 uint8_t dateFormat; | |
44 uint8_t RTEhigh, RTElow; | |
45 RTC_DateTypeDef Sdate; | |
46 RTC_TimeTypeDef Stime; | |
47 const SDiveState * pStateReal = stateRealGetPointer(); | |
48 | |
49 data = settingsGetPointer(); | |
50 textPointer = 0; | |
51 *tab = 300; | |
52 *subtext = 0; | |
53 | |
54 // dive mode | |
55 if(actual_menu_content != MENU_SURFACE) | |
56 { | |
57 uint8_t id; | |
58 | |
59 for(int i=0; i<6;i++) | |
60 { | |
61 id = cv_changelist[i]; | |
210
b2a9e9b02df0
New feature: make selected customviews persistent
Jan Mulder <jlmulder@xs4all.nl>
parents:
139
diff
changeset
|
62 text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id); |
38 | 63 text[textPointer++] = ' '; |
64 textPointer += snprintf(&text[textPointer], 60, | |
65 "%c%c\n\r", | |
66 TXT_2BYTE, customview_TXT2BYTE_helper(id) | |
67 ); | |
68 } | |
69 text[textPointer] = 0; | |
70 | |
71 return StMSYS; | |
72 } | |
73 | |
74 // surface mode | |
139
decb0461302a
Get version from local memory instead from incoming data
Ideenmodellierer
parents:
138
diff
changeset
|
75 getActualRTEandFONTversion(&RTEhigh,&RTElow,NULL,NULL); |
38 | 76 |
77 if((RTEhigh == 0xFF) || (RTElow == 0xFF)) | |
78 { | |
79 RTEhigh = 0; | |
80 RTElow = 0; | |
81 } | |
82 | |
83 if((line == 0) || (line == 1)) | |
84 { | |
85 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | |
86 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | |
87 | |
88 dateFormat = data->date_format; | |
89 | |
90 textPointer += snprintf(&text[textPointer], 40, | |
91 "Date" | |
92 "\016\016" | |
93 " " | |
94 ); | |
95 | |
96 if(dateFormat == DDMMYY) | |
97 { | |
98 textPointer += snprintf(&text[textPointer], 40, | |
99 "DDMMYY" | |
100 "\017" | |
101 "\t" | |
102 "%02d-%02d-%02d" | |
103 " " | |
104 , Sdate.Date, Sdate.Month, 2000 + Sdate.Year | |
105 ); | |
106 } | |
107 else | |
108 if(dateFormat == MMDDYY) | |
109 { | |
110 textPointer += snprintf(&text[textPointer], 40, | |
111 "MMDDYY" | |
112 "\017" | |
113 "\t" | |
114 "%02d-%02d-%02d" | |
115 " " | |
116 ,Sdate.Month, Sdate.Date, 2000 + Sdate.Year | |
117 ); | |
118 } | |
119 else | |
120 if(dateFormat == YYMMDD) | |
121 { | |
122 textPointer += snprintf(&text[textPointer], 40, | |
123 "YYMMDD" | |
124 "\017" | |
125 "\t" | |
126 "%02d-%02d-%02d" | |
127 " " | |
128 , 2000 + Sdate.Year, Sdate.Month, Sdate.Date | |
129 ); | |
130 } | |
131 | |
132 textPointer += snprintf(&text[textPointer], 60, | |
133 "%02d:%02d:%02d" | |
134 "\n\r" | |
135 ,Stime.Hours, Stime.Minutes, Stime.Seconds | |
136 ); | |
137 } | |
138 else | |
139 { | |
140 strcpy(&text[textPointer],"\n\r"); | |
141 textPointer += 2; | |
142 } | |
143 | |
144 if((line == 0) || (line == 2)) | |
145 { | |
146 text[textPointer++] = TXT_Language; | |
147 text[textPointer++] = '\t'; | |
148 text[textPointer++] = TXT_LanguageName; | |
149 text[textPointer++] = '\n'; | |
150 text[textPointer++] = '\r'; | |
151 text[textPointer] = 0; | |
152 } | |
153 else | |
154 { | |
155 strcpy(&text[textPointer],"\n\r"); | |
156 textPointer += 2; | |
157 } | |
158 | |
159 if((line == 0) || (line == 3)) | |
160 { | |
161 text[textPointer++] = TXT_2BYTE; | |
162 text[textPointer++] = TXT2BYTE_Layout; | |
163 text[textPointer++] = '\t'; | |
164 | |
165 if(!data->showDebugInfo) | |
166 { | |
167 text[textPointer++] = TXT_2BYTE; | |
168 if(data->nonMetricalSystem == 0) | |
169 text[textPointer++] = TXT2BYTE_Units_metric; | |
170 else | |
171 text[textPointer++] = TXT2BYTE_Units_feet; | |
172 | |
173 if(data->tX_colorscheme != 0) | |
174 { | |
175 text[textPointer++] = ' '; | |
176 text[textPointer++] = ' '; | |
177 text[textPointer++] = ' '; | |
178 text[textPointer++] = ' '; | |
179 text[textPointer++] = '\027'; | |
180 text[textPointer++] = '/'; | |
181 text[textPointer++] = ' '; | |
182 text[textPointer++] = '0' + data->tX_colorscheme; | |
183 text[textPointer++] = '\020'; | |
184 } | |
185 } | |
186 else | |
187 { | |
188 if(data->nonMetricalSystem == 0) | |
189 { | |
190 text[textPointer++] = 'm'; | |
191 text[textPointer++] = '/'; | |
192 text[textPointer++] = 'C'; | |
193 } | |
194 else | |
195 { | |
196 text[textPointer++] = 'f'; | |
197 text[textPointer++] = 't'; | |
198 text[textPointer++] = '/'; | |
199 text[textPointer++] = 'F'; | |
200 } | |
201 | |
202 text[textPointer++] = ' '; | |
203 text[textPointer++] = ' '; | |
204 text[textPointer++] = ' '; | |
205 text[textPointer++] = ' '; | |
206 text[textPointer++] = '\027'; | |
207 text[textPointer++] = '/'; | |
208 text[textPointer++] = ' '; | |
209 text[textPointer++] = '0' + data->tX_colorscheme; | |
210 text[textPointer++] = '\020'; | |
211 text[textPointer++] = ' '; | |
212 text[textPointer++] = ' '; | |
213 text[textPointer++] = 'd'; | |
214 text[textPointer++] = 'e'; | |
215 text[textPointer++] = 'b'; | |
216 text[textPointer++] = 'u'; | |
217 text[textPointer++] = 'g'; | |
218 } | |
219 | |
220 text[textPointer++] = '\n'; | |
221 text[textPointer++] = '\r'; | |
222 text[textPointer] = 0; | |
223 } | |
224 else | |
225 { | |
226 strcpy(&text[textPointer],"\n\r"); | |
227 textPointer += 2; | |
228 } | |
229 | |
230 if((line == 0) || (line == 4)) | |
231 { | |
232 text[textPointer++] = TXT_2BYTE; | |
233 text[textPointer++] = TXT2BYTE_Customviews;//TXT2BYTE_ShowDebug; | |
234 } | |
235 text[textPointer++] = '\n'; | |
236 text[textPointer++] = '\r'; | |
237 text[textPointer] = 0; | |
238 | |
239 if((line == 0) || (line == 5)) | |
240 { | |
241 text[textPointer++] = TXT_Information; | |
242 text[textPointer++] = '\t'; | |
243 textPointer += snprintf(&text[textPointer],29,"RTE %u.%u OS %i.%i.%i" | |
244 ,RTEhigh | |
245 ,RTElow | |
246 ,firmwareDataGetPointer()->versionFirst | |
247 ,firmwareDataGetPointer()->versionSecond | |
248 ,firmwareDataGetPointer()->versionThird | |
249 ); | |
250 } | |
251 strcpy(&text[textPointer],"\n\r"); | |
252 textPointer += 2; | |
253 | |
254 if((line == 0) || (line == 6)) | |
255 { | |
256 text[textPointer++] = TXT_2BYTE; | |
257 text[textPointer++] = TXT2BYTE_ResetMenu; | |
258 text[textPointer] = 0; | |
259 } | |
260 strcpy(&text[textPointer],"\n\r"); | |
261 textPointer += 2; | |
262 | |
263 return StMSYS; | |
264 } | |
265 | |
266 | |
267 /* Private functions ---------------------------------------------------------*/ | |
268 | |
269 char customview_TXT2BYTE_helper(uint8_t customViewId) | |
270 { | |
271 char text = 0; | |
272 | |
273 switch(customViewId) | |
274 { | |
275 case CVIEW_sensors: | |
276 text = TXT2BYTE_O2monitor; | |
277 break; | |
278 case CVIEW_sensors_mV: | |
279 text = TXT2BYTE_O2voltage; | |
280 break; | |
281 case CVIEW_Compass: | |
282 text = TXT2BYTE_Compass; | |
283 break; | |
284 case CVIEW_Decolist: | |
285 text = TXT2BYTE_Decolist; | |
286 break; | |
287 case CVIEW_Tissues: | |
288 text = TXT2BYTE_Tissues; | |
289 break; | |
290 case CVIEW_Profile: | |
291 text = TXT2BYTE_Profile; | |
292 break; | |
293 case CVIEW_Gaslist: | |
294 text = TXT2BYTE_Gaslist; | |
295 break; | |
296 case CVIEW_EADTime: | |
297 text = TXT2BYTE_Info; | |
298 break; | |
299 case CVIEW_SummaryOfLeftCorner: | |
300 text = TXT2BYTE_Summary; | |
301 break; | |
302 case CVIEW_noneOrDebug: | |
303 break; | |
304 default: | |
305 break; | |
306 } | |
307 return text; | |
308 } |