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