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