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