Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditDeco.c @ 849:fce639612464 Evo_2_23
Consider flipped screen for Predive menu:
In previous version some values were not optimized for the visualization while the screen is flipped.
author | Ideenmodellierer |
---|---|
date | Thu, 29 Feb 2024 18:49:55 +0100 |
parents | e81afd727993 |
children | 608d3e918146 |
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" |
662 | 35 #include "configuration.h" |
38 | 36 |
37 /* Private variables ---------------------------------------------------------*/ | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
38 static uint8_t lineSelected = 0; |
38 | 39 |
40 /* Private function prototypes -----------------------------------------------*/ | |
41 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
42 static void openEdit_DiveMode(void); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
43 static void openEdit_ppO2max(void); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
44 static void openEdit_SafetyStop(void); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
45 static void openEdit_FutureTTS(void); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
46 static void openEdit_Salinity(void); |
38 | 47 |
48 /* Announced function prototypes -----------------------------------------------*/ | |
662 | 49 static uint8_t OnAction_setMode (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
50 static uint8_t OnAction_FutureTTS (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
51 static uint8_t OnAction_ppO2Max (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
52 static uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
53 static uint8_t OnAction_Salinity (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
38 | 54 /* Exported functions --------------------------------------------------------*/ |
55 | |
56 void openEdit_Deco(uint8_t line) | |
57 { | |
58 set_globalState_Menu_Line(line); | |
59 resetMenuEdit(CLUT_MenuPageDeco); | |
60 | |
61 lineSelected = line; | |
62 | |
63 switch(line) | |
64 { | |
65 case 1: | |
66 default: | |
67 openEdit_DiveMode(); | |
68 break; | |
69 case 2: | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
70 openEdit_ppO2max(); |
38 | 71 break; |
72 case 3: | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
73 openEdit_SafetyStop(); |
38 | 74 break; |
75 case 4: | |
707
e81afd727993
Menu cleanup rebreather specific settings:
Ideenmodellierer
parents:
662
diff
changeset
|
76 openEdit_FutureTTS(); |
38 | 77 break; |
78 case 5: | |
79 openEdit_Salinity(); | |
80 break; | |
81 } | |
82 } | |
83 | |
84 /* Private functions ---------------------------------------------------------*/ | |
85 | |
86 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
87 static void openEdit_DiveMode(void) |
38 | 88 { |
89 #define APNEAANDGAUGE | |
90 | |
91 char text[32]; | |
662 | 92 uint8_t lineOffset = 0; |
38 | 93 uint8_t actualDiveMode, active; |
94 SSettings *pSettings = settingsGetPointer(); | |
95 actualDiveMode = pSettings->dive_mode; | |
96 | |
97 text[0] = '\001'; | |
98 text[1] = TXT_DiveMode; | |
99 text[2] = 0; | |
100 write_topline(text); | |
101 | |
102 text[1] = 0; | |
103 | |
104 | |
662 | 105 #ifdef ENABLE_PSCR_MODE |
106 lineOffset = ME_Y_LINE_STEP; | |
107 #endif | |
108 | |
38 | 109 text[0] = TXT_OpenCircuit; |
110 if(actualDiveMode == DIVEMODE_OC) | |
111 active = 1; | |
112 else | |
113 active = 0; | |
114 write_field_on_off(StMDECO1_OC, 30, 500, ME_Y_LINE1, &FontT48, text, active); | |
115 | |
116 text[0] = TXT_ClosedCircuit; | |
117 if(actualDiveMode == DIVEMODE_CCR) | |
118 active = 1; | |
119 else | |
120 active = 0; | |
121 write_field_on_off(StMDECO1_CC, 30, 500, ME_Y_LINE2, &FontT48, text, active); | |
122 | |
662 | 123 #ifdef ENABLE_PSCR_MODE |
124 text[0] = TXT_PSClosedCircuit; | |
125 if(actualDiveMode == DIVEMODE_PSCR) | |
126 active = 1; | |
127 else | |
128 active = 0; | |
129 write_field_on_off(StMDECO1_PSCR, 30, 500, ME_Y_LINE3, &FontT48, text, active); | |
130 #endif | |
131 #ifdef APNEAANDGAUGE | |
38 | 132 text[0] = TXT_Apnoe; |
133 if(actualDiveMode == DIVEMODE_Apnea) | |
134 active = 1; | |
135 else | |
136 active = 0; | |
662 | 137 write_field_on_off(StMDECO1_Apnea, 30, 500, ME_Y_LINE3 + lineOffset, &FontT48, text, active); |
38 | 138 |
139 text[0] = TXT_Gauge; | |
140 if(actualDiveMode == DIVEMODE_Gauge) | |
141 active = 1; | |
142 else | |
143 active = 0; | |
662 | 144 write_field_on_off(StMDECO1_Gauge, 30, 500, ME_Y_LINE4 + lineOffset, &FontT48, text, active); |
145 #endif | |
38 | 146 |
662 | 147 setEvent(StMDECO1_OC, (uint32_t)OnAction_setMode); |
148 setEvent(StMDECO1_CC, (uint32_t)OnAction_setMode); | |
149 #ifdef ENABLE_PSCR_MODE | |
150 setEvent(StMDECO1_PSCR, (uint32_t)OnAction_setMode); | |
151 #endif | |
152 | |
153 #ifdef APNEAANDGAUGE | |
154 setEvent(StMDECO1_Apnea, (uint32_t)OnAction_setMode); | |
155 setEvent(StMDECO1_Gauge, (uint32_t)OnAction_setMode); | |
156 #endif | |
38 | 157 |
158 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext); | |
159 } | |
160 | |
662 | 161 |
162 static uint8_t OnAction_setMode (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) //(uint32_t newMode) | |
38 | 163 { |
662 | 164 uint32_t modeArray[] = {StMDECO1_OC, StMDECO1_CC, StMDECO1_Gauge, StMDECO1_Apnea /* definition needs to follow order of DIVEMODE (settings.h) */ |
165 #ifdef ENABLE_PSCR_MODE | |
166 , StMDECO1_PSCR | |
167 #endif | |
168 }; | |
169 | |
170 uint8_t index = 0; | |
171 SSettings *pSettings = settingsGetPointer(); | |
172 uint8_t retVal = EXIT_TO_MENU; | |
173 uint8_t lastMode = pSettings->dive_mode; | |
38 | 174 |
175 | |
662 | 176 setActualGasFirst(&stateRealGetPointerWrite()->lifeData); |
177 while(index < sizeof(modeArray) / 4) /* calculate number of items out of array size (bytes) */ | |
178 { | |
179 if(editId == modeArray[index]) | |
180 { | |
181 if(pSettings->dive_mode != index) | |
182 { | |
183 tMenuEdit_set_on_off(modeArray[index], 1); | |
184 pSettings->dive_mode = index; | |
185 retVal = UPDATE_DIVESETTINGS; | |
186 } | |
187 } | |
188 else | |
189 { | |
190 if(lastMode == index) /* reset state of previous mode selection */ | |
191 { | |
192 tMenuEdit_set_on_off(modeArray[index], 0); | |
193 } | |
194 } | |
195 index++; | |
196 } | |
197 return retVal; | |
38 | 198 } |
199 | |
200 | |
201 | |
202 | |
203 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
204 static void openEdit_SafetyStop(void) |
38 | 205 { |
206 uint32_t safetystopDuration, safetystopDepth; | |
207 char text[64]; | |
208 uint16_t y_line; | |
209 | |
210 safetystopDuration = settingsGetPointer()->safetystopDuration; | |
211 safetystopDepth = settingsGetPointer()->safetystopDepth; | |
212 | |
213 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP); | |
214 | |
215 text[0] = '\001'; | |
216 text[1] = TXT_SafetyStop; | |
217 text[2] = 0; | |
218 write_topline(text); | |
219 | |
220 write_label_fix( 20, 800, y_line, &FontT48, TXT_SafetyStop); | |
221 | |
222 strcpy(text,"\016\016"); | |
223 text[2] = TXT_Minutes; | |
224 if(settingsGetPointer()->nonMetricalSystem) | |
225 { | |
226 strcpy(&text[3], | |
227 "\017" | |
228 " @ " | |
229 "\016\016" | |
230 " ft" | |
231 "\017" | |
232 ); | |
233 } | |
234 else | |
235 { | |
236 strcpy(&text[3], | |
237 "\017" | |
238 " @ " | |
239 "\016\016" | |
240 " m" | |
241 "\017" | |
242 ); | |
243 } | |
244 write_label_var( 410, 800, y_line, &FontT48, text); | |
245 | |
246 if(settingsGetPointer()->nonMetricalSystem) | |
247 { | |
248 write_field_2digit(StMDECO4_SafetyStop, 350, 800, y_line, &FontT48, "## ##", safetystopDuration, unit_depth_integer(safetystopDepth), 0, 0); | |
249 } | |
250 else | |
251 { | |
252 write_field_udigit(StMDECO4_SafetyStop, 370, 800, y_line, &FontT48, "# #", safetystopDuration, safetystopDepth, 0, 0); | |
253 } | |
254 | |
255 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
256 | |
257 setEvent(StMDECO4_SafetyStop, (uint32_t)OnAction_SafetyStop); | |
258 startEdit(); | |
259 } | |
260 | |
261 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
262 static uint8_t OnAction_SafetyStop (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 263 { |
264 uint8_t digitContentNew; | |
265 uint32_t newSafetystopDuration, newSafetystopDepth; | |
266 | |
267 if(action == ACTION_BUTTON_ENTER) | |
268 { | |
269 return digitContent; | |
270 } | |
271 if(action == ACTION_BUTTON_ENTER_FINAL) | |
272 { | |
273 evaluateNewString(editId, &newSafetystopDuration, &newSafetystopDepth, 0, 0); | |
274 | |
275 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170718 | |
276 { | |
277 newSafetystopDepth += 2; // f�r rundung | |
278 newSafetystopDepth = (newSafetystopDepth * 3) / 10; | |
279 } | |
280 | |
281 | |
282 settingsGetPointer()->safetystopDuration = newSafetystopDuration; | |
283 settingsGetPointer()->safetystopDepth = newSafetystopDepth; | |
284 | |
285 tMenuEdit_newInput(editId, newSafetystopDuration, newSafetystopDepth, 0, 0); | |
286 return UPDATE_AND_EXIT_TO_MENU; | |
287 } | |
288 if(action == ACTION_BUTTON_NEXT) | |
289 { | |
290 digitContentNew = digitContent + 1; | |
291 if(blockNumber == 0) | |
292 { | |
293 if(digitContentNew > '5') | |
294 digitContentNew = '0'; | |
295 } | |
296 else | |
297 { | |
298 if(settingsGetPointer()->nonMetricalSystem == 0) | |
299 { | |
300 if(digitContentNew > '6') | |
301 digitContentNew = '3'; | |
302 } | |
303 else | |
304 { | |
305 if(digitContent < 13 + '0') | |
306 digitContentNew = 13 + '0'; | |
307 else if(digitContent < 16 + '0') | |
308 digitContentNew = 16 + '0'; | |
309 else if(digitContent < 20 + '0') | |
310 digitContentNew = 20 + '0'; | |
311 else | |
312 digitContentNew = 10 + '0'; | |
313 } | |
314 } | |
315 return digitContentNew; | |
316 } | |
317 if(action == ACTION_BUTTON_BACK) | |
318 { | |
319 digitContentNew = digitContent - 1; | |
320 if(blockNumber == 0) | |
321 { | |
322 if(digitContentNew < '0') | |
323 digitContentNew = '5'; | |
324 } | |
325 else | |
326 { | |
327 if(settingsGetPointer()->nonMetricalSystem == 0) | |
328 { | |
329 if(digitContentNew < '3') | |
330 digitContentNew = '6'; | |
331 } | |
332 else | |
333 { | |
334 if(digitContent >= 20 + '0') | |
335 digitContentNew = 16 + '0'; | |
336 else if(digitContent >= 16 + '0') | |
337 digitContentNew = 13 + '0'; | |
338 else if(digitContent >= 13 + '0') | |
339 digitContentNew = 10 + '0'; | |
340 else | |
341 digitContentNew = 20 + '0'; | |
342 } | |
343 } | |
344 return digitContentNew; | |
345 } | |
346 return EXIT_TO_MENU; | |
347 } | |
348 | |
349 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
350 static void openEdit_Salinity(void) |
38 | 351 { |
352 char text[32]; | |
353 uint16_t y_line; | |
354 | |
355 text[0] = '\001'; | |
356 text[1] = TXT_Salinity; | |
357 text[2] = 0; | |
358 write_topline(text); | |
359 | |
360 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP); | |
361 | |
362 write_label_fix( 30, 800, y_line, &FontT48, TXT_Salinity); | |
363 write_label_var( 400, 800, y_line, &FontT48, "\016\016 %\017"); | |
364 | |
365 write_field_udigit(StMDECO6_SALINITY, 370, 800, y_line, &FontT48, "#", (uint32_t)settingsGetPointer()->salinity, 0, 0, 0); | |
366 | |
367 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
368 | |
369 setEvent(StMDECO6_SALINITY, (uint32_t)OnAction_Salinity); | |
370 startEdit(); | |
371 } | |
372 | |
373 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
374 static uint8_t OnAction_Salinity(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 375 { |
376 SSettings *pSettings; | |
377 uint8_t digitContentNew; | |
378 uint32_t salinity; | |
379 | |
380 if(action == ACTION_BUTTON_ENTER) | |
381 { | |
382 return digitContent; | |
383 } | |
384 if(action == ACTION_BUTTON_ENTER_FINAL) | |
385 { | |
386 evaluateNewString(editId, &salinity, 0, 0, 0); | |
387 | |
388 if(salinity >= 4) | |
389 salinity = 4; | |
390 | |
391 pSettings = settingsGetPointer(); | |
392 | |
393 pSettings->salinity = salinity; | |
394 | |
395 tMenuEdit_newInput(editId, salinity, 0, 0, 0); | |
396 return UPDATE_AND_EXIT_TO_MENU; | |
397 } | |
398 if(action == ACTION_BUTTON_NEXT) | |
399 { | |
400 digitContentNew = digitContent + 1; | |
401 if(digitContentNew > '4') | |
402 digitContentNew = '0'; | |
403 return digitContentNew; | |
404 } | |
405 if(action == ACTION_BUTTON_BACK) | |
406 { | |
407 digitContentNew = digitContent - 1; | |
408 if(digitContentNew < '0') | |
409 digitContentNew = '4'; | |
410 return digitContentNew; | |
411 } | |
412 | |
413 return EXIT_TO_MENU; | |
414 } | |
415 | |
416 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
417 static void openEdit_ppO2max(void) |
38 | 418 { |
419 uint8_t maxL_std, maxL_deco; | |
420 uint16_t y_line; | |
421 char text[32]; | |
422 SSettings *pSettings = settingsGetPointer(); | |
423 | |
424 maxL_std = pSettings->ppO2_max_std - 100; | |
425 maxL_deco = pSettings->ppO2_max_deco - 100; | |
426 | |
427 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP); | |
428 | |
429 text[0] = '\001'; | |
430 text[1] = TXT_ppO2Name; | |
431 text[2] = 0; | |
432 write_topline(text); | |
433 | |
434 strcpy(text,"ppO2\016\016max\017"); | |
435 write_label_var( 20, 800, y_line, &FontT48, text); | |
436 strcpy(text, | |
437 "\016\016" | |
438 " bar " | |
439 " deco " | |
440 "\017" | |
441 " " | |
442 "\016\016" | |
443 " bar" | |
444 "\017" | |
445 ); | |
446 write_label_var( 460, 800, y_line, &FontT48, text); | |
447 | |
448 // write_field_udigit(StMDECO4_PPO2Max, 410, 800, y_line, &FontT48, "## ##", (uint32_t)maxL_std, (uint32_t)maxL_deco, 0, 0); | |
449 write_field_udigit(StMDECO3_PPO2Max, 370, 800, y_line, &FontT48, "1.## 1.##", (uint32_t)maxL_std, (uint32_t)maxL_deco, 0, 0); | |
450 | |
451 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
452 | |
453 setEvent(StMDECO3_PPO2Max, (uint32_t)OnAction_ppO2Max); | |
454 startEdit(); | |
455 } | |
456 | |
457 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
458 static uint8_t OnAction_ppO2Max(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 459 { |
460 SSettings *pSettings; | |
461 uint8_t digitContentNew; | |
462 uint32_t newPPO2LStd, newPPO2LDeco; | |
463 | |
464 if(action == ACTION_BUTTON_ENTER) | |
465 { | |
466 return digitContent; | |
467 } | |
468 if(action == ACTION_BUTTON_ENTER_FINAL) | |
469 { | |
470 evaluateNewString(editId, &newPPO2LStd, &newPPO2LDeco, 0, 0); | |
471 | |
472 if(newPPO2LStd > 90) | |
473 newPPO2LStd = 90; | |
474 | |
475 if(newPPO2LDeco > 90) | |
476 newPPO2LDeco = 90; | |
477 | |
478 pSettings = settingsGetPointer(); | |
479 pSettings->ppO2_max_std = 100 + newPPO2LStd; | |
480 pSettings->ppO2_max_deco = 100 + newPPO2LDeco; | |
481 | |
482 tMenuEdit_newInput(editId, newPPO2LStd, newPPO2LDeco, 0, 0); | |
483 return UPDATE_AND_EXIT_TO_MENU; | |
484 } | |
485 if(action == ACTION_BUTTON_NEXT) | |
486 { | |
487 digitContentNew = digitContent + 1; | |
488 if(digitContentNew > '9') | |
489 digitContentNew = '0'; | |
490 return digitContentNew; | |
491 } | |
492 if(action == ACTION_BUTTON_BACK) | |
493 { | |
494 digitContentNew = digitContent - 1; | |
495 if(digitContentNew < '0') | |
496 digitContentNew = '9'; | |
497 return digitContentNew; | |
498 } | |
499 return EXIT_TO_MENU; | |
500 } | |
501 | |
502 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
503 static void openEdit_FutureTTS(void) |
38 | 504 { |
505 uint8_t futureTTS; | |
506 uint16_t y_line; | |
507 | |
508 char text[32]; | |
509 SSettings *pSettings = settingsGetPointer(); | |
510 futureTTS = pSettings->future_TTS; | |
511 | |
512 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP); | |
513 | |
514 text[0] = '\001'; | |
515 text[1] = TXT_FutureTTS; | |
516 text[2] = 0; | |
517 write_topline(text); | |
518 | |
519 strcpy(text,"\016\016"); | |
520 text[2] = TXT_Minutes; | |
521 text[3] = 0; | |
522 write_label_fix( 20, 800, y_line, &FontT48, TXT_FutureTTS); | |
523 write_label_var( 435, 800, y_line, &FontT48, text); | |
524 write_field_2digit(StMDECO5_FUTURE, 370, 500, y_line, &FontT48, "##", (uint32_t)futureTTS, 0, 0, 0); | |
525 | |
526 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus); | |
527 | |
528 setEvent(StMDECO5_FUTURE, (uint32_t)OnAction_FutureTTS); | |
529 startEdit(); | |
530 } | |
531 | |
532 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
533 static uint8_t OnAction_FutureTTS(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 534 { |
535 SSettings *pSettings; | |
536 int8_t digitContentNew; | |
537 uint32_t newFutureTTS; | |
538 | |
539 if(action == ACTION_BUTTON_ENTER) | |
540 { | |
541 return digitContent; | |
542 } | |
543 if(action == ACTION_BUTTON_ENTER_FINAL) | |
544 { | |
545 evaluateNewString(editId, &newFutureTTS, 0, 0, 0); | |
546 | |
547 if(newFutureTTS > 15) | |
548 newFutureTTS = 15; | |
549 | |
550 pSettings = settingsGetPointer(); | |
551 pSettings->future_TTS = newFutureTTS; | |
552 | |
553 tMenuEdit_newInput(editId, newFutureTTS, 0, 0, 0); | |
554 return UPDATE_AND_EXIT_TO_MENU; | |
555 } | |
556 if(action == ACTION_BUTTON_NEXT) | |
557 { | |
558 digitContentNew = digitContent + 1; | |
559 if(digitContentNew > '0'+ 15) | |
560 digitContentNew = '0'; | |
561 return digitContentNew; | |
562 } | |
563 if(action == ACTION_BUTTON_BACK) | |
564 { | |
565 digitContentNew = digitContent - 1; | |
566 if(digitContentNew < '0') | |
567 digitContentNew = '0' + 15; | |
568 return digitContentNew; | |
569 } | |
570 return EXIT_TO_MENU; | |
571 } |