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