Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditDeco.c @ 225:2bb1db22b5f5 div-fixes-3
cleanup: random set of cleanups
A random set of cleanups, as found during code reading, and looking
around fixing issues. Contains all kinds of things: typo's in comment,
typo in variable name, removal of unused code, making things static
where possible. Does not contain any functional changes.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Mon, 01 Apr 2019 15:50:41 +0200 |
parents | b7689d9e888a |
children | ba229a012ac7 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEditDeco.c | |
5 /// \brief Main Template file for Menu Edit Deco Parameters | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 31-July-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 "tMenuEditDeco.h" | |
31 | |
32 #include "gfx_fonts.h" | |
33 #include "tMenuEdit.h" | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
38
diff
changeset
|
34 #include "unit.h" |
38 | 35 |
36 /* Private variables ---------------------------------------------------------*/ | |
37 uint8_t lineSelected = 0; | |
38 | |
39 /* Private function prototypes -----------------------------------------------*/ | |
40 | |
41 void openEdit_DiveMode(void); | |
42 void openEdit_CCRModeSensorOrFixedSP(void); | |
43 void openEdit_ppO2max(void); | |
44 void openEdit_SafetyStop(void); | |
45 void openEdit_FutureTTS(void); | |
46 void openEdit_Salinity(void); | |
47 | |
48 /* Announced function prototypes -----------------------------------------------*/ | |
49 | |
50 uint8_t OnAction_OC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
51 uint8_t OnAction_CC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
52 uint8_t OnAction_Apnea (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
53 uint8_t OnAction_Gauge (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
54 uint8_t OnAction_FutureTTS (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
55 uint8_t OnAction_ppO2Max (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
56 uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
57 uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); | |
58 /* Exported functions --------------------------------------------------------*/ | |
59 | |
60 void openEdit_Deco(uint8_t line) | |
61 { | |
62 set_globalState_Menu_Line(line); | |
63 resetMenuEdit(CLUT_MenuPageDeco); | |
64 | |
65 SSettings *data = settingsGetPointer(); | |
66 | |
67 lineSelected = line; | |
68 | |
69 if((data->dive_mode != DIVEMODE_CCR )&& (line > 1)) | |
70 line += 1; | |
71 | |
72 switch(line) | |
73 { | |
74 case 1: | |
75 default: | |
76 openEdit_DiveMode(); | |
77 break; | |
78 case 2: | |
79 openEdit_CCRModeSensorOrFixedSP(); | |
80 break; | |
81 case 3: | |
82 openEdit_ppO2max(); | |
83 break; | |
84 case 4: | |
85 openEdit_SafetyStop(); | |
86 break; | |
87 case 5: | |
88 openEdit_FutureTTS(); | |
89 break; | |
90 case 6: | |
91 openEdit_Salinity(); | |
92 break; | |
93 } | |
94 } | |
95 | |
96 /* Private functions ---------------------------------------------------------*/ | |
97 | |
98 | |
99 void openEdit_DiveMode(void) | |
100 { | |
101 #define APNEAANDGAUGE | |
102 | |
103 char text[32]; | |
104 uint8_t actualDiveMode, active; | |
105 SSettings *pSettings = settingsGetPointer(); | |
106 actualDiveMode = pSettings->dive_mode; | |
107 | |
108 text[0] = '\001'; | |
109 text[1] = TXT_DiveMode; | |
110 text[2] = 0; | |
111 write_topline(text); | |
112 | |
113 text[1] = 0; | |
114 | |
115 | |
116 text[0] = TXT_OpenCircuit; | |
117 if(actualDiveMode == DIVEMODE_OC) | |
118 active = 1; | |
119 else | |
120 active = 0; | |
121 write_field_on_off(StMDECO1_OC, 30, 500, ME_Y_LINE1, &FontT48, text, active); | |
122 | |
123 text[0] = TXT_ClosedCircuit; | |
124 if(actualDiveMode == DIVEMODE_CCR) | |
125 active = 1; | |
126 else | |
127 active = 0; | |
128 write_field_on_off(StMDECO1_CC, 30, 500, ME_Y_LINE2, &FontT48, text, active); | |
129 | |
130 #ifdef APNEAANDGAUGE | |
131 text[0] = TXT_Apnoe; | |
132 if(actualDiveMode == DIVEMODE_Apnea) | |
133 active = 1; | |
134 else | |
135 active = 0; | |
136 write_field_on_off(StMDECO1_Apnea, 30, 500, ME_Y_LINE3, &FontT48, text, active); | |
137 | |
138 text[0] = TXT_Gauge; | |
139 if(actualDiveMode == DIVEMODE_Gauge) | |
140 active = 1; | |
141 else | |
142 active = 0; | |
143 write_field_on_off(StMDECO1_Gauge, 30, 500, ME_Y_LINE4, &FontT48, text, active); | |
144 #endif | |
145 | |
146 setEvent(StMDECO1_OC, (uint32_t)OnAction_OC); | |
147 setEvent(StMDECO1_CC, (uint32_t)OnAction_CC); | |
148 #ifdef APNEAANDGAUGE | |
149 setEvent(StMDECO1_Apnea, (uint32_t)OnAction_Apnea); | |
150 setEvent(StMDECO1_Gauge, (uint32_t)OnAction_Gauge); | |
151 #endif | |
152 | |
153 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
154 } | |
155 | |
156 uint8_t OnAction_OC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
157 { | |
158 SSettings *pSettings = settingsGetPointer(); | |
159 if(pSettings->dive_mode == DIVEMODE_OC) | |
160 return EXIT_TO_MENU; | |
161 pSettings->dive_mode = DIVEMODE_OC; | |
162 setActualGasFirst(&stateRealGetPointerWrite()->lifeData); | |
163 tMenuEdit_set_on_off(editId, 1); | |
164 tMenuEdit_set_on_off(StMDECO1_CC, 0); | |
165 tMenuEdit_set_on_off(StMDECO1_Apnea, 0); | |
166 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); | |
167 return UPDATE_DIVESETTINGS; | |
168 } | |
169 | |
170 | |
171 uint8_t OnAction_CC (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
172 { | |
173 SSettings *pSettings = settingsGetPointer(); | |
174 if(pSettings->dive_mode == DIVEMODE_CCR) | |
175 return EXIT_TO_MENU; | |
176 pSettings->dive_mode = DIVEMODE_CCR; | |
177 setActualGasFirst(&stateRealGetPointerWrite()->lifeData); | |
178 tMenuEdit_set_on_off(editId, 1); | |
179 tMenuEdit_set_on_off(StMDECO1_OC, 0); | |
180 tMenuEdit_set_on_off(StMDECO1_Apnea, 0); | |
181 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); | |
182 return UPDATE_DIVESETTINGS; | |
183 } | |
184 | |
185 | |
186 uint8_t OnAction_Apnea (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
187 { | |
188 SSettings *pSettings = settingsGetPointer(); | |
189 if(pSettings->dive_mode == DIVEMODE_Apnea) | |
190 return EXIT_TO_MENU; | |
191 pSettings->dive_mode = DIVEMODE_Apnea; | |
192 setActualGasFirst(&stateRealGetPointerWrite()->lifeData); | |
193 tMenuEdit_set_on_off(editId, 1); | |
194 tMenuEdit_set_on_off(StMDECO1_CC, 0); | |
195 tMenuEdit_set_on_off(StMDECO1_OC, 0); | |
196 tMenuEdit_set_on_off(StMDECO1_Gauge, 0); | |
197 return UPDATE_DIVESETTINGS; | |
198 } | |
199 | |
200 | |
201 uint8_t OnAction_Gauge (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
202 { | |
203 SSettings *pSettings = settingsGetPointer(); | |
204 if(pSettings->dive_mode == DIVEMODE_Gauge) | |
205 return EXIT_TO_MENU; | |
206 pSettings->dive_mode = DIVEMODE_Gauge; | |
207 setActualGasFirst(&stateRealGetPointerWrite()->lifeData); | |
208 tMenuEdit_set_on_off(editId, 1); | |
209 tMenuEdit_set_on_off(StMDECO1_CC, 0); | |
210 tMenuEdit_set_on_off(StMDECO1_Apnea, 0); | |
211 tMenuEdit_set_on_off(StMDECO1_OC, 0); | |
212 return UPDATE_DIVESETTINGS; | |
213 } | |
214 | |
215 | |
216 void openEdit_CCRModeSensorOrFixedSP(void) | |
217 { | |
218 SSettings *pSettings = settingsGetPointer(); | |
219 | |
220 if(pSettings->CCR_Mode == CCRMODE_Sensors) | |
221 pSettings->CCR_Mode = CCRMODE_FixedSetpoint; | |
222 else | |
223 pSettings->CCR_Mode = CCRMODE_Sensors; | |
224 | |
225 exitEditWithUpdate(); | |
226 } | |
227 | |
228 | |
229 void openEdit_SafetyStop(void) | |
230 { | |
231 uint32_t safetystopDuration, safetystopDepth; | |
232 char text[64]; | |
233 uint16_t y_line; | |
234 | |
235 safetystopDuration = settingsGetPointer()->safetystopDuration; | |
236 safetystopDepth = settingsGetPointer()->safetystopDepth; | |
237 | |
238 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP); | |
239 | |
240 text[0] = '\001'; | |
241 text[1] = TXT_SafetyStop; | |
242 text[2] = 0; | |
243 write_topline(text); | |
244 | |
245 write_label_fix( 20, 800, y_line, &FontT48, TXT_SafetyStop); | |
246 | |
247 strcpy(text,"\016\016"); | |
248 text[2] = TXT_Minutes; | |
249 if(settingsGetPointer()->nonMetricalSystem) | |
250 { | |
251 strcpy(&text[3], | |
252 "\017" | |
253 " @ " | |
254 "\016\016" | |
255 " ft" | |
256 "\017" | |
257 ); | |
258 } | |
259 else | |
260 { | |
261 strcpy(&text[3], | |
262 "\017" | |
263 " @ " | |
264 "\016\016" | |
265 " m" | |
266 "\017" | |
267 ); | |
268 } | |
269 write_label_var( 410, 800, y_line, &FontT48, text); | |
270 | |
271 if(settingsGetPointer()->nonMetricalSystem) | |
272 { | |
273 write_field_2digit(StMDECO4_SafetyStop, 350, 800, y_line, &FontT48, "## ##", safetystopDuration, unit_depth_integer(safetystopDepth), 0, 0); | |
274 } | |
275 else | |
276 { | |
277 write_field_udigit(StMDECO4_SafetyStop, 370, 800, y_line, &FontT48, "# #", safetystopDuration, safetystopDepth, 0, 0); | |
278 } | |
279 | |
280 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
281 | |
282 setEvent(StMDECO4_SafetyStop, (uint32_t)OnAction_SafetyStop); | |
283 startEdit(); | |
284 } | |
285 | |
286 | |
287 uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
288 { | |
289 uint8_t digitContentNew; | |
290 uint32_t newSafetystopDuration, newSafetystopDepth; | |
291 | |
292 if(action == ACTION_BUTTON_ENTER) | |
293 { | |
294 return digitContent; | |
295 } | |
296 if(action == ACTION_BUTTON_ENTER_FINAL) | |
297 { | |
298 evaluateNewString(editId, &newSafetystopDuration, &newSafetystopDepth, 0, 0); | |
299 | |
300 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170718 | |
301 { | |
302 newSafetystopDepth += 2; // f�r rundung | |
303 newSafetystopDepth = (newSafetystopDepth * 3) / 10; | |
304 } | |
305 | |
306 | |
307 settingsGetPointer()->safetystopDuration = newSafetystopDuration; | |
308 settingsGetPointer()->safetystopDepth = newSafetystopDepth; | |
309 | |
310 tMenuEdit_newInput(editId, newSafetystopDuration, newSafetystopDepth, 0, 0); | |
311 return UPDATE_AND_EXIT_TO_MENU; | |
312 } | |
313 if(action == ACTION_BUTTON_NEXT) | |
314 { | |
315 digitContentNew = digitContent + 1; | |
316 if(blockNumber == 0) | |
317 { | |
318 if(digitContentNew > '5') | |
319 digitContentNew = '0'; | |
320 } | |
321 else | |
322 { | |
323 if(settingsGetPointer()->nonMetricalSystem == 0) | |
324 { | |
325 if(digitContentNew > '6') | |
326 digitContentNew = '3'; | |
327 } | |
328 else | |
329 { | |
330 if(digitContent < 13 + '0') | |
331 digitContentNew = 13 + '0'; | |
332 else if(digitContent < 16 + '0') | |
333 digitContentNew = 16 + '0'; | |
334 else if(digitContent < 20 + '0') | |
335 digitContentNew = 20 + '0'; | |
336 else | |
337 digitContentNew = 10 + '0'; | |
338 } | |
339 } | |
340 return digitContentNew; | |
341 } | |
342 if(action == ACTION_BUTTON_BACK) | |
343 { | |
344 digitContentNew = digitContent - 1; | |
345 if(blockNumber == 0) | |
346 { | |
347 if(digitContentNew < '0') | |
348 digitContentNew = '5'; | |
349 } | |
350 else | |
351 { | |
352 if(settingsGetPointer()->nonMetricalSystem == 0) | |
353 { | |
354 if(digitContentNew < '3') | |
355 digitContentNew = '6'; | |
356 } | |
357 else | |
358 { | |
359 if(digitContent >= 20 + '0') | |
360 digitContentNew = 16 + '0'; | |
361 else if(digitContent >= 16 + '0') | |
362 digitContentNew = 13 + '0'; | |
363 else if(digitContent >= 13 + '0') | |
364 digitContentNew = 10 + '0'; | |
365 else | |
366 digitContentNew = 20 + '0'; | |
367 } | |
368 } | |
369 return digitContentNew; | |
370 } | |
371 return EXIT_TO_MENU; | |
372 } | |
373 | |
374 | |
375 void openEdit_Salinity(void) | |
376 { | |
377 char text[32]; | |
378 uint16_t y_line; | |
379 | |
380 text[0] = '\001'; | |
381 text[1] = TXT_Salinity; | |
382 text[2] = 0; | |
383 write_topline(text); | |
384 | |
385 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP); | |
386 | |
387 write_label_fix( 30, 800, y_line, &FontT48, TXT_Salinity); | |
388 write_label_var( 400, 800, y_line, &FontT48, "\016\016 %\017"); | |
389 | |
390 write_field_udigit(StMDECO6_SALINITY, 370, 800, y_line, &FontT48, "#", (uint32_t)settingsGetPointer()->salinity, 0, 0, 0); | |
391 | |
392 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
393 | |
394 setEvent(StMDECO6_SALINITY, (uint32_t)OnAction_Salinity); | |
395 startEdit(); | |
396 } | |
397 | |
398 | |
399 uint8_t OnAction_Salinity(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
400 { | |
401 SSettings *pSettings; | |
402 uint8_t digitContentNew; | |
403 uint32_t salinity; | |
404 | |
405 if(action == ACTION_BUTTON_ENTER) | |
406 { | |
407 return digitContent; | |
408 } | |
409 if(action == ACTION_BUTTON_ENTER_FINAL) | |
410 { | |
411 evaluateNewString(editId, &salinity, 0, 0, 0); | |
412 | |
413 if(salinity >= 4) | |
414 salinity = 4; | |
415 | |
416 pSettings = settingsGetPointer(); | |
417 | |
418 pSettings->salinity = salinity; | |
419 | |
420 tMenuEdit_newInput(editId, salinity, 0, 0, 0); | |
421 return UPDATE_AND_EXIT_TO_MENU; | |
422 } | |
423 if(action == ACTION_BUTTON_NEXT) | |
424 { | |
425 digitContentNew = digitContent + 1; | |
426 if(digitContentNew > '4') | |
427 digitContentNew = '0'; | |
428 return digitContentNew; | |
429 } | |
430 if(action == ACTION_BUTTON_BACK) | |
431 { | |
432 digitContentNew = digitContent - 1; | |
433 if(digitContentNew < '0') | |
434 digitContentNew = '4'; | |
435 return digitContentNew; | |
436 } | |
437 | |
438 return EXIT_TO_MENU; | |
439 } | |
440 | |
441 | |
442 void openEdit_ppO2max(void) | |
443 { | |
444 uint8_t maxL_std, maxL_deco; | |
445 uint16_t y_line; | |
446 char text[32]; | |
447 SSettings *pSettings = settingsGetPointer(); | |
448 | |
449 maxL_std = pSettings->ppO2_max_std - 100; | |
450 maxL_deco = pSettings->ppO2_max_deco - 100; | |
451 | |
452 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP); | |
453 | |
454 text[0] = '\001'; | |
455 text[1] = TXT_ppO2Name; | |
456 text[2] = 0; | |
457 write_topline(text); | |
458 | |
459 strcpy(text,"ppO2\016\016max\017"); | |
460 write_label_var( 20, 800, y_line, &FontT48, text); | |
461 strcpy(text, | |
462 "\016\016" | |
463 " bar " | |
464 " deco " | |
465 "\017" | |
466 " " | |
467 "\016\016" | |
468 " bar" | |
469 "\017" | |
470 ); | |
471 write_label_var( 460, 800, y_line, &FontT48, text); | |
472 | |
473 // write_field_udigit(StMDECO4_PPO2Max, 410, 800, y_line, &FontT48, "## ##", (uint32_t)maxL_std, (uint32_t)maxL_deco, 0, 0); | |
474 write_field_udigit(StMDECO3_PPO2Max, 370, 800, y_line, &FontT48, "1.## 1.##", (uint32_t)maxL_std, (uint32_t)maxL_deco, 0, 0); | |
475 | |
476 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
477 | |
478 setEvent(StMDECO3_PPO2Max, (uint32_t)OnAction_ppO2Max); | |
479 startEdit(); | |
480 } | |
481 | |
482 | |
483 uint8_t OnAction_ppO2Max(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
484 { | |
485 SSettings *pSettings; | |
486 uint8_t digitContentNew; | |
487 uint32_t newPPO2LStd, newPPO2LDeco; | |
488 | |
489 if(action == ACTION_BUTTON_ENTER) | |
490 { | |
491 return digitContent; | |
492 } | |
493 if(action == ACTION_BUTTON_ENTER_FINAL) | |
494 { | |
495 evaluateNewString(editId, &newPPO2LStd, &newPPO2LDeco, 0, 0); | |
496 | |
497 if(newPPO2LStd > 90) | |
498 newPPO2LStd = 90; | |
499 | |
500 if(newPPO2LDeco > 90) | |
501 newPPO2LDeco = 90; | |
502 | |
503 pSettings = settingsGetPointer(); | |
504 pSettings->ppO2_max_std = 100 + newPPO2LStd; | |
505 pSettings->ppO2_max_deco = 100 + newPPO2LDeco; | |
506 | |
507 tMenuEdit_newInput(editId, newPPO2LStd, newPPO2LDeco, 0, 0); | |
508 return UPDATE_AND_EXIT_TO_MENU; | |
509 } | |
510 if(action == ACTION_BUTTON_NEXT) | |
511 { | |
512 digitContentNew = digitContent + 1; | |
513 if(digitContentNew > '9') | |
514 digitContentNew = '0'; | |
515 return digitContentNew; | |
516 } | |
517 if(action == ACTION_BUTTON_BACK) | |
518 { | |
519 digitContentNew = digitContent - 1; | |
520 if(digitContentNew < '0') | |
521 digitContentNew = '9'; | |
522 return digitContentNew; | |
523 } | |
524 return EXIT_TO_MENU; | |
525 } | |
526 | |
527 | |
528 void openEdit_FutureTTS(void) | |
529 { | |
530 uint8_t futureTTS; | |
531 uint16_t y_line; | |
532 | |
533 char text[32]; | |
534 SSettings *pSettings = settingsGetPointer(); | |
535 futureTTS = pSettings->future_TTS; | |
536 | |
537 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP); | |
538 | |
539 text[0] = '\001'; | |
540 text[1] = TXT_FutureTTS; | |
541 text[2] = 0; | |
542 write_topline(text); | |
543 | |
544 strcpy(text,"\016\016"); | |
545 text[2] = TXT_Minutes; | |
546 text[3] = 0; | |
547 write_label_fix( 20, 800, y_line, &FontT48, TXT_FutureTTS); | |
548 write_label_var( 435, 800, y_line, &FontT48, text); | |
549 write_field_2digit(StMDECO5_FUTURE, 370, 500, y_line, &FontT48, "##", (uint32_t)futureTTS, 0, 0, 0); | |
550 | |
551 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
552 | |
553 setEvent(StMDECO5_FUTURE, (uint32_t)OnAction_FutureTTS); | |
554 startEdit(); | |
555 } | |
556 | |
557 | |
558 uint8_t OnAction_FutureTTS(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) | |
559 { | |
560 SSettings *pSettings; | |
561 int8_t digitContentNew; | |
562 uint32_t newFutureTTS; | |
563 | |
564 if(action == ACTION_BUTTON_ENTER) | |
565 { | |
566 return digitContent; | |
567 } | |
568 if(action == ACTION_BUTTON_ENTER_FINAL) | |
569 { | |
570 evaluateNewString(editId, &newFutureTTS, 0, 0, 0); | |
571 | |
572 if(newFutureTTS > 15) | |
573 newFutureTTS = 15; | |
574 | |
575 pSettings = settingsGetPointer(); | |
576 pSettings->future_TTS = newFutureTTS; | |
577 | |
578 tMenuEdit_newInput(editId, newFutureTTS, 0, 0, 0); | |
579 return UPDATE_AND_EXIT_TO_MENU; | |
580 } | |
581 if(action == ACTION_BUTTON_NEXT) | |
582 { | |
583 digitContentNew = digitContent + 1; | |
584 if(digitContentNew > '0'+ 15) | |
585 digitContentNew = '0'; | |
586 return digitContentNew; | |
587 } | |
588 if(action == ACTION_BUTTON_BACK) | |
589 { | |
590 digitContentNew = digitContent - 1; | |
591 if(digitContentNew < '0') | |
592 digitContentNew = '0' + 15; | |
593 return digitContentNew; | |
594 } | |
595 /* | |
596 if(action == ACTION_BUTTON_NEXT) | |
597 { | |
598 digitContentNew = digitContent + 1; | |
599 if((digitNumber == 0) && (digitContentNew > '1')) | |
600 digitContentNew = '0'; | |
601 else | |
602 if(digitContentNew > '9') | |
603 digitContentNew = '0'; | |
604 return digitContentNew; | |
605 } | |
606 if(action == ACTION_BUTTON_BACK) | |
607 { | |
608 digitContentNew = digitContent - 1; | |
609 if((digitNumber == 0) && (digitContentNew < '0')) | |
610 digitContentNew = '1'; | |
611 else | |
612 if(digitContentNew < '0') | |
613 digitContentNew = '9'; | |
614 return digitContentNew; | |
615 } | |
616 */ | |
617 return EXIT_TO_MENU; | |
618 } | |
619 | |
620 |