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