Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditSystem.c @ 186:f11f0bf6ef2d cleanup-2
cleanup: remove obsolete code, make static, etc.
Some rather trivial cleanup things like putting demo code into
ifdefs, making functions static where possible, and against my
normal policy of hard removing unused code, commenting it out
at this point in time. Somehow, I think that this commented code
might be useful in the near future as a new pressure sensor is coming.
And finally, fixed some typo's in comment.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Fri, 15 Mar 2019 12:39:28 +0100 |
parents | cc9c18075e00 |
children | b2a9e9b02df0 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEditSystem.c | |
5 /// \brief Main Template file for Menu Edit 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 "tMenuEditSystem.h" | |
31 | |
138 | 32 #include "data_exchange_main.h" |
38 | 33 #include "externLogbookFlash.h" |
34 #include "gfx_fonts.h" | |
35 #include "ostc.h" | |
36 #include "settings.h" // for getLicence() | |
37 #include "tHome.h" // for enum CUSTOMVIEWS and init_t7_compass() | |
38 #include "tMenuEdit.h" | |
39 | |
40 /* Private variables ---------------------------------------------------------*/ | |
41 | |
42 uint8_t infoPage = 0; | |
43 | |
44 /* Private function prototypes -----------------------------------------------*/ | |
45 void openEdit_DateTime(void); | |
46 void openEdit_Language(void); | |
47 void openEdit_Design(void); | |
48 void openEdit_Customview(void); | |
49 void openEdit_Information(void); | |
50 void openEdit_Reset(void); | |
51 void openEdit_CustomviewDivemode(uint8_t line); | |
52 //void openEdit_ShowDebugInfo(void); | |
53 //void openEdit_Salinity(void); | |
54 | |
55 /* Announced function prototypes -----------------------------------------------*/ | |
56 uint8_t OnAction_Date (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
57 uint8_t OnAction_Time (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
58 uint8_t OnAction_DDMMYY (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
59 uint8_t OnAction_MMDDYY (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
60 uint8_t OnAction_YYMMDD (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
61 uint8_t OnAction_DST (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
62 uint8_t OnAction_English (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
63 uint8_t OnAction_German (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
64 uint8_t OnAction_French (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
65 uint8_t OnAction_Italian (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
66 uint8_t OnAction_Espanol (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
67 //uint8_t OnAction_Design_t7 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
68 //uint8_t OnAction_Design_t7ft (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
69 //uint8_t OnAction_Design_t3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
70 | |
71 uint8_t OnAction_Units (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
72 uint8_t OnAction_Colorscheme (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
73 uint8_t OnAction_DebugInfo (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
74 | |
75 uint8_t OnAction_CViewTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
76 uint8_t OnAction_CViewStandard (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
77 uint8_t OnAction_CornerTimeout (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
78 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
79 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
80 | |
81 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
82 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
83 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
84 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
85 uint8_t OnAction_ResetAll (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
86 uint8_t OnAction_ResetLogbook (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
87 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
88 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
89 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
90 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
91 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
92 #ifdef SCREENTEST | |
93 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
94 #endif | |
95 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
96 /* | |
97 uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
98 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
99 */ | |
100 | |
101 /* Exported functions --------------------------------------------------------*/ | |
102 | |
103 void openEdit_System(uint8_t line) | |
104 { | |
105 set_globalState_Menu_Line(line); | |
106 resetMenuEdit(CLUT_MenuPageSystem); | |
107 | |
108 if(actual_menu_content == MENU_SURFACE) | |
109 { | |
110 switch(line) | |
111 { | |
112 case 1: | |
113 default: | |
114 openEdit_DateTime(); | |
115 break; | |
116 case 2: | |
117 openEdit_Language(); | |
118 break; | |
119 case 3: | |
120 openEdit_Design(); | |
121 break; | |
122 case 4: | |
123 openEdit_Customview(); | |
124 break; | |
125 case 5: | |
126 openEdit_Information(); | |
127 break; | |
128 case 6: | |
129 openEdit_Reset(); | |
130 break; | |
131 /* | |
132 case 3: | |
133 openEdit_DecoFutureTTS(); | |
134 break; | |
135 case 4: | |
136 openEdit_DecoLastStop(); | |
137 break; | |
138 */ | |
139 } | |
140 } | |
141 else | |
142 { | |
143 openEdit_CustomviewDivemode(line); | |
144 } | |
145 | |
146 } | |
147 | |
148 /* Private functions ---------------------------------------------------------*/ | |
149 | |
150 void openEdit_CustomviewDivemode(uint8_t line) | |
151 { | |
152 cv_configuration ^= 1 << (cv_changelist[line-1]); | |
153 exitMenuEdit_to_Menu_with_Menu_Update(); | |
154 } | |
155 | |
156 | |
157 void openEdit_DateTime(void) | |
158 { | |
159 RTC_DateTypeDef Sdate; | |
160 RTC_TimeTypeDef Stime; | |
161 uint8_t day,month,year,hour,minute, dateFormat, ddmmyy, mmddyy, yymmdd; | |
162 char text[32]; | |
163 SSettings *pSettings; | |
164 const SDiveState * pStateReal = stateRealGetPointer(); | |
165 | |
166 pSettings = settingsGetPointer(); | |
167 translateDate(pStateReal->lifeData.dateBinaryFormat, &Sdate); | |
168 translateTime(pStateReal->lifeData.timeBinaryFormat, &Stime); | |
169 year = Sdate.Year; | |
170 month = Sdate.Month; | |
171 day = Sdate.Date; | |
172 hour = Stime.Hours; | |
173 minute= Stime.Minutes; | |
174 | |
175 if(year < 16) | |
176 year = 16; | |
177 | |
178 if(month < 1) | |
179 month = 1; | |
180 | |
181 if(day < 1) | |
182 day = 1; | |
183 | |
184 // daylightsaving = Stime.DayLightSaving; | |
185 dateFormat = pSettings->date_format; | |
186 ddmmyy = 0; | |
187 mmddyy = 0; | |
188 yymmdd = 0; | |
189 | |
190 if(dateFormat == DDMMYY) | |
191 ddmmyy = 1; | |
192 else | |
193 if(dateFormat == MMDDYY) | |
194 mmddyy = 1; | |
195 else | |
196 yymmdd = 1; | |
197 | |
198 text[0] = '\001'; | |
199 text[1] = TXT_DateAndTime; | |
200 text[2] = 0; | |
201 | |
202 write_topline(text); | |
203 | |
204 write_label_fix( 20, 340, ME_Y_LINE1, &FontT42, TXT_TimeConfig); | |
205 write_label_fix( 20, 340, ME_Y_LINE2, &FontT42, TXT_DateConfig); | |
206 write_label_var( 600, 800, ME_Y_LINE2, &FontT48, "\016\016DDMMYY\017"); | |
207 write_label_fix( 20, 790, ME_Y_LINE3, &FontT42, TXT_Format); | |
208 // write_label_fix( 350 ,580, 250, &FontT42, TXT_Daylightsaving); | |
209 | |
210 write_field_2digit(StMSYS1_Time, 320, 780, ME_Y_LINE1, &FontT48, "##:##", (uint32_t)hour, (uint32_t)minute, 0, 0); | |
211 write_field_2digit(StMSYS1_Date, 320, 780, ME_Y_LINE2, &FontT48, "##-##-20##", (uint32_t)day, (uint32_t)month, (uint32_t)year, 0); | |
212 write_field_on_off(StMSYS1_DDMMYY, 320, 790, ME_Y_LINE3, &FontT48, "DDMMYY", ddmmyy); | |
213 write_field_on_off(StMSYS1_MMDDYY, 320, 790, ME_Y_LINE4, &FontT48, "MMDDYY", mmddyy); | |
214 write_field_on_off(StMSYS1_YYMMDD, 320, 790, ME_Y_LINE5, &FontT48, "YYMMDD", yymmdd); | |
215 // write_field_on_off(StMSYS1_DST, 350, 580, 310, &FontT48, "Active", daylightsaving); | |
216 | |
217 setEvent(StMSYS1_Date, (uint32_t)OnAction_Date); | |
218 setEvent(StMSYS1_Time, (uint32_t)OnAction_Time); | |
219 setEvent(StMSYS1_DDMMYY, (uint32_t)OnAction_DDMMYY); | |
220 setEvent(StMSYS1_MMDDYY, (uint32_t)OnAction_MMDDYY); | |
221 setEvent(StMSYS1_YYMMDD, (uint32_t)OnAction_YYMMDD); | |
222 // setEvent(StMSYS1_DST, (uint32_t)OnAction_DST); | |
223 | |
224 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
225 } | |
226 | |
227 | |
228 uint8_t OnAction_Date(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
229 { | |
230 uint8_t digitContentNew; | |
231 uint32_t newDay, newMonth, newYear; | |
232 RTC_DateTypeDef sdatestructure; | |
233 | |
234 | |
235 if(action == ACTION_BUTTON_ENTER) | |
236 { | |
237 return digitContent; | |
238 } | |
239 if(action == ACTION_BUTTON_ENTER_FINAL) | |
240 { | |
241 evaluateNewString(editId, &newDay, &newMonth, &newYear, 0); | |
242 if(newDay == 0) | |
243 newDay = 1; | |
244 if(newDay > 31) | |
245 newDay = 31; | |
246 if(newMonth == 0) | |
247 newMonth = 1; | |
248 if(newMonth > 12) | |
249 newMonth = 12; | |
250 if((newMonth == 2) && (newDay > 29)) | |
251 newDay = 29; | |
252 if((newDay > 30) && ((newMonth == 4) ||(newMonth == 6) ||(newMonth == 9) ||(newMonth == 11))) | |
253 newDay = 30; | |
254 if(newYear < 17) | |
255 newYear = 17; | |
256 if(newYear > 99) | |
257 newYear = 99; | |
258 | |
259 sdatestructure.Date = newDay; | |
260 sdatestructure.Month = newMonth; | |
261 sdatestructure.Year = newYear; | |
262 setWeekday(&sdatestructure); | |
263 | |
264 setDate(sdatestructure); | |
265 | |
266 tMenuEdit_newInput(editId, newDay, newMonth, newYear, 0); | |
267 return UNSPECIFIC_RETURN; | |
268 } | |
269 if(action == ACTION_BUTTON_NEXT) | |
270 { | |
271 digitContentNew = digitContent + 1; | |
272 if((blockNumber == 0) && (digitContentNew > '0' + 31)) | |
273 digitContentNew = '1'; | |
274 if((blockNumber == 1) && (digitContentNew > '0' + 12)) | |
275 digitContentNew = '1'; | |
276 // year range 2017-2018 | |
55
a7683f9765da
Italian activated (needs some fine tuning), special characters (?,?,?,?,? and others) currently not working...
heinrichsweikamp
parents:
38
diff
changeset
|
277 if((blockNumber == 2) && (digitContentNew > '0' + 22)) |
a7683f9765da
Italian activated (needs some fine tuning), special characters (?,?,?,?,? and others) currently not working...
heinrichsweikamp
parents:
38
diff
changeset
|
278 digitContentNew = '0' + 18; |
38 | 279 return digitContentNew; |
280 } | |
281 if(action == ACTION_BUTTON_BACK) | |
282 { | |
283 digitContentNew = digitContent - 1; | |
284 if((blockNumber == 0) && (digitContentNew < '1')) | |
285 digitContentNew = '0' + 31; | |
286 if((blockNumber == 1) && (digitContentNew < '1')) | |
287 digitContentNew = '0' + 12; | |
288 // year range 2016-2018 | |
289 if((blockNumber == 2) && (digitContentNew < '0' + 17)) | |
290 digitContentNew = '0' + 18; | |
291 return digitContentNew; | |
292 } | |
293 /* | |
294 if(action == ACTION_BUTTON_NEXT) | |
295 { | |
296 digitContentNew = digitContent + 1; | |
297 if((blockNumber == 2) && (digitNumber == 0) && (digitContentNew > '2')) | |
298 digitContentNew = '1'; | |
299 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew > '3')) | |
300 digitContentNew = '0'; | |
301 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew > '1')) | |
302 digitContentNew = '0'; | |
303 if(digitContentNew > '9') | |
304 digitContentNew = '0'; | |
305 return digitContentNew; | |
306 } | |
307 if(action == ACTION_BUTTON_BACK) | |
308 { | |
309 digitContentNew = digitContent - 1; | |
310 if((blockNumber == 2) && (digitNumber == 0) && (digitContentNew < '1')) | |
311 digitContentNew = '2'; | |
312 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew < '0')) | |
313 digitContentNew = '3'; | |
314 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew < '0')) | |
315 digitContentNew = '1'; | |
316 if(digitContentNew < '0') | |
317 digitContentNew = '9'; | |
318 return digitContentNew; | |
319 } | |
320 */ | |
321 return UNSPECIFIC_RETURN; | |
322 } | |
323 | |
324 | |
325 uint8_t OnAction_Time(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
326 { | |
327 uint8_t digitContentNew; | |
328 uint32_t newHour, newMinute; | |
329 RTC_TimeTypeDef stimestructure; | |
330 | |
331 if(action == ACTION_BUTTON_ENTER) | |
332 { | |
333 return digitContent; | |
334 } | |
335 if(action == ACTION_BUTTON_ENTER_FINAL) | |
336 { | |
337 evaluateNewString(editId, &newHour, &newMinute, 0, 0); | |
338 if(newHour > 23) | |
339 newHour = 23; | |
340 if(newMinute > 59) | |
341 newMinute = 59; | |
342 | |
343 stimestructure.Hours = newHour; | |
344 stimestructure.Minutes = newMinute; | |
345 stimestructure.Seconds = 0; | |
346 | |
347 setTime(stimestructure); | |
348 | |
349 tMenuEdit_newInput(editId, newHour, newMinute, 0, 0); | |
350 return UNSPECIFIC_RETURN; | |
351 } | |
352 if(action == ACTION_BUTTON_NEXT) | |
353 { | |
354 digitContentNew = digitContent + 1; | |
355 if((blockNumber == 0) && (digitContentNew > '0' + 23)) | |
356 digitContentNew = '0'; | |
357 if((blockNumber == 1) && (digitContentNew > '0' + 59)) | |
358 digitContentNew = '0'; | |
359 return digitContentNew; | |
360 } | |
361 if(action == ACTION_BUTTON_BACK) | |
362 { | |
363 digitContentNew = digitContent - 1; | |
364 if((blockNumber == 0) && (digitContentNew < '0')) | |
365 digitContentNew = '0' + 23; | |
366 if((blockNumber == 1) && (digitContentNew < '0')) | |
367 digitContentNew = '0' + 59; | |
368 return digitContentNew; | |
369 } | |
370 /* | |
371 if(action == ACTION_BUTTON_NEXT) | |
372 { | |
373 digitContentNew = digitContent + 1; | |
374 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew > '2')) | |
375 digitContentNew = '0'; | |
376 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew > '5')) | |
377 digitContentNew = '0'; | |
378 if(digitContentNew > '9') | |
379 digitContentNew = '0'; | |
380 return digitContentNew; | |
381 } | |
382 if(action == ACTION_BUTTON_BACK) | |
383 { | |
384 digitContentNew = digitContent - 1; | |
385 if((blockNumber == 0) && (digitNumber == 0) && (digitContentNew < '0')) | |
386 digitContentNew = '2'; | |
387 if((blockNumber == 1) && (digitNumber == 0) && (digitContentNew < '0')) | |
388 digitContentNew = '5'; | |
389 if(digitContentNew < '0') | |
390 digitContentNew = '9'; | |
391 return digitContentNew; | |
392 } | |
393 */ | |
394 return UNSPECIFIC_RETURN; | |
395 } | |
396 | |
397 | |
398 uint8_t OnAction_DDMMYY(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
399 { | |
400 SSettings *pSettings; | |
401 | |
402 pSettings = settingsGetPointer(); | |
403 pSettings->date_format = DDMMYY; | |
404 | |
405 tMenuEdit_set_on_off(editId, 1); | |
406 tMenuEdit_set_on_off(StMSYS1_MMDDYY, 0); | |
407 tMenuEdit_set_on_off(StMSYS1_YYMMDD, 0); | |
408 | |
409 return UNSPECIFIC_RETURN; | |
410 } | |
411 | |
412 | |
413 uint8_t OnAction_MMDDYY(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
414 { | |
415 SSettings *pSettings; | |
416 | |
417 pSettings = settingsGetPointer(); | |
418 pSettings->date_format = MMDDYY; | |
419 | |
420 tMenuEdit_set_on_off(editId, 1); | |
421 tMenuEdit_set_on_off(StMSYS1_DDMMYY, 0); | |
422 tMenuEdit_set_on_off(StMSYS1_YYMMDD, 0); | |
423 | |
424 return UNSPECIFIC_RETURN; | |
425 } | |
426 | |
427 | |
428 uint8_t OnAction_YYMMDD(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
429 { | |
430 SSettings *pSettings; | |
431 | |
432 pSettings = settingsGetPointer(); | |
433 pSettings->date_format = YYMMDD; | |
434 | |
435 tMenuEdit_set_on_off(editId, 1); | |
436 tMenuEdit_set_on_off(StMSYS1_MMDDYY, 0); | |
437 tMenuEdit_set_on_off(StMSYS1_DDMMYY, 0); | |
438 | |
439 return UNSPECIFIC_RETURN; | |
440 } | |
441 | |
442 | |
443 uint8_t OnAction_DST(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
444 { | |
445 RTC_TimeTypeDef stimestructure; | |
446 uint8_t newDST; | |
447 | |
448 get_RTC_DateTime(0, &stimestructure); | |
449 newDST = stimestructure.DayLightSaving; | |
450 if(newDST) | |
451 newDST = 0; | |
452 else | |
453 newDST = 1; | |
454 stimestructure.DayLightSaving = newDST; | |
455 set_RTC_DateTime(0, &stimestructure); | |
456 | |
457 tMenuEdit_set_on_off(editId, newDST); | |
458 | |
459 return UNSPECIFIC_RETURN; | |
460 } | |
461 | |
462 | |
463 void openEdit_Language(void) | |
464 { | |
465 char text[32]; | |
466 uint8_t actualLanguage, active; | |
467 SSettings *pSettings; | |
468 | |
469 pSettings = settingsGetPointer(); | |
470 actualLanguage = pSettings->selected_language; | |
471 | |
472 text[0] = '\001'; | |
473 text[1] = TXT_Language; | |
474 text[2] = 0; | |
475 write_topline(text); | |
476 | |
477 text[0] = TXT_LanguageName; | |
478 text[1] = 0; | |
479 | |
480 pSettings->selected_language = LANGUAGE_English; | |
481 if( actualLanguage == pSettings->selected_language) | |
482 active = 1; | |
483 else | |
484 active = 0; | |
485 write_field_on_off(StMSYS2_English, 30, 500, ME_Y_LINE1, &FontT48, text, active); | |
486 | |
487 pSettings->selected_language = LANGUAGE_German; | |
488 if( actualLanguage == pSettings->selected_language) | |
489 active = 1; | |
490 else | |
491 active = 0; | |
492 write_field_on_off(StMSYS2_German, 30, 800, ME_Y_LINE2, &FontT48, text, active); | |
493 | |
494 pSettings->selected_language = LANGUAGE_French; | |
495 if( actualLanguage == pSettings->selected_language) | |
496 active = 1; | |
497 else | |
498 active = 0; | |
499 write_field_on_off(StMSYS2_French, 30, 800, ME_Y_LINE3, &FontT48, text, active); | |
55
a7683f9765da
Italian activated (needs some fine tuning), special characters (?,?,?,?,? and others) currently not working...
heinrichsweikamp
parents:
38
diff
changeset
|
500 |
38 | 501 |
502 pSettings->selected_language = LANGUAGE_Italian; | |
503 if( actualLanguage == pSettings->selected_language) | |
504 active = 1; | |
505 else | |
506 active = 0; | |
507 write_field_on_off(StMSYS2_Italian, 30, 800, ME_Y_LINE4, &FontT48, text, active); | |
508 | |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
64
diff
changeset
|
509 |
38 | 510 pSettings->selected_language = LANGUAGE_Espanol; |
511 if( actualLanguage == pSettings->selected_language) | |
512 active = 1; | |
513 else | |
514 active = 0; | |
515 write_field_on_off(StMSYS2_Espanol, 30, 800, ME_Y_LINE5, &FontT48, text, active); | |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
64
diff
changeset
|
516 |
38 | 517 pSettings->selected_language = actualLanguage; |
518 | |
519 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
520 | |
521 setEvent(StMSYS2_English, (uint32_t)OnAction_English); | |
522 setEvent(StMSYS2_German, (uint32_t)OnAction_German); | |
523 setEvent(StMSYS2_French, (uint32_t)OnAction_French); | |
55
a7683f9765da
Italian activated (needs some fine tuning), special characters (?,?,?,?,? and others) currently not working...
heinrichsweikamp
parents:
38
diff
changeset
|
524 setEvent(StMSYS2_Italian, (uint32_t)OnAction_Italian); |
102
4276d56eb37c
hPa instead of mbar, enabled Spanish language
heinrichsweikamp
parents:
64
diff
changeset
|
525 setEvent(StMSYS2_Espanol, (uint32_t)OnAction_Espanol); |
38 | 526 } |
527 | |
528 | |
529 uint8_t OnAction_English (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
530 { | |
531 SSettings *pSettings = settingsGetPointer(); | |
532 pSettings->selected_language = LANGUAGE_English; | |
533 return EXIT_TO_MENU_WITH_LOGO; | |
534 } | |
535 | |
536 | |
537 uint8_t OnAction_German (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
538 { | |
539 SSettings *pSettings = settingsGetPointer(); | |
540 pSettings->selected_language = LANGUAGE_German; | |
541 return EXIT_TO_MENU_WITH_LOGO; | |
542 } | |
543 | |
544 | |
545 uint8_t OnAction_French (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
546 { | |
547 SSettings *pSettings = settingsGetPointer(); | |
548 pSettings->selected_language = LANGUAGE_French; | |
549 return EXIT_TO_MENU_WITH_LOGO; | |
550 } | |
551 | |
552 | |
553 uint8_t OnAction_Italian (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
554 { | |
555 SSettings *pSettings = settingsGetPointer(); | |
556 pSettings->selected_language = LANGUAGE_Italian; | |
557 return EXIT_TO_MENU_WITH_LOGO; | |
558 } | |
559 | |
560 | |
561 uint8_t OnAction_Espanol (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
562 { | |
563 SSettings *pSettings = settingsGetPointer(); | |
564 pSettings->selected_language = LANGUAGE_Espanol; | |
565 return EXIT_TO_MENU_WITH_LOGO; | |
566 } | |
567 | |
568 | |
569 void openEdit_Design(void) | |
570 { | |
571 refresh_Design(); | |
572 | |
573 write_field_button(StMSYS3_Units, 400, 700, ME_Y_LINE1, &FontT48, ""); | |
574 write_field_button(StMSYS3_Colors, 400, 700, ME_Y_LINE2, &FontT48, ""); | |
575 // write_field_button(StMSYS3_Debug, 400, 700, ME_Y_LINE3, &FontT48, ""); | |
576 setEvent(StMSYS3_Units, (uint32_t)OnAction_Units); | |
577 setEvent(StMSYS3_Colors, (uint32_t)OnAction_Colorscheme); | |
578 // setEvent(StMSYS3_Debug, (uint32_t)OnAction_DebugInfo); | |
579 } | |
580 | |
581 | |
582 void refresh_Design(void) | |
583 { | |
584 char text[32]; | |
585 | |
586 // header | |
587 text[0] = '\001'; | |
588 text[1] = TXT_2BYTE; | |
589 text[2] = TXT2BYTE_Layout; | |
590 text[3] = 0; | |
591 write_topline(text); | |
592 | |
593 // units | |
594 text[0] = TXT_2BYTE; | |
595 text[1] = TXT2BYTE_Units; | |
596 text[2] = 0; | |
597 write_label_var( 30, 200, ME_Y_LINE1, &FontT48, text); | |
598 | |
599 if(settingsGetPointer()->nonMetricalSystem) | |
600 { | |
601 text[1] = TXT2BYTE_Units_feet; | |
602 } | |
603 else | |
604 { | |
605 text[1] = TXT2BYTE_Units_metric; | |
606 } | |
607 write_label_var( 400, 700, ME_Y_LINE1, &FontT48, text); | |
608 | |
609 // colorscheme | |
610 text[0] = TXT_2BYTE; | |
611 text[1] = TXT2BYTE_Farbschema; | |
612 text[2] = 0; | |
118
ee7f2cd9b9b4
Enlarge text limits to get string displayed completly
Ideenmodellierer
parents:
103
diff
changeset
|
613 write_label_var( 30, 300, ME_Y_LINE2, &FontT48, text); |
38 | 614 |
615 text[0] = '0' + settingsGetPointer()->tX_colorscheme; | |
616 text[1] = 0; | |
617 write_label_var( 400, 700, ME_Y_LINE2, &FontT48, text); | |
618 | |
619 /* | |
620 // specials | |
621 text[0] = TXT_2BYTE; | |
622 text[1] = TXT2BYTE_ShowDebug; | |
623 text[2] = 0; | |
624 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); | |
625 | |
626 if(settingsGetPointer()->showDebugInfo) | |
627 text[0] = '\005'; | |
628 else | |
629 text[0] = '\006'; | |
630 text[1] = 0; | |
631 write_label_var( 400, 700, ME_Y_LINE3, &FontT48, text); | |
632 */ | |
633 | |
634 // design | |
635 text[0] = TXT_Depth; | |
636 text[1] = 0; | |
637 write_content( 30, 700, ME_Y_LINE4, &FontT24, text, CLUT_Font031); | |
638 write_content( 30, 700, ME_Y_LINE4 + 30 + 70, &FontT48, "___________", CLUT_DIVE_FieldSeperatorLines); | |
639 write_content(280, 700, ME_Y_LINE4 + 30 + 70 - 3, &FontT48, "|", CLUT_DIVE_pluginbox); | |
640 write_content(290, 700, ME_Y_LINE4 + 30 + 70 - 37, &FontT48, "_______________", CLUT_DIVE_pluginbox); | |
641 write_content( 30, 700, ME_Y_LINE4 + 30, &FontT144, "24.7", CLUT_Font027); | |
642 | |
643 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
644 } | |
645 | |
646 | |
647 uint8_t OnAction_Units(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
648 { | |
649 settingsGetPointer()->nonMetricalSystem = !(settingsGetPointer()->nonMetricalSystem); | |
650 return EXIT_TO_MENU_WITH_LOGO;//UPDATE_DIVESETTINGS; | |
651 } | |
652 | |
653 | |
654 uint8_t OnAction_Colorscheme(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
655 { | |
656 uint8_t newColorscheme; | |
657 | |
658 newColorscheme = settingsGetPointer()->tX_colorscheme + 1; | |
659 | |
660 if(newColorscheme > 3) | |
661 newColorscheme = 0; | |
662 | |
663 settingsGetPointer()->tX_colorscheme = newColorscheme; | |
664 GFX_use_colorscheme(newColorscheme); | |
665 tHome_init_compass(); | |
666 return UNSPECIFIC_RETURN; | |
667 } | |
668 | |
669 | |
670 uint8_t OnAction_DebugInfo(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
671 { | |
672 settingsGetPointer()->showDebugInfo = !(settingsGetPointer()->showDebugInfo); | |
673 return UPDATE_DIVESETTINGS; | |
674 } | |
675 | |
676 | |
677 | |
678 | |
679 /* | |
680 uint8_t OnAction_Design_t7ft (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
681 { | |
682 SSettings *pSettings = settingsGetPointer(); | |
683 if((pSettings->design == 7) && pSettings->nonMetricalSystem) | |
684 return EXIT_TO_MENU; | |
685 pSettings->design = 7; | |
686 pSettings->nonMetricalSystem = 1; | |
687 tMenuEdit_set_on_off(StMSYS3_t7, 0); | |
688 tMenuEdit_set_on_off(StMSYS3_t7ft, 1); | |
689 tMenuEdit_set_on_off(StMSYS3_t3, 0); | |
690 return UPDATE_DIVESETTINGS; | |
691 } | |
692 | |
693 | |
694 uint8_t OnAction_Design_t7 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
695 { | |
696 SSettings *pSettings = settingsGetPointer(); | |
697 if((pSettings->design == 7) && (pSettings->nonMetricalSystem == 0)) | |
698 return EXIT_TO_MENU; | |
699 pSettings->design = 7; | |
700 pSettings->nonMetricalSystem = 0; | |
701 tMenuEdit_set_on_off(StMSYS3_t7, 1); | |
702 tMenuEdit_set_on_off(StMSYS3_t7ft, 0); | |
703 tMenuEdit_set_on_off(StMSYS3_t3, 0); | |
704 return UPDATE_DIVESETTINGS; | |
705 } | |
706 | |
707 | |
708 uint8_t OnAction_Design_t3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
709 { | |
710 SSettings *pSettings = settingsGetPointer(); | |
711 if(pSettings->design == 3) | |
712 return EXIT_TO_MENU; | |
713 pSettings->design = 3; | |
714 pSettings->nonMetricalSystem = 0; | |
715 tMenuEdit_set_on_off(StMSYS3_t7, 0); | |
716 tMenuEdit_set_on_off(StMSYS3_t7ft,0); | |
717 tMenuEdit_set_on_off(StMSYS3_t3, 1); | |
718 return UPDATE_DIVESETTINGS; | |
719 } | |
720 */ | |
721 | |
722 | |
723 void openEdit_Customview(void) | |
724 { | |
725 refresh_Customviews(); | |
726 | |
727 write_field_button(StMSYS4_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, ""); | |
728 write_field_button(StMSYS4_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, ""); | |
729 | |
730 write_field_button(StMSYS4_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, ""); | |
731 write_field_button(StMSYS4_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, ""); | |
732 | |
733 write_field_button(StMSYS4_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, ""); | |
734 | |
735 setEvent(StMSYS4_CViewTimeout, (uint32_t)OnAction_CViewTimeout); | |
736 setEvent(StMSYS4_CViewStandard, (uint32_t)OnAction_CViewStandard); | |
737 | |
738 setEvent(StMSYS4_CornerTimeout, (uint32_t)OnAction_CornerTimeout); | |
739 setEvent(StMSYS4_CornerStandard, (uint32_t)OnAction_CornerStandard); | |
740 | |
741 setEvent(StMSYS4_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay); | |
742 } | |
743 | |
744 | |
745 void refresh_Customviews(void) | |
746 { | |
747 char text[32]; | |
748 uint8_t textpointer = 0; | |
749 | |
750 // header | |
751 text[0] = '\001'; | |
752 text[1] = TXT_2BYTE; | |
753 text[2] = TXT2BYTE_Customviews; | |
754 text[3] = 0; | |
755 write_topline(text); | |
756 | |
757 // custom view center return | |
758 textpointer = 0; | |
759 text[textpointer++] = TXT_2BYTE; | |
760 text[textpointer++] = TXT2BYTE_CViewTimeout; | |
761 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_customViewTimeout,TXT_Seconds); | |
762 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text); | |
763 | |
764 // custom view center primary | |
765 text[0] = TXT_2BYTE; | |
766 text[1] = TXT2BYTE_CViewStandard; | |
767 text[2] = ' '; | |
768 text[3] = ' '; | |
769 switch(settingsGetPointer()->tX_customViewPrimary) | |
770 { | |
771 case CVIEW_sensors: | |
772 text[4] = TXT_2BYTE; | |
773 text[5] = TXT2BYTE_O2monitor; | |
774 break; | |
775 case CVIEW_sensors_mV: | |
776 text[4] = TXT_2BYTE; | |
777 text[5] = TXT2BYTE_O2voltage; | |
778 break; | |
779 case CVIEW_Compass: | |
780 text[4] = TXT_2BYTE; | |
781 text[5] = TXT2BYTE_Compass; | |
782 break; | |
783 case CVIEW_Decolist: | |
784 text[4] = TXT_2BYTE; | |
785 text[5] = TXT2BYTE_Decolist; | |
786 break; | |
787 case CVIEW_Tissues: | |
788 text[4] = TXT_2BYTE; | |
789 text[5] = TXT2BYTE_Tissues; | |
790 break; | |
791 case CVIEW_Profile: | |
792 text[4] = TXT_2BYTE; | |
793 text[5] = TXT2BYTE_Profile; | |
794 break; | |
795 case CVIEW_Gaslist: | |
796 text[4] = TXT_2BYTE; | |
797 text[5] = TXT2BYTE_Gaslist; | |
798 break; | |
799 case CVIEW_EADTime: | |
800 text[4] = TXT_2BYTE; | |
801 text[5] = TXT2BYTE_Info; | |
802 break; | |
803 case CVIEW_SummaryOfLeftCorner: | |
804 text[4] = TXT_2BYTE; | |
805 text[5] = TXT2BYTE_Summary; | |
806 break; | |
807 case CVIEW_noneOrDebug: | |
808 text[4] = ' '; | |
809 text[5] = '-'; | |
810 break; | |
811 default: | |
812 snprintf(&text[4],3,"%02u",settingsGetPointer()->tX_customViewPrimary); | |
813 break; | |
814 } | |
815 text[6] = 0; | |
816 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text); | |
817 | |
818 | |
819 // field corner return | |
820 textpointer = 0; | |
821 text[textpointer++] = TXT_2BYTE; | |
822 text[textpointer++] = TXT2BYTE_CornerTimeout; | |
823 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds); | |
824 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); | |
825 | |
826 // field corner primary | |
827 text[0] = TXT_2BYTE; | |
828 text[1] = TXT2BYTE_CornerStandard; | |
829 text[2] = ' '; | |
830 text[3] = ' '; | |
831 switch(settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary) | |
832 { | |
833 /* Temperature */ | |
834 case 1: | |
835 text[4] = TXT_Temperature; | |
836 break; | |
837 /* Average Depth */ | |
838 case 2: | |
839 text[4] = TXT_AvgDepth; | |
840 break; | |
841 /* ppO2 */ | |
842 case 3: | |
843 text[4] = TXT_ppO2; | |
844 break; | |
845 /* Stop Uhr */ | |
846 case 4: | |
847 text[4] = TXT_Stopwatch; | |
848 break; | |
849 /* Ceiling */ | |
850 case 5: | |
851 text[4] = TXT_Ceiling; | |
852 break; | |
853 /* Future TTS */ | |
854 case 6: | |
855 text[4] = TXT_FutureTTS; | |
856 break; | |
857 /* CNS */ | |
858 case 7: | |
859 text[4] = TXT_CNS; | |
860 break; | |
861 /* none */ | |
862 case 0: | |
863 text[4] = '-'; | |
864 break; | |
865 default: | |
866 snprintf(&text[4],2,"%u",settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary); | |
867 break; | |
868 } | |
869 text[5] = 0; | |
870 write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text); | |
871 | |
872 | |
873 // extra display | |
874 text[0] = TXT_2BYTE; | |
875 text[1] = TXT2BYTE_ExtraDisplay; | |
876 text[2] = ' '; | |
877 text[3] = ' '; | |
878 text[4] = TXT_2BYTE; | |
879 switch(settingsGetPointer()->extraDisplay) | |
880 { | |
881 /* BigFont */ | |
882 case EXTRADISPLAY_BIGFONT: | |
883 text[5] = TXT2BYTE_ExtraBigFont; | |
884 break; | |
885 /* DecoGame */ | |
886 case EXTRADISPLAY_DECOGAME: | |
887 text[5] = TXT2BYTE_ExtraDecoGame; | |
888 break; | |
889 /* none */ | |
890 case EXTRADISPLAY_none: | |
891 text[5] = TXT2BYTE_ExtraNone; | |
892 break; | |
893 default: | |
894 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay); | |
895 break; | |
896 } | |
897 text[6] = 0; | |
898 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text); | |
899 | |
900 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
901 } | |
902 | |
903 | |
904 uint8_t OnAction_CViewTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
905 { | |
906 uint8_t value; | |
907 value = settingsGetPointer()->tX_customViewTimeout; | |
908 | |
909 if(value < 5) | |
910 value = 5; | |
911 else if(value < 10) | |
912 value = 10; | |
913 else if(value < 15) | |
914 value = 15; | |
915 else if(value < 20) | |
916 value = 20; | |
917 else if(value < 30) | |
918 value = 30; | |
919 else if(value < 45) | |
920 value = 45; | |
921 else if(value < 60) | |
922 value = 60; | |
923 else | |
924 value = 0; | |
925 | |
926 settingsGetPointer()->tX_customViewTimeout = value; | |
927 return UPDATE_DIVESETTINGS; | |
928 } | |
929 | |
930 | |
931 uint8_t OnAction_CViewStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
932 { | |
933 uint8_t newValue; | |
934 switch(settingsGetPointer()->tX_customViewPrimary) | |
935 { | |
936 case CVIEW_sensors: | |
937 newValue = CVIEW_sensors_mV; | |
938 break; | |
939 case CVIEW_sensors_mV: | |
940 newValue = CVIEW_Compass; | |
941 break; | |
942 case CVIEW_Compass: | |
943 newValue = CVIEW_Decolist; | |
944 break; | |
945 case CVIEW_Decolist: | |
946 newValue = CVIEW_Tissues; | |
947 break; | |
948 case CVIEW_Tissues: | |
949 newValue = CVIEW_Profile; | |
950 break; | |
951 case CVIEW_Profile: | |
952 newValue = CVIEW_Gaslist; | |
953 break; | |
954 case CVIEW_Gaslist: | |
955 newValue = CVIEW_EADTime; | |
956 break; | |
957 case CVIEW_EADTime: | |
958 newValue = CVIEW_SummaryOfLeftCorner; | |
959 break; | |
960 case CVIEW_SummaryOfLeftCorner: | |
961 newValue = CVIEW_noneOrDebug; | |
962 break; | |
963 case CVIEW_noneOrDebug: | |
964 default: | |
138 | 965 newValue = CVIEW_sensors; |
38 | 966 break; |
967 } | |
968 settingsGetPointer()->tX_customViewPrimary = newValue; | |
969 return UPDATE_DIVESETTINGS; | |
970 } | |
971 | |
972 | |
973 uint8_t OnAction_CornerTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
974 { | |
975 uint8_t value; | |
976 value = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; | |
977 | |
978 if(value < 5) | |
979 value = 5; | |
980 else if(value < 10) | |
981 value = 10; | |
982 else if(value < 15) | |
983 value = 15; | |
984 else if(value < 20) | |
985 value = 20; | |
986 else if(value < 30) | |
987 value = 30; | |
988 else if(value < 45) | |
989 value = 45; | |
990 else if(value < 60) | |
991 value = 60; | |
992 else | |
993 value = 0; | |
994 | |
995 settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout = value; | |
996 return UPDATE_DIVESETTINGS; | |
997 } | |
998 | |
999 | |
1000 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1001 { | |
1002 uint8_t value; | |
1003 value = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
1004 | |
1005 value += 1; | |
1006 | |
1007 if(value > 7) | |
1008 value = 0; | |
1009 | |
1010 settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary = value; | |
1011 return UPDATE_DIVESETTINGS; | |
1012 } | |
1013 | |
1014 | |
1015 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1016 { | |
1017 uint8_t newValue; | |
1018 switch(settingsGetPointer()->extraDisplay) | |
1019 { | |
1020 case EXTRADISPLAY_BIGFONT: | |
1021 newValue = EXTRADISPLAY_none; | |
1022 break; | |
1023 case EXTRADISPLAY_DECOGAME: | |
1024 newValue = EXTRADISPLAY_BIGFONT; | |
1025 break; | |
1026 case EXTRADISPLAY_none: | |
1027 newValue = EXTRADISPLAY_BIGFONT; | |
1028 break; | |
1029 default: | |
1030 newValue = EXTRADISPLAY_BIGFONT; | |
1031 break; | |
1032 } | |
1033 settingsGetPointer()->extraDisplay = newValue; | |
1034 return UNSPECIFIC_RETURN; | |
1035 } | |
1036 | |
1037 | |
1038 void openEdit_Information(void) | |
1039 { | |
1040 char text[70]; | |
1041 | |
1042 infoPage = 0; | |
1043 | |
1044 text[0] = '\001'; | |
1045 text[1] = TXT_Information; | |
1046 text[2] = 0; | |
1047 write_topline(text); | |
1048 | |
1049 text[0] = TXT_2BYTE; | |
1050 text[1] = TXT2BYTE_ButtonNext; | |
1051 text[2] = 0; | |
1052 | |
1053 write_field_button(StMSYS5_Info, 30, 800, ME_Y_LINE6, &FontT48, text); | |
1054 | |
1055 setEvent(StMSYS5_Info, (uint32_t)OnAction_Information); | |
1056 } | |
1057 | |
1058 | |
1059 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1060 { | |
1061 resetEnterPressedToStateBeforeButtonAction(); | |
1062 | |
1063 infoPage++; | |
1064 if(infoPage > 3) | |
1065 return EXIT_TO_MENU; | |
1066 else | |
1067 return UNSPECIFIC_RETURN; | |
1068 } | |
1069 | |
1070 | |
1071 void refresh_InformationPage(void) | |
1072 { | |
1073 char text_header[5]; | |
1074 char text_button[5]; | |
1075 char text_content[256]; | |
1076 uint8_t date[3], year,month,day; | |
1077 | |
1078 RTC_DateTypeDef Sdate, Sdate2; | |
1079 float temperature1, temperature2, voltage, offsetTemperature; | |
1080 | |
1081 //RTC_TimeTypeDef Stime; | |
1082 | |
1083 /* | |
1084 SDeviceLine batteryChargeCycles; | |
1085 SDeviceLine batteryChargeCompleteCycles; | |
1086 SDeviceLine temperatureMinimum; | |
1087 SDeviceLine temperatureMaximum; | |
1088 SDeviceLine depthMaximum; | |
1089 SDeviceLine diveCycles; | |
1090 SDeviceLine voltageMinimum; | |
1091 */ | |
1092 | |
1093 switch(infoPage) | |
1094 { | |
1095 case 0: | |
1096 text_header[0] = '\001'; | |
1097 text_header[1] = TXT_Information; | |
1098 text_header[2] = 0; | |
1099 | |
1100 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, "Dive Computer OSTC4"); | |
1101 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, "Design heinrichs/weikamp"); | |
1102 | |
1103 Sdate.Year = firmwareDataGetPointer()->release_year; | |
1104 Sdate.Month = firmwareDataGetPointer()->release_month; | |
1105 Sdate.Date = firmwareDataGetPointer()->release_day; | |
1106 | |
1107 if(settingsGetPointer()->date_format == DDMMYY) | |
1108 { | |
1109 day = 0; | |
1110 month = 1; | |
1111 year = 2; | |
1112 } | |
1113 else | |
1114 if(settingsGetPointer()->date_format == MMDDYY) | |
1115 { | |
1116 day = 1; | |
1117 month = 0; | |
1118 year = 2; | |
1119 } | |
1120 else | |
1121 { | |
1122 day = 2; | |
1123 month = 1; | |
1124 year = 0; | |
1125 } | |
1126 date[day] = Sdate.Date; | |
1127 date[month] = Sdate.Month; | |
1128 date[year] = Sdate.Year; | |
1129 snprintf(text_content,40,"Firmware release date: %02d.%02d.%02d",date[0],date[1],date[2]); | |
1130 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1131 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, "for more information"); | |
64 | 1132 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, "info@heinrichsweikamp.com"); |
38 | 1133 |
1134 text_button[0] = TXT_2BYTE; | |
1135 text_button[1] = TXT2BYTE_ButtonNext; | |
1136 text_button[2] = 0; | |
1137 break; | |
1138 | |
1139 case 1: | |
1140 text_header[0] = '\001'; | |
1141 text_header[1] = TXT_2BYTE; | |
1142 text_header[2] = TXT2BYTE_Usage_Battery; | |
1143 text_header[3] = 0; | |
1144 | |
1145 text_content[0] = TXT_2BYTE; | |
1146 text_content[1] = TXT2BYTE_ChargeCycles; | |
1147 text_content[2] = 0; | |
1148 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
57 | 1149 snprintf(text_content,80,"%ld (%ld)",stateDeviceGetPointer()->batteryChargeCycles.value_int32,stateDeviceGetPointer()->batteryChargeCompleteCycles.value_int32); |
38 | 1150 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); |
1151 | |
1152 translateDate(stateDeviceGetPointer()->batteryChargeCycles.date_rtc_dr, &Sdate); | |
1153 translateDate(stateDeviceGetPointer()->batteryChargeCompleteCycles.date_rtc_dr, &Sdate2); | |
1154 snprintf(text_content,80,"%u.%u.20%02u (%u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1155 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1156 | |
1157 text_content[0] = TXT_2BYTE; | |
1158 text_content[1] = TXT2BYTE_LowestVoltage; | |
1159 text_content[2] = 0; | |
1160 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1161 | |
1162 voltage = ((float)stateDeviceGetPointer()->voltageMinimum.value_int32) / 1000; | |
1163 snprintf(text_content,80,"%0.3fV (%u.%u.20%02u)",voltage, Sdate.Date,Sdate.Month,Sdate.Year); | |
1164 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); | |
1165 | |
1166 text_button[0] = TXT_2BYTE; | |
1167 text_button[1] = TXT2BYTE_ButtonNext; | |
1168 text_button[2] = 0; | |
1169 break; | |
1170 | |
1171 case 2: | |
1172 text_header[0] = '\001'; | |
1173 text_header[1] = TXT_2BYTE; | |
1174 text_header[2] = TXT2BYTE_Usage_Dives; | |
1175 text_header[3] = 0; | |
1176 | |
1177 text_content[0] = TXT_2BYTE; | |
1178 text_content[1] = TXT2BYTE_NumberOfDives; | |
1179 text_content[2] = 0; | |
1180 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
1181 | |
57 | 1182 snprintf(text_content,80,"%ld (%ld)",stateDeviceGetPointer()->diveCycles.value_int32,(stateDeviceGetPointer()->depthMaximum.value_int32 - 1000) / 100); |
38 | 1183 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); |
1184 | |
1185 translateDate(stateDeviceGetPointer()->diveCycles.date_rtc_dr, &Sdate); | |
1186 translateDate(stateDeviceGetPointer()->depthMaximum.date_rtc_dr, &Sdate2); | |
1187 snprintf(text_content,80,"%u.%u.20%02u (%u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1188 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1189 | |
1190 text_content[0] = TXT_2BYTE; | |
1191 text_content[1] = TXT2BYTE_HoursOfOperation; | |
1192 text_content[2] = 0; | |
1193 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1194 | |
57 | 1195 snprintf(text_content,80,"%ld",(stateDeviceGetPointer()->hoursOfOperation.value_int32)/3600); |
38 | 1196 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); |
1197 | |
1198 text_button[0] = TXT_2BYTE; | |
1199 text_button[1] = TXT2BYTE_ButtonNext; | |
1200 text_button[2] = 0; | |
1201 break; | |
1202 | |
1203 case 3: | |
1204 text_header[0] = '\001'; | |
1205 text_header[1] = TXT_2BYTE; | |
1206 text_header[2] = TXT2BYTE_Usage_Environment; | |
1207 text_header[3] = 0; | |
1208 | |
1209 text_content[0] = TXT_2BYTE; | |
1210 text_content[1] = TXT2BYTE_AmbientTemperature; | |
1211 text_content[2] = 0; | |
1212 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
1213 | |
1214 temperature1 = ((float)stateDeviceGetPointer()->temperatureMinimum.value_int32) / 100; | |
1215 temperature2 = ((float)stateDeviceGetPointer()->temperatureMaximum.value_int32) / 100; | |
1216 snprintf(text_content,80,"%0.2f\140C / %0.2f\140C",temperature1,temperature2); | |
1217 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); | |
1218 | |
1219 translateDate(stateDeviceGetPointer()->temperatureMinimum.date_rtc_dr, &Sdate); | |
1220 translateDate(stateDeviceGetPointer()->temperatureMaximum.date_rtc_dr, &Sdate2); | |
1221 snprintf(text_content,80,"(%u.%u.20%02u / %u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1222 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1223 | |
1224 text_content[0] = TXT_2BYTE; | |
1225 text_content[1] = TXT2BYTE_Korrekturwerte; | |
1226 text_content[2] = 0; | |
1227 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1228 | |
1229 offsetTemperature = ((float)settingsGetPointer()->offsetTemperature_centigrad) / 10; | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
1230 snprintf(text_content,80,"%i %s / %0.2f\140C",settingsGetPointer()->offsetPressure_mbar, TEXT_PRESSURE_UNIT, offsetTemperature); |
38 | 1231 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); |
1232 | |
1233 text_button[0] = TXT_2BYTE; | |
1234 text_button[1] = TXT2BYTE_Exit; | |
1235 text_button[2] = 0; | |
1236 break; | |
1237 } | |
1238 | |
1239 write_topline(text_header); | |
1240 tMenuEdit_newButtonText(StMSYS5_Info, text_button); | |
1241 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonNext,0); | |
1242 } | |
1243 | |
1244 | |
1245 void openEdit_Reset(void) | |
1246 { | |
1247 char text[32]; | |
1248 | |
1249 text[0] = '\001'; | |
1250 text[1] = TXT_2BYTE; | |
1251 text[2] = TXT2BYTE_ResetMenu; | |
1252 text[3] = 0; | |
1253 write_topline(text); | |
1254 | |
1255 text[0] = TXT_2BYTE; | |
1256 text[1] = TXT2BYTE_LogbookOffset; | |
1257 text[7] = 0; | |
1258 | |
1259 write_label_var( 30, 400, ME_Y_LINE1, &FontT48, text); | |
1260 | |
1261 write_field_udigit(StMSYS6_LogbookOffset,420, 800, ME_Y_LINE1, &FontT48, "####", settingsGetPointer()->logbookOffset,0,0,0); | |
1262 | |
1263 text[0] = TXT_2BYTE; | |
1264 text[2] = 0; | |
1265 | |
1266 text[1] = TXT2BYTE_ResetAll; | |
1267 write_field_button(StMSYS6_ResetAll, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1268 | |
1269 text[1] = TXT2BYTE_ResetDeco; | |
1270 write_field_button(StMSYS6_ResetDeco, 30, 800, ME_Y_LINE3, &FontT48, text); | |
1271 | |
1272 text[1] = TXT2BYTE_Reboot; | |
1273 write_field_button(StMSYS6_Reboot, 30, 800, ME_Y_LINE4, &FontT48, text); | |
1274 | |
1275 text[1] = TXT2BYTE_Maintenance; | |
1276 write_field_button(StMSYS6_Maintenance, 30, 800, ME_Y_LINE5, &FontT48, text); | |
1277 | |
1278 #ifndef RESETLOGBLOCK | |
1279 text[1] = TXT2BYTE_ResetLogbook; | |
1280 write_field_button(StMSYS6_ResetLogbook,30, 800, ME_Y_LINE6, &FontT48, text); | |
1281 #else | |
1282 text[0] = '\021'; | |
1283 text[1] = TXT_2BYTE; | |
1284 text[2] = TXT2BYTE_ResetLogbook; | |
1285 text[3] = 0; | |
1286 write_field_button(StMSYS6_ResetLogbook,30, 800, ME_Y_LINE6, &FontT48, text); | |
1287 text[0] = TXT_2BYTE; | |
1288 text[2] = 0; | |
1289 #endif | |
1290 | |
1291 setEvent(StMSYS6_LogbookOffset, (uint32_t)OnAction_LogbookOffset); | |
1292 setEvent(StMSYS6_ResetAll, (uint32_t)OnAction_Confirm); | |
1293 setEvent(StMSYS6_ResetDeco, (uint32_t)OnAction_Confirm); | |
1294 setEvent(StMSYS6_Reboot, (uint32_t)OnAction_Confirm); | |
1295 setEvent(StMSYS6_Maintenance, (uint32_t)OnAction_Confirm); | |
1296 #ifndef RESETLOGBLOCK | |
1297 setEvent(StMSYS6_ResetLogbook, (uint32_t)OnAction_Confirm); | |
1298 #else | |
1299 setEvent(StMSYS6_ResetLogbook, (uint32_t)OnAction_Nothing); | |
1300 #endif | |
1301 | |
1302 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1303 } | |
1304 | |
1305 | |
1306 void openEdit_ResetConfirmation(uint32_t editIdOfCaller) | |
1307 { | |
1308 char text[32]; | |
1309 | |
1310 resetMenuEdit(CLUT_MenuPageSystem); | |
1311 | |
1312 text[0] = '\001'; | |
1313 text[1] = TXT_2BYTE; | |
1314 text[2] = TXT2BYTE_AreYouSure; | |
1315 text[3] = 0; | |
1316 write_topline(text); | |
1317 | |
1318 text[0] = TXT_2BYTE; | |
1319 text[2] = 0; | |
1320 text[1] = TXT2BYTE_Abort; | |
1321 | |
1322 write_field_button(StMSYS6_Exit, 30, 800, ME_Y_LINE1, &FontT48, text); | |
1323 | |
1324 text[2] = 0; | |
1325 text[3] = 0; | |
1326 switch(editIdOfCaller) | |
1327 { | |
1328 case StMSYS6_Reboot: | |
1329 case StMSYS6_RebootRTE: | |
1330 case StMSYS6_RebootMainCPU: | |
1331 text[1] = TXT2BYTE_RebootMainCPU; | |
1332 write_field_button(StMSYS6_RebootMainCPU, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1333 text[1] = TXT2BYTE_RebootRTE; | |
1334 write_field_button(StMSYS6_RebootRTE, 30, 800, ME_Y_LINE3, &FontT48, text); | |
1335 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1336 setEvent(StMSYS6_RebootMainCPU, (uint32_t)OnAction_RebootMainCPU); | |
1337 setEvent(StMSYS6_RebootRTE, (uint32_t)OnAction_RebootRTE); | |
1338 text[0] = '\025'; | |
1339 text[1] = TXT_2BYTE; | |
1340 text[2] = TXT2BYTE_DecoDataLost; | |
1341 text[3] = 0; | |
1342 write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
1343 break; | |
1344 | |
1345 case StMSYS6_ResetDeco: | |
1346 text[1] = TXT2BYTE_ResetDeco; | |
1347 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1348 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1349 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetDeco); | |
1350 text[0] = '\025'; | |
1351 text[1] = TXT_2BYTE; | |
1352 text[2] = TXT2BYTE_DecoDataLost; | |
1353 text[3] = 0; | |
1354 write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
1355 break; | |
1356 | |
1357 case StMSYS6_ResetAll: | |
1358 text[1] = TXT2BYTE_ResetAll; | |
1359 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1360 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1361 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetAll); | |
1362 break; | |
1363 | |
1364 case StMSYS6_ResetLogbook: | |
1365 text[1] = TXT2BYTE_ResetLogbook; | |
1366 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1367 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1368 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetLogbook); | |
1369 break; | |
1370 | |
1371 case StMSYS6_Maintenance: | |
1372 case StMSYS6_SetBattCharge: | |
1373 text[0] = TXT_2BYTE; | |
1374 text[1] = TXT2BYTE_SetFactoryDefaults; | |
1375 text[2] = 0; | |
1376 write_field_button(StMSYS6_SetFactoryBC, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1377 | |
1378 if(stateRealGetPointer()->lifeData.battery_charge == 0) | |
1379 { | |
1380 text[0] = TXT_2BYTE; | |
1381 text[1] = TXT2BYTE_SetBatteryCharge; | |
1382 text[2] = 0; | |
1383 snprintf(&text[2],10,": %u%%",settingsGetPointer()->lastKnownBatteryPercentage); | |
1384 write_field_button(StMSYS6_SetBattCharge, 30, 800, ME_Y_LINE3, &FontT48, text); | |
1385 | |
1386 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1387 setEvent(StMSYS6_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); | |
1388 setEvent(StMSYS6_SetBattCharge, (uint32_t)OnAction_SetBatteryCharge); | |
1389 } | |
1390 else | |
1391 { | |
1392 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1393 setEvent(StMSYS6_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); | |
1394 } | |
1395 // write_field_button(StMSYS6_ScreenTest, 30, 800, ME_Y_LINE3, &FontT48, "Screen Test"); | |
1396 // setEvent(StMSYS6_ScreenTest, (uint32_t)OnAction_ScreenTest); | |
1397 | |
1398 text[0] = TXT_2BYTE; | |
1399 text[1] = TXT2BYTE_WarnBatteryLow; | |
1400 text[2] = 0; | |
1401 snprintf(&text[2],10,": %01.2fV",stateRealGetPointer()->lifeData.battery_voltage); | |
1402 write_label_var( 30, 800, ME_Y_LINE4, &FontT42, text); | |
1403 | |
1404 snprintf(&text[0],30,"Code: %X",getLicence()); | |
1405 write_label_var( 30, 800, ME_Y_LINE6, &FontT42, text); | |
1406 break; | |
1407 | |
1408 } | |
1409 | |
1410 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1411 } | |
1412 | |
1413 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1414 { | |
1415 uint8_t digitContentNew; | |
1416 uint32_t newOffset; | |
1417 | |
1418 if(action == ACTION_BUTTON_ENTER) | |
1419 return digitContent; | |
1420 | |
1421 if(action == ACTION_BUTTON_ENTER_FINAL) | |
1422 { | |
1423 evaluateNewString(editId, &newOffset, 0, 0, 0); | |
1424 if(newOffset > 9000) | |
1425 newOffset = 0; | |
1426 tMenuEdit_newInput(editId, newOffset, 0, 0, 0); | |
1427 settingsGetPointer()->logbookOffset = (uint16_t)newOffset; | |
1428 return UPDATE_DIVESETTINGS; | |
1429 } | |
1430 | |
1431 if(action == ACTION_BUTTON_NEXT) | |
1432 { | |
1433 digitContentNew = digitContent + 1; | |
1434 if(digitContentNew > '9') | |
1435 digitContentNew = '0'; | |
1436 return digitContentNew; | |
1437 } | |
1438 | |
1439 if(action == ACTION_BUTTON_BACK) | |
1440 { | |
1441 digitContentNew = digitContent - 1; | |
1442 if(digitContentNew < '0') | |
1443 digitContentNew = '9'; | |
1444 return digitContentNew; | |
1445 } | |
1446 return UNSPECIFIC_RETURN; | |
1447 } | |
1448 | |
1449 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1450 { | |
1451 return UNSPECIFIC_RETURN; | |
1452 } | |
1453 | |
1454 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1455 { | |
1456 return EXIT_TO_MENU; | |
1457 } | |
1458 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1459 { | |
1460 openEdit_ResetConfirmation(editId); | |
1461 return UNSPECIFIC_RETURN; | |
1462 } | |
1463 | |
1464 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1465 { | |
1466 MX_SmallCPU_Reset_To_Standard(); | |
1467 return EXIT_TO_MENU; | |
1468 } | |
1469 | |
1470 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1471 { | |
1472 clearDeco(); | |
1473 return EXIT_TO_MENU; | |
1474 } | |
1475 | |
1476 uint8_t OnAction_ResetAll (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1477 { | |
1478 set_settings_to_Standard(); | |
1479 check_and_correct_settings(); | |
1480 | |
1481 return UPDATE_AND_EXIT_TO_HOME; | |
1482 } | |
1483 | |
1484 uint8_t OnAction_ResetLogbook (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1485 { | |
1486 write_label_var( 430, 740, 350, &FontT42, "Wait"); | |
1487 ext_flash_erase_logbook(); | |
1488 | |
1489 SSettings * pSettings = settingsGetPointer(); | |
1490 pSettings->lastDiveLogId = 255; | |
1491 pSettings->logFlashNextSampleStartAddress = 0; | |
1492 | |
1493 return EXIT_TO_MENU; | |
1494 } | |
1495 | |
1496 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1497 { | |
1498 settingsGetPointer()->showDebugInfo = 0; | |
1499 extern uint8_t bootToBootloader; | |
1500 bootToBootloader = 1; | |
1501 return UNSPECIFIC_RETURN; | |
1502 } | |
1503 | |
1504 | |
1505 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1506 { | |
1507 settingsWriteFactoryDefaults(settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->buttonBalance); | |
1508 return EXIT_TO_MENU; | |
1509 } | |
1510 | |
1511 | |
1512 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1513 { | |
1514 setBatteryPercentage(settingsGetPointer()->lastKnownBatteryPercentage); | |
1515 // setBatteryPercentage(100); | |
1516 return EXIT_TO_MENU; | |
1517 } | |
1518 | |
1519 #ifdef SCREENTEST | |
1520 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1521 { | |
1522 static uint8_t FrameCount = 1; // 0 is invisible frame | |
1523 char text[5]; | |
1524 GFX_DrawCfgScreen tTestScreen; | |
1525 tTestScreen.FBStartAdress = 0; | |
1526 tTestScreen.ImageHeight = 480; | |
1527 tTestScreen.ImageWidth = 800; | |
1528 tTestScreen.LayerIndex = 1; | |
1529 | |
1530 set_globalState(StMSYS6_ScreenTest); | |
1531 tTestScreen.FBStartAdress = getFrameByNumber(FrameCount); | |
1532 if(tTestScreen.FBStartAdress == 0) | |
1533 { | |
1534 extern uint8_t bootToBootloader; | |
1535 bootToBootloader = 1; | |
1536 } | |
1537 GFX_fill_buffer(tTestScreen.FBStartAdress, 0xFF, FrameCount); | |
1538 snprintf(text,5,"%u",FrameCount); | |
1539 Gfx_write_label_var(&tTestScreen, 10,100,10,&FontT48,CLUT_Font027,text); | |
1540 GFX_SetFramesTopBottom(tTestScreen.FBStartAdress, NULL,480); | |
1541 FrameCount++; | |
1542 } | |
1543 #endif | |
1544 /* | |
1545 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1546 { | |
1547 write_label_var( 430, 740, 350, &FontT42, "Wait"); | |
1548 | |
1549 test_log_only(20, 5); | |
1550 test_log_only(30, 10); | |
1551 ext_flash_write_settings(); | |
1552 return EXIT_TO_MENU; | |
1553 } | |
1554 */ | |
1555 |