Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditSystem.c @ 131:f35e53ef04e0 FlipDisplay
Update of configuration and projectfiles to support new library folder structure
author | Ideenmodellierer |
---|---|
date | Sun, 17 Feb 2019 21:29:38 +0100 |
parents | ee7f2cd9b9b4 |
children | cc9c18075e00 |
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 | |
32 #include "data_exchange_main.h" // for DataEX_scooterDataFound() | |
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_Scooter: | |
772 text[4] = TXT_2BYTE; | |
773 text[5] = TXT2BYTE_ScooterMonitor; | |
774 break; | |
775 case CVIEW_sensors: | |
776 text[4] = TXT_2BYTE; | |
777 text[5] = TXT2BYTE_O2monitor; | |
778 break; | |
779 case CVIEW_sensors_mV: | |
780 text[4] = TXT_2BYTE; | |
781 text[5] = TXT2BYTE_O2voltage; | |
782 break; | |
783 case CVIEW_Compass: | |
784 text[4] = TXT_2BYTE; | |
785 text[5] = TXT2BYTE_Compass; | |
786 break; | |
787 case CVIEW_Decolist: | |
788 text[4] = TXT_2BYTE; | |
789 text[5] = TXT2BYTE_Decolist; | |
790 break; | |
791 case CVIEW_Tissues: | |
792 text[4] = TXT_2BYTE; | |
793 text[5] = TXT2BYTE_Tissues; | |
794 break; | |
795 case CVIEW_Profile: | |
796 text[4] = TXT_2BYTE; | |
797 text[5] = TXT2BYTE_Profile; | |
798 break; | |
799 case CVIEW_Gaslist: | |
800 text[4] = TXT_2BYTE; | |
801 text[5] = TXT2BYTE_Gaslist; | |
802 break; | |
803 case CVIEW_EADTime: | |
804 text[4] = TXT_2BYTE; | |
805 text[5] = TXT2BYTE_Info; | |
806 break; | |
807 case CVIEW_SummaryOfLeftCorner: | |
808 text[4] = TXT_2BYTE; | |
809 text[5] = TXT2BYTE_Summary; | |
810 break; | |
811 case CVIEW_noneOrDebug: | |
812 text[4] = ' '; | |
813 text[5] = '-'; | |
814 break; | |
815 default: | |
816 snprintf(&text[4],3,"%02u",settingsGetPointer()->tX_customViewPrimary); | |
817 break; | |
818 } | |
819 text[6] = 0; | |
820 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text); | |
821 | |
822 | |
823 // field corner return | |
824 textpointer = 0; | |
825 text[textpointer++] = TXT_2BYTE; | |
826 text[textpointer++] = TXT2BYTE_CornerTimeout; | |
827 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds); | |
828 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text); | |
829 | |
830 // field corner primary | |
831 text[0] = TXT_2BYTE; | |
832 text[1] = TXT2BYTE_CornerStandard; | |
833 text[2] = ' '; | |
834 text[3] = ' '; | |
835 switch(settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary) | |
836 { | |
837 /* Temperature */ | |
838 case 1: | |
839 text[4] = TXT_Temperature; | |
840 break; | |
841 /* Average Depth */ | |
842 case 2: | |
843 text[4] = TXT_AvgDepth; | |
844 break; | |
845 /* ppO2 */ | |
846 case 3: | |
847 text[4] = TXT_ppO2; | |
848 break; | |
849 /* Stop Uhr */ | |
850 case 4: | |
851 text[4] = TXT_Stopwatch; | |
852 break; | |
853 /* Ceiling */ | |
854 case 5: | |
855 text[4] = TXT_Ceiling; | |
856 break; | |
857 /* Future TTS */ | |
858 case 6: | |
859 text[4] = TXT_FutureTTS; | |
860 break; | |
861 /* CNS */ | |
862 case 7: | |
863 text[4] = TXT_CNS; | |
864 break; | |
865 /* none */ | |
866 case 0: | |
867 text[4] = '-'; | |
868 break; | |
869 default: | |
870 snprintf(&text[4],2,"%u",settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary); | |
871 break; | |
872 } | |
873 text[5] = 0; | |
874 write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text); | |
875 | |
876 | |
877 // extra display | |
878 text[0] = TXT_2BYTE; | |
879 text[1] = TXT2BYTE_ExtraDisplay; | |
880 text[2] = ' '; | |
881 text[3] = ' '; | |
882 text[4] = TXT_2BYTE; | |
883 switch(settingsGetPointer()->extraDisplay) | |
884 { | |
885 /* BigFont */ | |
886 case EXTRADISPLAY_BIGFONT: | |
887 text[5] = TXT2BYTE_ExtraBigFont; | |
888 break; | |
889 /* DecoGame */ | |
890 case EXTRADISPLAY_DECOGAME: | |
891 text[5] = TXT2BYTE_ExtraDecoGame; | |
892 break; | |
893 /* none */ | |
894 case EXTRADISPLAY_none: | |
895 text[5] = TXT2BYTE_ExtraNone; | |
896 break; | |
897 default: | |
898 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay); | |
899 break; | |
900 } | |
901 text[6] = 0; | |
902 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text); | |
903 | |
904 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
905 } | |
906 | |
907 | |
908 uint8_t OnAction_CViewTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
909 { | |
910 uint8_t value; | |
911 value = settingsGetPointer()->tX_customViewTimeout; | |
912 | |
913 if(value < 5) | |
914 value = 5; | |
915 else if(value < 10) | |
916 value = 10; | |
917 else if(value < 15) | |
918 value = 15; | |
919 else if(value < 20) | |
920 value = 20; | |
921 else if(value < 30) | |
922 value = 30; | |
923 else if(value < 45) | |
924 value = 45; | |
925 else if(value < 60) | |
926 value = 60; | |
927 else | |
928 value = 0; | |
929 | |
930 settingsGetPointer()->tX_customViewTimeout = value; | |
931 return UPDATE_DIVESETTINGS; | |
932 } | |
933 | |
934 | |
935 uint8_t OnAction_CViewStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
936 { | |
937 uint8_t newValue; | |
938 switch(settingsGetPointer()->tX_customViewPrimary) | |
939 { | |
940 case CVIEW_Scooter: | |
941 newValue = CVIEW_sensors; | |
942 break; | |
943 case CVIEW_sensors: | |
944 newValue = CVIEW_sensors_mV; | |
945 break; | |
946 case CVIEW_sensors_mV: | |
947 newValue = CVIEW_Compass; | |
948 break; | |
949 case CVIEW_Compass: | |
950 newValue = CVIEW_Decolist; | |
951 break; | |
952 case CVIEW_Decolist: | |
953 newValue = CVIEW_Tissues; | |
954 break; | |
955 case CVIEW_Tissues: | |
956 newValue = CVIEW_Profile; | |
957 break; | |
958 case CVIEW_Profile: | |
959 newValue = CVIEW_Gaslist; | |
960 break; | |
961 case CVIEW_Gaslist: | |
962 newValue = CVIEW_EADTime; | |
963 break; | |
964 case CVIEW_EADTime: | |
965 newValue = CVIEW_SummaryOfLeftCorner; | |
966 break; | |
967 case CVIEW_SummaryOfLeftCorner: | |
968 newValue = CVIEW_noneOrDebug; | |
969 break; | |
970 case CVIEW_noneOrDebug: | |
971 default: | |
972 if(getLicence() == LICENCEBONEX) | |
973 newValue = CVIEW_Scooter; | |
974 else | |
975 newValue = CVIEW_sensors; | |
976 break; | |
977 } | |
978 settingsGetPointer()->tX_customViewPrimary = newValue; | |
979 return UPDATE_DIVESETTINGS; | |
980 } | |
981 | |
982 | |
983 uint8_t OnAction_CornerTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
984 { | |
985 uint8_t value; | |
986 value = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout; | |
987 | |
988 if(value < 5) | |
989 value = 5; | |
990 else if(value < 10) | |
991 value = 10; | |
992 else if(value < 15) | |
993 value = 15; | |
994 else if(value < 20) | |
995 value = 20; | |
996 else if(value < 30) | |
997 value = 30; | |
998 else if(value < 45) | |
999 value = 45; | |
1000 else if(value < 60) | |
1001 value = 60; | |
1002 else | |
1003 value = 0; | |
1004 | |
1005 settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout = value; | |
1006 return UPDATE_DIVESETTINGS; | |
1007 } | |
1008 | |
1009 | |
1010 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1011 { | |
1012 uint8_t value; | |
1013 value = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary; | |
1014 | |
1015 value += 1; | |
1016 | |
1017 if(value > 7) | |
1018 value = 0; | |
1019 | |
1020 settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary = value; | |
1021 return UPDATE_DIVESETTINGS; | |
1022 } | |
1023 | |
1024 | |
1025 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1026 { | |
1027 uint8_t newValue; | |
1028 switch(settingsGetPointer()->extraDisplay) | |
1029 { | |
1030 case EXTRADISPLAY_BIGFONT: | |
1031 newValue = EXTRADISPLAY_none; | |
1032 break; | |
1033 case EXTRADISPLAY_DECOGAME: | |
1034 newValue = EXTRADISPLAY_BIGFONT; | |
1035 break; | |
1036 case EXTRADISPLAY_none: | |
1037 newValue = EXTRADISPLAY_BIGFONT; | |
1038 break; | |
1039 default: | |
1040 newValue = EXTRADISPLAY_BIGFONT; | |
1041 break; | |
1042 } | |
1043 settingsGetPointer()->extraDisplay = newValue; | |
1044 return UNSPECIFIC_RETURN; | |
1045 } | |
1046 | |
1047 | |
1048 void openEdit_Information(void) | |
1049 { | |
1050 char text[70]; | |
1051 | |
1052 infoPage = 0; | |
1053 | |
1054 text[0] = '\001'; | |
1055 text[1] = TXT_Information; | |
1056 text[2] = 0; | |
1057 write_topline(text); | |
1058 | |
1059 text[0] = TXT_2BYTE; | |
1060 text[1] = TXT2BYTE_ButtonNext; | |
1061 text[2] = 0; | |
1062 | |
1063 write_field_button(StMSYS5_Info, 30, 800, ME_Y_LINE6, &FontT48, text); | |
1064 | |
1065 setEvent(StMSYS5_Info, (uint32_t)OnAction_Information); | |
1066 } | |
1067 | |
1068 | |
1069 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1070 { | |
1071 resetEnterPressedToStateBeforeButtonAction(); | |
1072 | |
1073 infoPage++; | |
1074 if(infoPage > 3) | |
1075 return EXIT_TO_MENU; | |
1076 else | |
1077 return UNSPECIFIC_RETURN; | |
1078 } | |
1079 | |
1080 | |
1081 void refresh_InformationPage(void) | |
1082 { | |
1083 char text_header[5]; | |
1084 char text_button[5]; | |
1085 char text_content[256]; | |
1086 uint8_t date[3], year,month,day; | |
1087 | |
1088 RTC_DateTypeDef Sdate, Sdate2; | |
1089 float temperature1, temperature2, voltage, offsetTemperature; | |
1090 | |
1091 //RTC_TimeTypeDef Stime; | |
1092 | |
1093 /* | |
1094 SDeviceLine batteryChargeCycles; | |
1095 SDeviceLine batteryChargeCompleteCycles; | |
1096 SDeviceLine temperatureMinimum; | |
1097 SDeviceLine temperatureMaximum; | |
1098 SDeviceLine depthMaximum; | |
1099 SDeviceLine diveCycles; | |
1100 SDeviceLine voltageMinimum; | |
1101 */ | |
1102 | |
1103 switch(infoPage) | |
1104 { | |
1105 case 0: | |
1106 text_header[0] = '\001'; | |
1107 text_header[1] = TXT_Information; | |
1108 text_header[2] = 0; | |
1109 | |
1110 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, "Dive Computer OSTC4"); | |
1111 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, "Design heinrichs/weikamp"); | |
1112 | |
1113 Sdate.Year = firmwareDataGetPointer()->release_year; | |
1114 Sdate.Month = firmwareDataGetPointer()->release_month; | |
1115 Sdate.Date = firmwareDataGetPointer()->release_day; | |
1116 | |
1117 if(settingsGetPointer()->date_format == DDMMYY) | |
1118 { | |
1119 day = 0; | |
1120 month = 1; | |
1121 year = 2; | |
1122 } | |
1123 else | |
1124 if(settingsGetPointer()->date_format == MMDDYY) | |
1125 { | |
1126 day = 1; | |
1127 month = 0; | |
1128 year = 2; | |
1129 } | |
1130 else | |
1131 { | |
1132 day = 2; | |
1133 month = 1; | |
1134 year = 0; | |
1135 } | |
1136 date[day] = Sdate.Date; | |
1137 date[month] = Sdate.Month; | |
1138 date[year] = Sdate.Year; | |
1139 snprintf(text_content,40,"Firmware release date: %02d.%02d.%02d",date[0],date[1],date[2]); | |
1140 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1141 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, "for more information"); | |
64 | 1142 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, "info@heinrichsweikamp.com"); |
38 | 1143 |
1144 text_button[0] = TXT_2BYTE; | |
1145 text_button[1] = TXT2BYTE_ButtonNext; | |
1146 text_button[2] = 0; | |
1147 break; | |
1148 | |
1149 case 1: | |
1150 text_header[0] = '\001'; | |
1151 text_header[1] = TXT_2BYTE; | |
1152 text_header[2] = TXT2BYTE_Usage_Battery; | |
1153 text_header[3] = 0; | |
1154 | |
1155 text_content[0] = TXT_2BYTE; | |
1156 text_content[1] = TXT2BYTE_ChargeCycles; | |
1157 text_content[2] = 0; | |
1158 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
57 | 1159 snprintf(text_content,80,"%ld (%ld)",stateDeviceGetPointer()->batteryChargeCycles.value_int32,stateDeviceGetPointer()->batteryChargeCompleteCycles.value_int32); |
38 | 1160 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); |
1161 | |
1162 translateDate(stateDeviceGetPointer()->batteryChargeCycles.date_rtc_dr, &Sdate); | |
1163 translateDate(stateDeviceGetPointer()->batteryChargeCompleteCycles.date_rtc_dr, &Sdate2); | |
1164 snprintf(text_content,80,"%u.%u.20%02u (%u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1165 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1166 | |
1167 text_content[0] = TXT_2BYTE; | |
1168 text_content[1] = TXT2BYTE_LowestVoltage; | |
1169 text_content[2] = 0; | |
1170 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1171 | |
1172 voltage = ((float)stateDeviceGetPointer()->voltageMinimum.value_int32) / 1000; | |
1173 snprintf(text_content,80,"%0.3fV (%u.%u.20%02u)",voltage, Sdate.Date,Sdate.Month,Sdate.Year); | |
1174 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); | |
1175 | |
1176 text_button[0] = TXT_2BYTE; | |
1177 text_button[1] = TXT2BYTE_ButtonNext; | |
1178 text_button[2] = 0; | |
1179 break; | |
1180 | |
1181 case 2: | |
1182 text_header[0] = '\001'; | |
1183 text_header[1] = TXT_2BYTE; | |
1184 text_header[2] = TXT2BYTE_Usage_Dives; | |
1185 text_header[3] = 0; | |
1186 | |
1187 text_content[0] = TXT_2BYTE; | |
1188 text_content[1] = TXT2BYTE_NumberOfDives; | |
1189 text_content[2] = 0; | |
1190 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
1191 | |
57 | 1192 snprintf(text_content,80,"%ld (%ld)",stateDeviceGetPointer()->diveCycles.value_int32,(stateDeviceGetPointer()->depthMaximum.value_int32 - 1000) / 100); |
38 | 1193 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); |
1194 | |
1195 translateDate(stateDeviceGetPointer()->diveCycles.date_rtc_dr, &Sdate); | |
1196 translateDate(stateDeviceGetPointer()->depthMaximum.date_rtc_dr, &Sdate2); | |
1197 snprintf(text_content,80,"%u.%u.20%02u (%u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1198 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1199 | |
1200 text_content[0] = TXT_2BYTE; | |
1201 text_content[1] = TXT2BYTE_HoursOfOperation; | |
1202 text_content[2] = 0; | |
1203 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1204 | |
57 | 1205 snprintf(text_content,80,"%ld",(stateDeviceGetPointer()->hoursOfOperation.value_int32)/3600); |
38 | 1206 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); |
1207 | |
1208 text_button[0] = TXT_2BYTE; | |
1209 text_button[1] = TXT2BYTE_ButtonNext; | |
1210 text_button[2] = 0; | |
1211 break; | |
1212 | |
1213 case 3: | |
1214 text_header[0] = '\001'; | |
1215 text_header[1] = TXT_2BYTE; | |
1216 text_header[2] = TXT2BYTE_Usage_Environment; | |
1217 text_header[3] = 0; | |
1218 | |
1219 text_content[0] = TXT_2BYTE; | |
1220 text_content[1] = TXT2BYTE_AmbientTemperature; | |
1221 text_content[2] = 0; | |
1222 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, text_content); | |
1223 | |
1224 temperature1 = ((float)stateDeviceGetPointer()->temperatureMinimum.value_int32) / 100; | |
1225 temperature2 = ((float)stateDeviceGetPointer()->temperatureMaximum.value_int32) / 100; | |
1226 snprintf(text_content,80,"%0.2f\140C / %0.2f\140C",temperature1,temperature2); | |
1227 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, text_content); | |
1228 | |
1229 translateDate(stateDeviceGetPointer()->temperatureMinimum.date_rtc_dr, &Sdate); | |
1230 translateDate(stateDeviceGetPointer()->temperatureMaximum.date_rtc_dr, &Sdate2); | |
1231 snprintf(text_content,80,"(%u.%u.20%02u / %u.%u.20%02u)",Sdate.Date,Sdate.Month,Sdate.Year, Sdate2.Date,Sdate2.Month,Sdate2.Year); | |
1232 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content); | |
1233 | |
1234 text_content[0] = TXT_2BYTE; | |
1235 text_content[1] = TXT2BYTE_Korrekturwerte; | |
1236 text_content[2] = 0; | |
1237 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, text_content); | |
1238 | |
1239 offsetTemperature = ((float)settingsGetPointer()->offsetTemperature_centigrad) / 10; | |
103
f5d2f02dc73f
Generalize TEXT of pressure unit
Dmitry Romanov <kitt@bk.ru>
parents:
102
diff
changeset
|
1240 snprintf(text_content,80,"%i %s / %0.2f\140C",settingsGetPointer()->offsetPressure_mbar, TEXT_PRESSURE_UNIT, offsetTemperature); |
38 | 1241 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, text_content); |
1242 | |
1243 text_button[0] = TXT_2BYTE; | |
1244 text_button[1] = TXT2BYTE_Exit; | |
1245 text_button[2] = 0; | |
1246 break; | |
1247 } | |
1248 | |
1249 write_topline(text_header); | |
1250 tMenuEdit_newButtonText(StMSYS5_Info, text_button); | |
1251 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonNext,0); | |
1252 } | |
1253 | |
1254 | |
1255 void openEdit_Reset(void) | |
1256 { | |
1257 char text[32]; | |
1258 | |
1259 text[0] = '\001'; | |
1260 text[1] = TXT_2BYTE; | |
1261 text[2] = TXT2BYTE_ResetMenu; | |
1262 text[3] = 0; | |
1263 write_topline(text); | |
1264 | |
1265 text[0] = TXT_2BYTE; | |
1266 text[1] = TXT2BYTE_LogbookOffset; | |
1267 text[7] = 0; | |
1268 | |
1269 write_label_var( 30, 400, ME_Y_LINE1, &FontT48, text); | |
1270 | |
1271 write_field_udigit(StMSYS6_LogbookOffset,420, 800, ME_Y_LINE1, &FontT48, "####", settingsGetPointer()->logbookOffset,0,0,0); | |
1272 | |
1273 text[0] = TXT_2BYTE; | |
1274 text[2] = 0; | |
1275 | |
1276 text[1] = TXT2BYTE_ResetAll; | |
1277 write_field_button(StMSYS6_ResetAll, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1278 | |
1279 text[1] = TXT2BYTE_ResetDeco; | |
1280 write_field_button(StMSYS6_ResetDeco, 30, 800, ME_Y_LINE3, &FontT48, text); | |
1281 | |
1282 text[1] = TXT2BYTE_Reboot; | |
1283 write_field_button(StMSYS6_Reboot, 30, 800, ME_Y_LINE4, &FontT48, text); | |
1284 | |
1285 text[1] = TXT2BYTE_Maintenance; | |
1286 write_field_button(StMSYS6_Maintenance, 30, 800, ME_Y_LINE5, &FontT48, text); | |
1287 | |
1288 #ifndef RESETLOGBLOCK | |
1289 text[1] = TXT2BYTE_ResetLogbook; | |
1290 write_field_button(StMSYS6_ResetLogbook,30, 800, ME_Y_LINE6, &FontT48, text); | |
1291 #else | |
1292 text[0] = '\021'; | |
1293 text[1] = TXT_2BYTE; | |
1294 text[2] = TXT2BYTE_ResetLogbook; | |
1295 text[3] = 0; | |
1296 write_field_button(StMSYS6_ResetLogbook,30, 800, ME_Y_LINE6, &FontT48, text); | |
1297 text[0] = TXT_2BYTE; | |
1298 text[2] = 0; | |
1299 #endif | |
1300 | |
1301 setEvent(StMSYS6_LogbookOffset, (uint32_t)OnAction_LogbookOffset); | |
1302 setEvent(StMSYS6_ResetAll, (uint32_t)OnAction_Confirm); | |
1303 setEvent(StMSYS6_ResetDeco, (uint32_t)OnAction_Confirm); | |
1304 setEvent(StMSYS6_Reboot, (uint32_t)OnAction_Confirm); | |
1305 setEvent(StMSYS6_Maintenance, (uint32_t)OnAction_Confirm); | |
1306 #ifndef RESETLOGBLOCK | |
1307 setEvent(StMSYS6_ResetLogbook, (uint32_t)OnAction_Confirm); | |
1308 #else | |
1309 setEvent(StMSYS6_ResetLogbook, (uint32_t)OnAction_Nothing); | |
1310 #endif | |
1311 | |
1312 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1313 } | |
1314 | |
1315 | |
1316 void openEdit_ResetConfirmation(uint32_t editIdOfCaller) | |
1317 { | |
1318 char text[32]; | |
1319 | |
1320 resetMenuEdit(CLUT_MenuPageSystem); | |
1321 | |
1322 text[0] = '\001'; | |
1323 text[1] = TXT_2BYTE; | |
1324 text[2] = TXT2BYTE_AreYouSure; | |
1325 text[3] = 0; | |
1326 write_topline(text); | |
1327 | |
1328 text[0] = TXT_2BYTE; | |
1329 text[2] = 0; | |
1330 text[1] = TXT2BYTE_Abort; | |
1331 | |
1332 write_field_button(StMSYS6_Exit, 30, 800, ME_Y_LINE1, &FontT48, text); | |
1333 | |
1334 text[2] = 0; | |
1335 text[3] = 0; | |
1336 switch(editIdOfCaller) | |
1337 { | |
1338 case StMSYS6_Reboot: | |
1339 case StMSYS6_RebootRTE: | |
1340 case StMSYS6_RebootMainCPU: | |
1341 text[1] = TXT2BYTE_RebootMainCPU; | |
1342 write_field_button(StMSYS6_RebootMainCPU, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1343 text[1] = TXT2BYTE_RebootRTE; | |
1344 write_field_button(StMSYS6_RebootRTE, 30, 800, ME_Y_LINE3, &FontT48, text); | |
1345 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1346 setEvent(StMSYS6_RebootMainCPU, (uint32_t)OnAction_RebootMainCPU); | |
1347 setEvent(StMSYS6_RebootRTE, (uint32_t)OnAction_RebootRTE); | |
1348 text[0] = '\025'; | |
1349 text[1] = TXT_2BYTE; | |
1350 text[2] = TXT2BYTE_DecoDataLost; | |
1351 text[3] = 0; | |
1352 write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
1353 break; | |
1354 | |
1355 case StMSYS6_ResetDeco: | |
1356 text[1] = TXT2BYTE_ResetDeco; | |
1357 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1358 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1359 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetDeco); | |
1360 text[0] = '\025'; | |
1361 text[1] = TXT_2BYTE; | |
1362 text[2] = TXT2BYTE_DecoDataLost; | |
1363 text[3] = 0; | |
1364 write_label_var( 30, 800, ME_Y_LINE4, &FontT48, text); | |
1365 break; | |
1366 | |
1367 case StMSYS6_ResetAll: | |
1368 text[1] = TXT2BYTE_ResetAll; | |
1369 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1370 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1371 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetAll); | |
1372 break; | |
1373 | |
1374 case StMSYS6_ResetLogbook: | |
1375 text[1] = TXT2BYTE_ResetLogbook; | |
1376 write_field_button(editIdOfCaller, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1377 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1378 setEvent(editIdOfCaller, (uint32_t)OnAction_ResetLogbook); | |
1379 break; | |
1380 | |
1381 case StMSYS6_Maintenance: | |
1382 case StMSYS6_SetBattCharge: | |
1383 text[0] = TXT_2BYTE; | |
1384 text[1] = TXT2BYTE_SetFactoryDefaults; | |
1385 text[2] = 0; | |
1386 write_field_button(StMSYS6_SetFactoryBC, 30, 800, ME_Y_LINE2, &FontT48, text); | |
1387 | |
1388 if(stateRealGetPointer()->lifeData.battery_charge == 0) | |
1389 { | |
1390 text[0] = TXT_2BYTE; | |
1391 text[1] = TXT2BYTE_SetBatteryCharge; | |
1392 text[2] = 0; | |
1393 snprintf(&text[2],10,": %u%%",settingsGetPointer()->lastKnownBatteryPercentage); | |
1394 write_field_button(StMSYS6_SetBattCharge, 30, 800, ME_Y_LINE3, &FontT48, text); | |
1395 | |
1396 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1397 setEvent(StMSYS6_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); | |
1398 setEvent(StMSYS6_SetBattCharge, (uint32_t)OnAction_SetBatteryCharge); | |
1399 } | |
1400 else | |
1401 { | |
1402 setEvent(StMSYS6_Exit, (uint32_t)OnAction_Exit); | |
1403 setEvent(StMSYS6_SetFactoryBC, (uint32_t)OnAction_SetFactoryDefaults); | |
1404 } | |
1405 // write_field_button(StMSYS6_ScreenTest, 30, 800, ME_Y_LINE3, &FontT48, "Screen Test"); | |
1406 // setEvent(StMSYS6_ScreenTest, (uint32_t)OnAction_ScreenTest); | |
1407 | |
1408 text[0] = TXT_2BYTE; | |
1409 text[1] = TXT2BYTE_WarnBatteryLow; | |
1410 text[2] = 0; | |
1411 snprintf(&text[2],10,": %01.2fV",stateRealGetPointer()->lifeData.battery_voltage); | |
1412 write_label_var( 30, 800, ME_Y_LINE4, &FontT42, text); | |
1413 | |
1414 | |
1415 if(DataEX_scooterDataFound()) | |
1416 { | |
1417 snprintf(&text[0],30,"Ext: %01.1fV @ %01.1f \140C",stateUsed->lifeData.scooterSpannung, stateUsed->lifeData.scooterTemperature / 10.0f); | |
1418 write_label_var( 30, 800, ME_Y_LINE5, &FontT42, text); | |
1419 } | |
1420 | |
1421 snprintf(&text[0],30,"Code: %X",getLicence()); | |
1422 write_label_var( 30, 800, ME_Y_LINE6, &FontT42, text); | |
1423 break; | |
1424 | |
1425 } | |
1426 | |
1427 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
1428 } | |
1429 | |
1430 uint8_t OnAction_LogbookOffset(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1431 { | |
1432 uint8_t digitContentNew; | |
1433 uint32_t newOffset; | |
1434 | |
1435 if(action == ACTION_BUTTON_ENTER) | |
1436 return digitContent; | |
1437 | |
1438 if(action == ACTION_BUTTON_ENTER_FINAL) | |
1439 { | |
1440 evaluateNewString(editId, &newOffset, 0, 0, 0); | |
1441 if(newOffset > 9000) | |
1442 newOffset = 0; | |
1443 tMenuEdit_newInput(editId, newOffset, 0, 0, 0); | |
1444 settingsGetPointer()->logbookOffset = (uint16_t)newOffset; | |
1445 return UPDATE_DIVESETTINGS; | |
1446 } | |
1447 | |
1448 if(action == ACTION_BUTTON_NEXT) | |
1449 { | |
1450 digitContentNew = digitContent + 1; | |
1451 if(digitContentNew > '9') | |
1452 digitContentNew = '0'; | |
1453 return digitContentNew; | |
1454 } | |
1455 | |
1456 if(action == ACTION_BUTTON_BACK) | |
1457 { | |
1458 digitContentNew = digitContent - 1; | |
1459 if(digitContentNew < '0') | |
1460 digitContentNew = '9'; | |
1461 return digitContentNew; | |
1462 } | |
1463 return UNSPECIFIC_RETURN; | |
1464 } | |
1465 | |
1466 uint8_t OnAction_Nothing (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1467 { | |
1468 return UNSPECIFIC_RETURN; | |
1469 } | |
1470 | |
1471 uint8_t OnAction_Exit (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1472 { | |
1473 return EXIT_TO_MENU; | |
1474 } | |
1475 uint8_t OnAction_Confirm (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1476 { | |
1477 openEdit_ResetConfirmation(editId); | |
1478 return UNSPECIFIC_RETURN; | |
1479 } | |
1480 | |
1481 uint8_t OnAction_RebootRTE (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1482 { | |
1483 MX_SmallCPU_Reset_To_Standard(); | |
1484 return EXIT_TO_MENU; | |
1485 } | |
1486 | |
1487 uint8_t OnAction_ResetDeco (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1488 { | |
1489 clearDeco(); | |
1490 return EXIT_TO_MENU; | |
1491 } | |
1492 | |
1493 uint8_t OnAction_ResetAll (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1494 { | |
1495 set_settings_to_Standard(); | |
1496 check_and_correct_settings(); | |
1497 | |
1498 return UPDATE_AND_EXIT_TO_HOME; | |
1499 } | |
1500 | |
1501 uint8_t OnAction_ResetLogbook (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1502 { | |
1503 write_label_var( 430, 740, 350, &FontT42, "Wait"); | |
1504 ext_flash_erase_logbook(); | |
1505 | |
1506 SSettings * pSettings = settingsGetPointer(); | |
1507 pSettings->lastDiveLogId = 255; | |
1508 pSettings->logFlashNextSampleStartAddress = 0; | |
1509 | |
1510 return EXIT_TO_MENU; | |
1511 } | |
1512 | |
1513 uint8_t OnAction_RebootMainCPU (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1514 { | |
1515 settingsGetPointer()->showDebugInfo = 0; | |
1516 extern uint8_t bootToBootloader; | |
1517 bootToBootloader = 1; | |
1518 return UNSPECIFIC_RETURN; | |
1519 } | |
1520 | |
1521 | |
1522 uint8_t OnAction_SetFactoryDefaults(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1523 { | |
1524 settingsWriteFactoryDefaults(settingsGetPointer()->ButtonResponsiveness[3], settingsGetPointer()->buttonBalance); | |
1525 return EXIT_TO_MENU; | |
1526 } | |
1527 | |
1528 | |
1529 uint8_t OnAction_SetBatteryCharge(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1530 { | |
1531 setBatteryPercentage(settingsGetPointer()->lastKnownBatteryPercentage); | |
1532 // setBatteryPercentage(100); | |
1533 return EXIT_TO_MENU; | |
1534 } | |
1535 | |
1536 #ifdef SCREENTEST | |
1537 uint8_t OnAction_ScreenTest (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1538 { | |
1539 static uint8_t FrameCount = 1; // 0 is invisible frame | |
1540 char text[5]; | |
1541 GFX_DrawCfgScreen tTestScreen; | |
1542 tTestScreen.FBStartAdress = 0; | |
1543 tTestScreen.ImageHeight = 480; | |
1544 tTestScreen.ImageWidth = 800; | |
1545 tTestScreen.LayerIndex = 1; | |
1546 | |
1547 set_globalState(StMSYS6_ScreenTest); | |
1548 tTestScreen.FBStartAdress = getFrameByNumber(FrameCount); | |
1549 if(tTestScreen.FBStartAdress == 0) | |
1550 { | |
1551 extern uint8_t bootToBootloader; | |
1552 bootToBootloader = 1; | |
1553 } | |
1554 GFX_fill_buffer(tTestScreen.FBStartAdress, 0xFF, FrameCount); | |
1555 snprintf(text,5,"%u",FrameCount); | |
1556 Gfx_write_label_var(&tTestScreen, 10,100,10,&FontT48,CLUT_Font027,text); | |
1557 GFX_SetFramesTopBottom(tTestScreen.FBStartAdress, NULL,480); | |
1558 FrameCount++; | |
1559 } | |
1560 #endif | |
1561 /* | |
1562 uint8_t OnAction_TestCLog (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
1563 { | |
1564 write_label_var( 430, 740, 350, &FontT42, "Wait"); | |
1565 | |
1566 test_log_only(20, 5); | |
1567 test_log_only(30, 10); | |
1568 ext_flash_write_settings(); | |
1569 return EXIT_TO_MENU; | |
1570 } | |
1571 */ | |
1572 |