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