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
|
|
277 if((blockNumber == 2) && (digitContentNew > '0' + 18))
|
|
278 digitContentNew = '0' + 17;
|
|
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);
|
|
500 /*
|
|
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
|
|
509 pSettings->selected_language = LANGUAGE_Espanol;
|
|
510 if( actualLanguage == pSettings->selected_language)
|
|
511 active = 1;
|
|
512 else
|
|
513 active = 0;
|
|
514 write_field_on_off(StMSYS2_Espanol, 30, 800, ME_Y_LINE5, &FontT48, text, active);
|
|
515 */
|
|
516 pSettings->selected_language = actualLanguage;
|
|
517
|
|
518 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
|
|
519
|
|
520 setEvent(StMSYS2_English, (uint32_t)OnAction_English);
|
|
521 setEvent(StMSYS2_German, (uint32_t)OnAction_German);
|
|
522 setEvent(StMSYS2_French, (uint32_t)OnAction_French);
|
|
523 //setEvent(StMSYS2_Italian, (uint32_t)OnAction_Italian);
|
|
524 //setEvent(StMSYS2_Espanol, (uint32_t)OnAction_Espanol);
|
|
525 }
|
|
526
|
|
527
|
|
528 uint8_t OnAction_English (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
529 {
|
|
530 SSettings *pSettings = settingsGetPointer();
|
|
531 pSettings->selected_language = LANGUAGE_English;
|
|
532 return EXIT_TO_MENU_WITH_LOGO;
|
|
533 }
|
|
534
|
|
535
|
|
536 uint8_t OnAction_German (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
537 {
|
|
538 SSettings *pSettings = settingsGetPointer();
|
|
539 pSettings->selected_language = LANGUAGE_German;
|
|
540 return EXIT_TO_MENU_WITH_LOGO;
|
|
541 }
|
|
542
|
|
543
|
|
544 uint8_t OnAction_French (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
545 {
|
|
546 SSettings *pSettings = settingsGetPointer();
|
|
547 pSettings->selected_language = LANGUAGE_French;
|
|
548 return EXIT_TO_MENU_WITH_LOGO;
|
|
549 }
|
|
550
|
|
551
|
|
552 uint8_t OnAction_Italian (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
553 {
|
|
554 SSettings *pSettings = settingsGetPointer();
|
|
555 pSettings->selected_language = LANGUAGE_Italian;
|
|
556 return EXIT_TO_MENU_WITH_LOGO;
|
|
557 }
|
|
558
|
|
559
|
|
560 uint8_t OnAction_Espanol (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
561 {
|
|
562 SSettings *pSettings = settingsGetPointer();
|
|
563 pSettings->selected_language = LANGUAGE_Espanol;
|
|
564 return EXIT_TO_MENU_WITH_LOGO;
|
|
565 }
|
|
566
|
|
567
|
|
568 void openEdit_Design(void)
|
|
569 {
|
|
570 refresh_Design();
|
|
571
|
|
572 write_field_button(StMSYS3_Units, 400, 700, ME_Y_LINE1, &FontT48, "");
|
|
573 write_field_button(StMSYS3_Colors, 400, 700, ME_Y_LINE2, &FontT48, "");
|
|
574 // write_field_button(StMSYS3_Debug, 400, 700, ME_Y_LINE3, &FontT48, "");
|
|
575 setEvent(StMSYS3_Units, (uint32_t)OnAction_Units);
|
|
576 setEvent(StMSYS3_Colors, (uint32_t)OnAction_Colorscheme);
|
|
577 // setEvent(StMSYS3_Debug, (uint32_t)OnAction_DebugInfo);
|
|
578 }
|
|
579
|
|
580
|
|
581 void refresh_Design(void)
|
|
582 {
|
|
583 char text[32];
|
|
584
|
|
585 // header
|
|
586 text[0] = '\001';
|
|
587 text[1] = TXT_2BYTE;
|
|
588 text[2] = TXT2BYTE_Layout;
|
|
589 text[3] = 0;
|
|
590 write_topline(text);
|
|
591
|
|
592 // units
|
|
593 text[0] = TXT_2BYTE;
|
|
594 text[1] = TXT2BYTE_Units;
|
|
595 text[2] = 0;
|
|
596 write_label_var( 30, 200, ME_Y_LINE1, &FontT48, text);
|
|
597
|
|
598 if(settingsGetPointer()->nonMetricalSystem)
|
|
599 {
|
|
600 text[1] = TXT2BYTE_Units_feet;
|
|
601 }
|
|
602 else
|
|
603 {
|
|
604 text[1] = TXT2BYTE_Units_metric;
|
|
605 }
|
|
606 write_label_var( 400, 700, ME_Y_LINE1, &FontT48, text);
|
|
607
|
|
608 // colorscheme
|
|
609 text[0] = TXT_2BYTE;
|
|
610 text[1] = TXT2BYTE_Farbschema;
|
|
611 text[2] = 0;
|
|
612 write_label_var( 30, 200, ME_Y_LINE2, &FontT48, text);
|
|
613
|
|
614 text[0] = '0' + settingsGetPointer()->tX_colorscheme;
|
|
615 text[1] = 0;
|
|
616 write_label_var( 400, 700, ME_Y_LINE2, &FontT48, text);
|
|
617
|
|
618 /*
|
|
619 // specials
|
|
620 text[0] = TXT_2BYTE;
|
|
621 text[1] = TXT2BYTE_ShowDebug;
|
|
622 text[2] = 0;
|
|
623 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text);
|
|
624
|
|
625 if(settingsGetPointer()->showDebugInfo)
|
|
626 text[0] = '\005';
|
|
627 else
|
|
628 text[0] = '\006';
|
|
629 text[1] = 0;
|
|
630 write_label_var( 400, 700, ME_Y_LINE3, &FontT48, text);
|
|
631 */
|
|
632
|
|
633 // design
|
|
634 text[0] = TXT_Depth;
|
|
635 text[1] = 0;
|
|
636 write_content( 30, 700, ME_Y_LINE4, &FontT24, text, CLUT_Font031);
|
|
637 write_content( 30, 700, ME_Y_LINE4 + 30 + 70, &FontT48, "___________", CLUT_DIVE_FieldSeperatorLines);
|
|
638 write_content(280, 700, ME_Y_LINE4 + 30 + 70 - 3, &FontT48, "|", CLUT_DIVE_pluginbox);
|
|
639 write_content(290, 700, ME_Y_LINE4 + 30 + 70 - 37, &FontT48, "_______________", CLUT_DIVE_pluginbox);
|
|
640 write_content( 30, 700, ME_Y_LINE4 + 30, &FontT144, "24.7", CLUT_Font027);
|
|
641
|
|
642 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
|
|
643 }
|
|
644
|
|
645
|
|
646 uint8_t OnAction_Units(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
647 {
|
|
648 settingsGetPointer()->nonMetricalSystem = !(settingsGetPointer()->nonMetricalSystem);
|
|
649 return EXIT_TO_MENU_WITH_LOGO;//UPDATE_DIVESETTINGS;
|
|
650 }
|
|
651
|
|
652
|
|
653 uint8_t OnAction_Colorscheme(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
654 {
|
|
655 uint8_t newColorscheme;
|
|
656
|
|
657 newColorscheme = settingsGetPointer()->tX_colorscheme + 1;
|
|
658
|
|
659 if(newColorscheme > 3)
|
|
660 newColorscheme = 0;
|
|
661
|
|
662 settingsGetPointer()->tX_colorscheme = newColorscheme;
|
|
663 GFX_use_colorscheme(newColorscheme);
|
|
664 tHome_init_compass();
|
|
665 return UNSPECIFIC_RETURN;
|
|
666 }
|
|
667
|
|
668
|
|
669 uint8_t OnAction_DebugInfo(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
670 {
|
|
671 settingsGetPointer()->showDebugInfo = !(settingsGetPointer()->showDebugInfo);
|
|
672 return UPDATE_DIVESETTINGS;
|
|
673 }
|
|
674
|
|
675
|
|
676
|
|
677
|
|
678 /*
|
|
679 uint8_t OnAction_Design_t7ft (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
680 {
|
|
681 SSettings *pSettings = settingsGetPointer();
|
|
682 if((pSettings->design == 7) && pSettings->nonMetricalSystem)
|
|
683 return EXIT_TO_MENU;
|
|
684 pSettings->design = 7;
|
|
685 pSettings->nonMetricalSystem = 1;
|
|
686 tMenuEdit_set_on_off(StMSYS3_t7, 0);
|
|
687 tMenuEdit_set_on_off(StMSYS3_t7ft, 1);
|
|
688 tMenuEdit_set_on_off(StMSYS3_t3, 0);
|
|
689 return UPDATE_DIVESETTINGS;
|
|
690 }
|
|
691
|
|
692
|
|
693 uint8_t OnAction_Design_t7 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
694 {
|
|
695 SSettings *pSettings = settingsGetPointer();
|
|
696 if((pSettings->design == 7) && (pSettings->nonMetricalSystem == 0))
|
|
697 return EXIT_TO_MENU;
|
|
698 pSettings->design = 7;
|
|
699 pSettings->nonMetricalSystem = 0;
|
|
700 tMenuEdit_set_on_off(StMSYS3_t7, 1);
|
|
701 tMenuEdit_set_on_off(StMSYS3_t7ft, 0);
|
|
702 tMenuEdit_set_on_off(StMSYS3_t3, 0);
|
|
703 return UPDATE_DIVESETTINGS;
|
|
704 }
|
|
705
|
|
706
|
|
707 uint8_t OnAction_Design_t3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
708 {
|
|
709 SSettings *pSettings = settingsGetPointer();
|
|
710 if(pSettings->design == 3)
|
|
711 return EXIT_TO_MENU;
|
|
712 pSettings->design = 3;
|
|
713 pSettings->nonMetricalSystem = 0;
|
|
714 tMenuEdit_set_on_off(StMSYS3_t7, 0);
|
|
715 tMenuEdit_set_on_off(StMSYS3_t7ft,0);
|
|
716 tMenuEdit_set_on_off(StMSYS3_t3, 1);
|
|
717 return UPDATE_DIVESETTINGS;
|
|
718 }
|
|
719 */
|
|
720
|
|
721
|
|
722 void openEdit_Customview(void)
|
|
723 {
|
|
724 refresh_Customviews();
|
|
725
|
|
726 write_field_button(StMSYS4_CViewTimeout, 400, 700, ME_Y_LINE1, &FontT48, "");
|
|
727 write_field_button(StMSYS4_CViewStandard, 400, 700, ME_Y_LINE2, &FontT48, "");
|
|
728
|
|
729 write_field_button(StMSYS4_CornerTimeout, 400, 700, ME_Y_LINE3, &FontT48, "");
|
|
730 write_field_button(StMSYS4_CornerStandard, 400, 700, ME_Y_LINE4, &FontT48, "");
|
|
731
|
|
732 write_field_button(StMSYS4_ExtraDisplay, 400, 700, ME_Y_LINE5, &FontT48, "");
|
|
733
|
|
734 setEvent(StMSYS4_CViewTimeout, (uint32_t)OnAction_CViewTimeout);
|
|
735 setEvent(StMSYS4_CViewStandard, (uint32_t)OnAction_CViewStandard);
|
|
736
|
|
737 setEvent(StMSYS4_CornerTimeout, (uint32_t)OnAction_CornerTimeout);
|
|
738 setEvent(StMSYS4_CornerStandard, (uint32_t)OnAction_CornerStandard);
|
|
739
|
|
740 setEvent(StMSYS4_ExtraDisplay, (uint32_t)OnAction_ExtraDisplay);
|
|
741 }
|
|
742
|
|
743
|
|
744 void refresh_Customviews(void)
|
|
745 {
|
|
746 char text[32];
|
|
747 uint8_t textpointer = 0;
|
|
748
|
|
749 // header
|
|
750 text[0] = '\001';
|
|
751 text[1] = TXT_2BYTE;
|
|
752 text[2] = TXT2BYTE_Customviews;
|
|
753 text[3] = 0;
|
|
754 write_topline(text);
|
|
755
|
|
756 // custom view center return
|
|
757 textpointer = 0;
|
|
758 text[textpointer++] = TXT_2BYTE;
|
|
759 text[textpointer++] = TXT2BYTE_CViewTimeout;
|
|
760 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_customViewTimeout,TXT_Seconds);
|
|
761 write_label_var( 30, 700, ME_Y_LINE1, &FontT48, text);
|
|
762
|
|
763 // custom view center primary
|
|
764 text[0] = TXT_2BYTE;
|
|
765 text[1] = TXT2BYTE_CViewStandard;
|
|
766 text[2] = ' ';
|
|
767 text[3] = ' ';
|
|
768 switch(settingsGetPointer()->tX_customViewPrimary)
|
|
769 {
|
|
770 case CVIEW_Scooter:
|
|
771 text[4] = TXT_2BYTE;
|
|
772 text[5] = TXT2BYTE_ScooterMonitor;
|
|
773 break;
|
|
774 case CVIEW_sensors:
|
|
775 text[4] = TXT_2BYTE;
|
|
776 text[5] = TXT2BYTE_O2monitor;
|
|
777 break;
|
|
778 case CVIEW_sensors_mV:
|
|
779 text[4] = TXT_2BYTE;
|
|
780 text[5] = TXT2BYTE_O2voltage;
|
|
781 break;
|
|
782 case CVIEW_Compass:
|
|
783 text[4] = TXT_2BYTE;
|
|
784 text[5] = TXT2BYTE_Compass;
|
|
785 break;
|
|
786 case CVIEW_Decolist:
|
|
787 text[4] = TXT_2BYTE;
|
|
788 text[5] = TXT2BYTE_Decolist;
|
|
789 break;
|
|
790 case CVIEW_Tissues:
|
|
791 text[4] = TXT_2BYTE;
|
|
792 text[5] = TXT2BYTE_Tissues;
|
|
793 break;
|
|
794 case CVIEW_Profile:
|
|
795 text[4] = TXT_2BYTE;
|
|
796 text[5] = TXT2BYTE_Profile;
|
|
797 break;
|
|
798 case CVIEW_Gaslist:
|
|
799 text[4] = TXT_2BYTE;
|
|
800 text[5] = TXT2BYTE_Gaslist;
|
|
801 break;
|
|
802 case CVIEW_EADTime:
|
|
803 text[4] = TXT_2BYTE;
|
|
804 text[5] = TXT2BYTE_Info;
|
|
805 break;
|
|
806 case CVIEW_SummaryOfLeftCorner:
|
|
807 text[4] = TXT_2BYTE;
|
|
808 text[5] = TXT2BYTE_Summary;
|
|
809 break;
|
|
810 case CVIEW_noneOrDebug:
|
|
811 text[4] = ' ';
|
|
812 text[5] = '-';
|
|
813 break;
|
|
814 default:
|
|
815 snprintf(&text[4],3,"%02u",settingsGetPointer()->tX_customViewPrimary);
|
|
816 break;
|
|
817 }
|
|
818 text[6] = 0;
|
|
819 write_label_var( 30, 700, ME_Y_LINE2, &FontT48, text);
|
|
820
|
|
821
|
|
822 // field corner return
|
|
823 textpointer = 0;
|
|
824 text[textpointer++] = TXT_2BYTE;
|
|
825 text[textpointer++] = TXT2BYTE_CornerTimeout;
|
|
826 textpointer += snprintf(&text[textpointer],11," %02u\016\016 %c\017",settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout,TXT_Seconds);
|
|
827 write_label_var( 30, 700, ME_Y_LINE3, &FontT48, text);
|
|
828
|
|
829 // field corner primary
|
|
830 text[0] = TXT_2BYTE;
|
|
831 text[1] = TXT2BYTE_CornerStandard;
|
|
832 text[2] = ' ';
|
|
833 text[3] = ' ';
|
|
834 switch(settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary)
|
|
835 {
|
|
836 /* Temperature */
|
|
837 case 1:
|
|
838 text[4] = TXT_Temperature;
|
|
839 break;
|
|
840 /* Average Depth */
|
|
841 case 2:
|
|
842 text[4] = TXT_AvgDepth;
|
|
843 break;
|
|
844 /* ppO2 */
|
|
845 case 3:
|
|
846 text[4] = TXT_ppO2;
|
|
847 break;
|
|
848 /* Stop Uhr */
|
|
849 case 4:
|
|
850 text[4] = TXT_Stopwatch;
|
|
851 break;
|
|
852 /* Ceiling */
|
|
853 case 5:
|
|
854 text[4] = TXT_Ceiling;
|
|
855 break;
|
|
856 /* Future TTS */
|
|
857 case 6:
|
|
858 text[4] = TXT_FutureTTS;
|
|
859 break;
|
|
860 /* CNS */
|
|
861 case 7:
|
|
862 text[4] = TXT_CNS;
|
|
863 break;
|
|
864 /* none */
|
|
865 case 0:
|
|
866 text[4] = '-';
|
|
867 break;
|
|
868 default:
|
|
869 snprintf(&text[4],2,"%u",settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary);
|
|
870 break;
|
|
871 }
|
|
872 text[5] = 0;
|
|
873 write_label_var( 30, 700, ME_Y_LINE4, &FontT48, text);
|
|
874
|
|
875
|
|
876 // extra display
|
|
877 text[0] = TXT_2BYTE;
|
|
878 text[1] = TXT2BYTE_ExtraDisplay;
|
|
879 text[2] = ' ';
|
|
880 text[3] = ' ';
|
|
881 text[4] = TXT_2BYTE;
|
|
882 switch(settingsGetPointer()->extraDisplay)
|
|
883 {
|
|
884 /* BigFont */
|
|
885 case EXTRADISPLAY_BIGFONT:
|
|
886 text[5] = TXT2BYTE_ExtraBigFont;
|
|
887 break;
|
|
888 /* DecoGame */
|
|
889 case EXTRADISPLAY_DECOGAME:
|
|
890 text[5] = TXT2BYTE_ExtraDecoGame;
|
|
891 break;
|
|
892 /* none */
|
|
893 case EXTRADISPLAY_none:
|
|
894 text[5] = TXT2BYTE_ExtraNone;
|
|
895 break;
|
|
896 default:
|
|
897 snprintf(&text[4],2,"%u",settingsGetPointer()->extraDisplay);
|
|
898 break;
|
|
899 }
|
|
900 text[6] = 0;
|
|
901 write_label_var( 30, 700, ME_Y_LINE5, &FontT48, text);
|
|
902
|
|
903 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
|
|
904 }
|
|
905
|
|
906
|
|
907 uint8_t OnAction_CViewTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
908 {
|
|
909 uint8_t value;
|
|
910 value = settingsGetPointer()->tX_customViewTimeout;
|
|
911
|
|
912 if(value < 5)
|
|
913 value = 5;
|
|
914 else if(value < 10)
|
|
915 value = 10;
|
|
916 else if(value < 15)
|
|
917 value = 15;
|
|
918 else if(value < 20)
|
|
919 value = 20;
|
|
920 else if(value < 30)
|
|
921 value = 30;
|
|
922 else if(value < 45)
|
|
923 value = 45;
|
|
924 else if(value < 60)
|
|
925 value = 60;
|
|
926 else
|
|
927 value = 0;
|
|
928
|
|
929 settingsGetPointer()->tX_customViewTimeout = value;
|
|
930 return UPDATE_DIVESETTINGS;
|
|
931 }
|
|
932
|
|
933
|
|
934 uint8_t OnAction_CViewStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
935 {
|
|
936 uint8_t newValue;
|
|
937 switch(settingsGetPointer()->tX_customViewPrimary)
|
|
938 {
|
|
939 case CVIEW_Scooter:
|
|
940 newValue = CVIEW_sensors;
|
|
941 break;
|
|
942 case CVIEW_sensors:
|
|
943 newValue = CVIEW_sensors_mV;
|
|
944 break;
|
|
945 case CVIEW_sensors_mV:
|
|
946 newValue = CVIEW_Compass;
|
|
947 break;
|
|
948 case CVIEW_Compass:
|
|
949 newValue = CVIEW_Decolist;
|
|
950 break;
|
|
951 case CVIEW_Decolist:
|
|
952 newValue = CVIEW_Tissues;
|
|
953 break;
|
|
954 case CVIEW_Tissues:
|
|
955 newValue = CVIEW_Profile;
|
|
956 break;
|
|
957 case CVIEW_Profile:
|
|
958 newValue = CVIEW_Gaslist;
|
|
959 break;
|
|
960 case CVIEW_Gaslist:
|
|
961 newValue = CVIEW_EADTime;
|
|
962 break;
|
|
963 case CVIEW_EADTime:
|
|
964 newValue = CVIEW_SummaryOfLeftCorner;
|
|
965 break;
|
|
966 case CVIEW_SummaryOfLeftCorner:
|
|
967 newValue = CVIEW_noneOrDebug;
|
|
968 break;
|
|
969 case CVIEW_noneOrDebug:
|
|
970 default:
|
|
971 if(getLicence() == LICENCEBONEX)
|
|
972 newValue = CVIEW_Scooter;
|
|
973 else
|
|
974 newValue = CVIEW_sensors;
|
|
975 break;
|
|
976 }
|
|
977 settingsGetPointer()->tX_customViewPrimary = newValue;
|
|
978 return UPDATE_DIVESETTINGS;
|
|
979 }
|
|
980
|
|
981
|
|
982 uint8_t OnAction_CornerTimeout(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
983 {
|
|
984 uint8_t value;
|
|
985 value = settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout;
|
|
986
|
|
987 if(value < 5)
|
|
988 value = 5;
|
|
989 else if(value < 10)
|
|
990 value = 10;
|
|
991 else if(value < 15)
|
|
992 value = 15;
|
|
993 else if(value < 20)
|
|
994 value = 20;
|
|
995 else if(value < 30)
|
|
996 value = 30;
|
|
997 else if(value < 45)
|
|
998 value = 45;
|
|
999 else if(value < 60)
|
|
1000 value = 60;
|
|
1001 else
|
|
1002 value = 0;
|
|
1003
|
|
1004 settingsGetPointer()->tX_userselectedLeftLowerCornerTimeout = value;
|
|
1005 return UPDATE_DIVESETTINGS;
|
|
1006 }
|
|
1007
|
|
1008
|
|
1009 uint8_t OnAction_CornerStandard(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
1010 {
|
|
1011 uint8_t value;
|
|
1012 value = settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary;
|
|
1013
|
|
1014 value += 1;
|
|
1015
|
|
1016 if(value > 7)
|
|
1017 value = 0;
|
|
1018
|
|
1019 settingsGetPointer()->tX_userselectedLeftLowerCornerPrimary = value;
|
|
1020 return UPDATE_DIVESETTINGS;
|
|
1021 }
|
|
1022
|
|
1023
|
|
1024 uint8_t OnAction_ExtraDisplay (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
1025 {
|
|
1026 uint8_t newValue;
|
|
1027 switch(settingsGetPointer()->extraDisplay)
|
|
1028 {
|
|
1029 case EXTRADISPLAY_BIGFONT:
|
|
1030 newValue = EXTRADISPLAY_none;
|
|
1031 break;
|
|
1032 case EXTRADISPLAY_DECOGAME:
|
|
1033 newValue = EXTRADISPLAY_BIGFONT;
|
|
1034 break;
|
|
1035 case EXTRADISPLAY_none:
|
|
1036 newValue = EXTRADISPLAY_BIGFONT;
|
|
1037 break;
|
|
1038 default:
|
|
1039 newValue = EXTRADISPLAY_BIGFONT;
|
|
1040 break;
|
|
1041 }
|
|
1042 settingsGetPointer()->extraDisplay = newValue;
|
|
1043 return UNSPECIFIC_RETURN;
|
|
1044 }
|
|
1045
|
|
1046
|
|
1047 void openEdit_Information(void)
|
|
1048 {
|
|
1049 char text[70];
|
|
1050
|
|
1051 infoPage = 0;
|
|
1052
|
|
1053 text[0] = '\001';
|
|
1054 text[1] = TXT_Information;
|
|
1055 text[2] = 0;
|
|
1056 write_topline(text);
|
|
1057
|
|
1058 text[0] = TXT_2BYTE;
|
|
1059 text[1] = TXT2BYTE_ButtonNext;
|
|
1060 text[2] = 0;
|
|
1061
|
|
1062 write_field_button(StMSYS5_Info, 30, 800, ME_Y_LINE6, &FontT48, text);
|
|
1063
|
|
1064 setEvent(StMSYS5_Info, (uint32_t)OnAction_Information);
|
|
1065 }
|
|
1066
|
|
1067
|
|
1068 uint8_t OnAction_Information (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
|
|
1069 {
|
|
1070 resetEnterPressedToStateBeforeButtonAction();
|
|
1071
|
|
1072 infoPage++;
|
|
1073 if(infoPage > 3)
|
|
1074 return EXIT_TO_MENU;
|
|
1075 else
|
|
1076 return UNSPECIFIC_RETURN;
|
|
1077 }
|
|
1078
|
|
1079
|
|
1080 void refresh_InformationPage(void)
|
|
1081 {
|
|
1082 char text_header[5];
|
|
1083 char text_button[5];
|
|
1084 char text_content[256];
|
|
1085 uint8_t date[3], year,month,day;
|
|
1086
|
|
1087 RTC_DateTypeDef Sdate, Sdate2;
|
|
1088 float temperature1, temperature2, voltage, offsetTemperature;
|
|
1089
|
|
1090 //RTC_TimeTypeDef Stime;
|
|
1091
|
|
1092 /*
|
|
1093 SDeviceLine batteryChargeCycles;
|
|
1094 SDeviceLine batteryChargeCompleteCycles;
|
|
1095 SDeviceLine temperatureMinimum;
|
|
1096 SDeviceLine temperatureMaximum;
|
|
1097 SDeviceLine depthMaximum;
|
|
1098 SDeviceLine diveCycles;
|
|
1099 SDeviceLine voltageMinimum;
|
|
1100 */
|
|
1101
|
|
1102 switch(infoPage)
|
|
1103 {
|
|
1104 case 0:
|
|
1105 text_header[0] = '\001';
|
|
1106 text_header[1] = TXT_Information;
|
|
1107 text_header[2] = 0;
|
|
1108
|
|
1109 write_label_var( 20, 800, ME_Y_LINE1, &FontT42, "Dive Computer OSTC4");
|
|
1110 write_label_var( 20, 800, ME_Y_LINE2, &FontT42, "Design heinrichs/weikamp");
|
|
1111
|
|
1112 Sdate.Year = firmwareDataGetPointer()->release_year;
|
|
1113 Sdate.Month = firmwareDataGetPointer()->release_month;
|
|
1114 Sdate.Date = firmwareDataGetPointer()->release_day;
|
|
1115
|
|
1116 if(settingsGetPointer()->date_format == DDMMYY)
|
|
1117 {
|
|
1118 day = 0;
|
|
1119 month = 1;
|
|
1120 year = 2;
|
|
1121 }
|
|
1122 else
|
|
1123 if(settingsGetPointer()->date_format == MMDDYY)
|
|
1124 {
|
|
1125 day = 1;
|
|
1126 month = 0;
|
|
1127 year = 2;
|
|
1128 }
|
|
1129 else
|
|
1130 {
|
|
1131 day = 2;
|
|
1132 month = 1;
|
|
1133 year = 0;
|
|
1134 }
|
|
1135 date[day] = Sdate.Date;
|
|
1136 date[month] = Sdate.Month;
|
|
1137 date[year] = Sdate.Year;
|
|
1138 snprintf(text_content,40,"Firmware release date: %02d.%02d.%02d",date[0],date[1],date[2]);
|
|
1139 write_label_var( 20, 800, ME_Y_LINE3, &FontT42, text_content);
|
|
1140 //write_label_var( 20, 800, ME_Y_LINE3, &FontT42, "Available now: Boot 2016. Get Yours!");
|
|
1141 write_label_var( 20, 800, ME_Y_LINE4, &FontT42, "for more information");
|
|
1142 write_label_var( 20, 800, ME_Y_LINE5, &FontT42, "info@heinrihweikamp.com");
|
|
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);
|
|
1159 snprintf(text_content,80,"%i (%i)",stateDeviceGetPointer()->batteryChargeCycles.value_int32,stateDeviceGetPointer()->batteryChargeCompleteCycles.value_int32);
|
|
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
|
|
1192 snprintf(text_content,80,"%i (%i)",stateDeviceGetPointer()->diveCycles.value_int32,(stateDeviceGetPointer()->depthMaximum.value_int32 - 1000) / 100);
|
|
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
|
|
1205 snprintf(text_content,80,"%i",(stateDeviceGetPointer()->hoursOfOperation.value_int32)/3600);
|
|
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;
|
|
1240 snprintf(text_content,80,"%i mbar / %0.2f\140C",settingsGetPointer()->offsetPressure_mbar, offsetTemperature);
|
|
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
|