Mercurial > public > ostc4
annotate Discovery/Src/tMenuSystem.c @ 914:5ce7708a9095 Evo_2_23
Devbugfix SlowExit depth:
The slow exit time instead of the depth has been shown in the option menu.
author | Ideenmodellierer |
---|---|
date | Sat, 19 Oct 2024 20:06:55 +0200 |
parents | 9f487ad38170 |
children |
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() | |
851 | 33 #include "t7.h" |
38 | 34 |
379 | 35 static uint8_t customviewsSubpage = 0; |
36 | |
38 | 37 /* Private function prototypes -----------------------------------------------*/ |
38 char customview_TXT2BYTE_helper(uint8_t customViewId); | |
39 | |
379 | 40 void set_CustomsviewsSubpage(uint8_t page) |
41 { | |
42 customviewsSubpage = page; | |
43 } | |
44 | |
38 | 45 /* Exported functions --------------------------------------------------------*/ |
46 | |
47 uint32_t tMSystem_refresh(uint8_t line, char *text, uint16_t *tab, char *subtext) | |
48 { | |
49 SSettings *data; | |
379 | 50 int i; |
38 | 51 uint8_t textPointer; |
52 uint8_t dateFormat; | |
53 uint8_t RTEhigh, RTElow; | |
54 RTC_DateTypeDef Sdate; | |
55 RTC_TimeTypeDef Stime; | |
56 const SDiveState * pStateReal = stateRealGetPointer(); | |
57 | |
58 data = settingsGetPointer(); | |
59 textPointer = 0; | |
60 *tab = 300; | |
61 *subtext = 0; | |
62 | |
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
63 resetLineMask(StMSYS); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
64 |
38 | 65 // dive mode |
66 if(actual_menu_content != MENU_SURFACE) | |
67 { | |
68 uint8_t id; | |
69 | |
379 | 70 for(i=0; i<5;i++) /* fill maximum 5 items and leave last one for sub page selection */ |
38 | 71 { |
379 | 72 id = cv_changelist[customviewsSubpage * 5 + i]; |
73 if(id == CVIEW_END) /* last list item? */ | |
74 { | |
75 break; | |
76 } | |
77 else | |
78 { | |
79 text[textPointer++] = '\006' - CHECK_BIT_THOME(data->cv_configuration,id); | |
80 text[textPointer++] = ' '; | |
81 textPointer += snprintf(&text[textPointer], 60, | |
82 "%c%c\n\r", | |
83 TXT_2BYTE, customview_TXT2BYTE_helper(id)); | |
84 } | |
38 | 85 } |
86 | |
379 | 87 for(;i<5;i++) /* clear empty lines in case menu shows less than 5 entries */ |
88 { | |
89 text[textPointer++]='\n'; | |
90 text[textPointer++]='\r'; | |
91 text[textPointer] = 0; | |
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
92 switch(i) |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
93 { |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
94 case 0: disableLine(StMSYS_Custom0); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
95 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
96 case 1: disableLine(StMSYS_Custom1); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
97 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
98 case 2: disableLine(StMSYS_Custom2); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
99 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
100 case 3: disableLine(StMSYS_Custom3); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
101 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
102 case 4: disableLine(StMSYS_Custom4); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
103 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
104 default: |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
105 case 5: disableLine(StMSYS_Custom5); |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
106 break; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
107 } |
379 | 108 } |
109 | |
815
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
110 text[textPointer++] = TXT_2BYTE; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
111 text[textPointer++] = TXT2BYTE_ButtonNext; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
112 text[textPointer] = 0; |
ce8f71217f45
Bugfix CustomView selection during dive mode:
Ideenmodellierer
parents:
805
diff
changeset
|
113 |
38 | 114 return StMSYS; |
115 } | |
116 | |
117 // surface mode | |
139
decb0461302a
Get version from local memory instead from incoming data
Ideenmodellierer
parents:
138
diff
changeset
|
118 getActualRTEandFONTversion(&RTEhigh,&RTElow,NULL,NULL); |
38 | 119 |
120 if((RTEhigh == 0xFF) || (RTElow == 0xFF)) | |
121 { | |
122 RTEhigh = 0; | |
123 RTElow = 0; | |
124 } | |
125 | |
126 if((line == 0) || (line == 1)) | |
127 { | |
128 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | |
129 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | |
130 | |
131 dateFormat = data->date_format; | |
132 | |
133 textPointer += snprintf(&text[textPointer], 40, | |
134 "Date" | |
135 "\016\016" | |
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 | |
175 textPointer += snprintf(&text[textPointer], 60, | |
176 "%02d:%02d:%02d" | |
177 "\n\r" | |
178 ,Stime.Hours, Stime.Minutes, Stime.Seconds | |
179 ); | |
180 } | |
181 else | |
182 { | |
183 strcpy(&text[textPointer],"\n\r"); | |
184 textPointer += 2; | |
185 } | |
186 | |
851 | 187 if (line == 0 || line == 2) |
188 { | |
189 if(t7_customview_disabled(CVIEW_Timer)) | |
190 { | |
191 text[textPointer++] = '\031'; /* change text color */ | |
192 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60); | |
193 disableLine(StMSYS_Timer); | |
194 text[textPointer++] = '\020'; /* restore text color */ | |
195 } | |
196 else | |
197 { | |
198 textPointer += snprintf(&text[textPointer], 21, "%c%c\t%u:%02u \016\016[m:ss]\017\n\r", TXT_2BYTE, TXT2BYTE_Timer, data->timerDurationS / 60, data->timerDurationS % 60); | |
199 } | |
200 } else | |
201 { | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
202 textPointer += snprintf(&text[textPointer], 3, "\n\r"); |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
203 } |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
204 |
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
205 if((line == 0) || (line == 3)) |
38 | 206 { |
207 text[textPointer++] = TXT_Language; | |
208 text[textPointer++] = '\t'; | |
209 text[textPointer++] = TXT_LanguageName; | |
210 text[textPointer++] = '\n'; | |
211 text[textPointer++] = '\r'; | |
212 text[textPointer] = 0; | |
213 } | |
214 else | |
215 { | |
216 strcpy(&text[textPointer],"\n\r"); | |
217 textPointer += 2; | |
218 } | |
219 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
220 if((line == 0) || (line == 4)) |
38 | 221 { |
222 text[textPointer++] = TXT_2BYTE; | |
223 text[textPointer++] = TXT2BYTE_Layout; | |
224 text[textPointer++] = '\t'; | |
225 | |
226 if(!data->showDebugInfo) | |
227 { | |
228 text[textPointer++] = TXT_2BYTE; | |
229 if(data->nonMetricalSystem == 0) | |
230 text[textPointer++] = TXT2BYTE_Units_metric; | |
231 else | |
232 text[textPointer++] = TXT2BYTE_Units_feet; | |
233 | |
234 if(data->tX_colorscheme != 0) | |
235 { | |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
236 text[textPointer++] = ' '; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
237 text[textPointer++] = '/'; |
38 | 238 text[textPointer++] = '\027'; |
239 text[textPointer++] = ' '; | |
240 text[textPointer++] = '0' + data->tX_colorscheme; | |
241 text[textPointer++] = '\020'; | |
242 } | |
243 } | |
244 else | |
245 { | |
246 if(data->nonMetricalSystem == 0) | |
247 { | |
248 text[textPointer++] = 'm'; | |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
249 text[textPointer++] = ' '; |
38 | 250 text[textPointer++] = '/'; |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
251 text[textPointer++] = ' '; |
38 | 252 text[textPointer++] = 'C'; |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
253 text[textPointer++] = ' '; |
38 | 254 } |
255 else | |
256 { | |
257 text[textPointer++] = 'f'; | |
258 text[textPointer++] = 't'; | |
259 text[textPointer++] = ' '; | |
260 text[textPointer++] = '/'; | |
261 text[textPointer++] = ' '; | |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
262 text[textPointer++] = 'F'; |
38 | 263 text[textPointer++] = ' '; |
536
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
264 } |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
265 if(data->tX_colorscheme != 0) |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
266 { |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
267 text[textPointer++] = '/'; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
268 text[textPointer++] = '\027'; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
269 text[textPointer++] = ' '; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
270 text[textPointer++] = '0' + data->tX_colorscheme; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
271 text[textPointer++] = ' '; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
272 text[textPointer++] = '\020'; |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
273 } |
54c5ec8416c4
Changed visualization of Depth / temperatur / debugview entry
Ideenmodellierer
parents:
520
diff
changeset
|
274 text[textPointer++] = '/'; |
38 | 275 text[textPointer++] = ' '; |
276 text[textPointer++] = 'd'; | |
277 text[textPointer++] = 'e'; | |
278 text[textPointer++] = 'b'; | |
279 text[textPointer++] = 'u'; | |
280 text[textPointer++] = 'g'; | |
281 } | |
282 | |
283 text[textPointer++] = '\n'; | |
284 text[textPointer++] = '\r'; | |
285 text[textPointer] = 0; | |
286 } | |
287 else | |
288 { | |
289 strcpy(&text[textPointer],"\n\r"); | |
290 textPointer += 2; | |
291 } | |
292 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
293 if((line == 0) || (line == 5)) |
38 | 294 { |
295 text[textPointer++] = TXT_Information; | |
296 text[textPointer++] = '\t'; | |
297 textPointer += snprintf(&text[textPointer],29,"RTE %u.%u OS %i.%i.%i" | |
298 ,RTEhigh | |
299 ,RTElow | |
300 ,firmwareDataGetPointer()->versionFirst | |
301 ,firmwareDataGetPointer()->versionSecond | |
302 ,firmwareDataGetPointer()->versionThird | |
303 ); | |
304 } | |
305 strcpy(&text[textPointer],"\n\r"); | |
306 textPointer += 2; | |
307 | |
805
dd7ce655db26
Adds a simple countdown timer, available as a custom view in surface and dive mode.
heinrichsweikamp
parents:
536
diff
changeset
|
308 if((line == 0) || (line == 6)) |
38 | 309 { |
310 text[textPointer++] = TXT_2BYTE; | |
311 text[textPointer++] = TXT2BYTE_ResetMenu; | |
312 text[textPointer] = 0; | |
313 } | |
314 strcpy(&text[textPointer],"\n\r"); | |
315 textPointer += 2; | |
316 | |
317 return StMSYS; | |
318 } | |
851 | 319 void tMSystem_checkLineStatus(void) |
320 { | |
321 uint8_t localLineMask = 0; | |
322 uint8_t lineMask = getLineMask(StMSYS); | |
38 | 323 |
851 | 324 if(t7_customview_disabled(CVIEW_Timer)) |
325 { | |
326 localLineMask |= 1 << 2; | |
327 } | |
328 if(lineMask != localLineMask) | |
329 { | |
330 updateMenu(); | |
331 } | |
332 } | |
38 | 333 |
334 /* Private functions ---------------------------------------------------------*/ |