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