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