annotate Discovery/Src/tMenuEditDeco.c @ 927:908d9a8e8c84 Evo_2_23

Cleanup Internal Uart: The internal UART was using the wrong UART RX channel. In addition the compile switches have been updated to allow GNSS data flow if new GPIO config is available or if GNSS is enabled for the external UART.
author Ideenmodellierer
date Tue, 26 Nov 2024 21:01:13 +0100
parents 5ce7708a9095
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/tMenuEditDeco.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief Main Template file for Menu Edit Deco Parameters
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author heinrichs weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 31-July-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 /* Includes ------------------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include "tMenuEditDeco.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 #include "gfx_fonts.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
35 #include "configuration.h"
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 /* Private function prototypes -----------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 /* Announced function prototypes -----------------------------------------------*/
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
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
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 /* Exported functions --------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 void openEdit_Deco(uint8_t line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 set_globalState_Menu_Line(line);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 resetMenuEdit(CLUT_MenuPageDeco);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 lineSelected = line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 switch(line)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 case 1:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 default:
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 openEdit_DiveMode();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 case 2:
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
72 openEdit_ppO2max();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74 case 3:
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
75 openEdit_SafetyStop();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 case 4:
882
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
78 openEdit_ExitTime();
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
79 break;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
80 case 5:
707
e81afd727993 Menu cleanup rebreather specific settings:
Ideenmodellierer
parents: 662
diff changeset
81 openEdit_FutureTTS();
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 break;
882
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
83 case 6:
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84 openEdit_Salinity();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 break;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 /* Private functions ---------------------------------------------------------*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 #define APNEAANDGAUGE
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 char text[32];
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
97 uint8_t lineOffset = 0;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 uint8_t actualDiveMode, active;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100 actualDiveMode = pSettings->dive_mode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 text[1] = TXT_DiveMode;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 text[1] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
110 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
111 lineOffset = ME_Y_LINE_STEP;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
112 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
113
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 text[0] = TXT_OpenCircuit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115 if(actualDiveMode == DIVEMODE_OC)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118 active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 write_field_on_off(StMDECO1_OC, 30, 500, ME_Y_LINE1, &FontT48, text, active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 text[0] = TXT_ClosedCircuit;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 if(actualDiveMode == DIVEMODE_CCR)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 active = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 write_field_on_off(StMDECO1_CC, 30, 500, ME_Y_LINE2, &FontT48, text, active);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
128 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
129 text[0] = TXT_PSClosedCircuit;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
130 if(actualDiveMode == DIVEMODE_PSCR)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
131 active = 1;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
132 else
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
133 active = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
134 write_field_on_off(StMDECO1_PSCR, 30, 500, ME_Y_LINE3, &FontT48, text, active);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
135 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
136 #ifdef APNEAANDGAUGE
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 text[0] = TXT_Apnoe;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 if(actualDiveMode == DIVEMODE_Apnea)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 active = 0;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
142 write_field_on_off(StMDECO1_Apnea, 30, 500, ME_Y_LINE3 + lineOffset, &FontT48, text, active);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 text[0] = TXT_Gauge;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145 if(actualDiveMode == DIVEMODE_Gauge)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 active = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 active = 0;
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
149 write_field_on_off(StMDECO1_Gauge, 30, 500, ME_Y_LINE4 + lineOffset, &FontT48, text, active);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
150 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
152 setEvent(StMDECO1_OC, (uint32_t)OnAction_setMode);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
153 setEvent(StMDECO1_CC, (uint32_t)OnAction_setMode);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
154 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
155 setEvent(StMDECO1_PSCR, (uint32_t)OnAction_setMode);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
156 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
157
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
158 #ifdef APNEAANDGAUGE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
159 setEvent(StMDECO1_Apnea, (uint32_t)OnAction_setMode);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
160 setEvent(StMDECO1_Gauge, (uint32_t)OnAction_setMode);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
161 #endif
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 write_buttonTextline(TXT2BYTE_ButtonBack,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonNext);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
166
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 {
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
169 uint32_t modeArray[] = {StMDECO1_OC, StMDECO1_CC, StMDECO1_Gauge, StMDECO1_Apnea /* definition needs to follow order of DIVEMODE (settings.h) */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
170 #ifdef ENABLE_PSCR_MODE
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
171 , StMDECO1_PSCR
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
172 #endif
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
173 };
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
174
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
175 uint8_t index = 0;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
176 SSettings *pSettings = settingsGetPointer();
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
177 uint8_t retVal = EXIT_TO_MENU;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
178 uint8_t lastMode = pSettings->dive_mode;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180
662
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
181 setActualGasFirst(&stateRealGetPointerWrite()->lifeData);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
182 while(index < sizeof(modeArray) / 4) /* calculate number of items out of array size (bytes) */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
183 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
184 if(editId == modeArray[index])
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
185 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
186 if(pSettings->dive_mode != index)
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
187 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
188 tMenuEdit_set_on_off(modeArray[index], 1);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
189 pSettings->dive_mode = index;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
190 retVal = UPDATE_DIVESETTINGS;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
191 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
192 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
193 else
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
194 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
195 if(lastMode == index) /* reset state of previous mode selection */
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
196 {
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
197 tMenuEdit_set_on_off(modeArray[index], 0);
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
198 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
199 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
200 index++;
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
201 }
1b995079c045 PSCR Mode
heinrichs weikamp
parents: 288
diff changeset
202 return retVal;
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 uint32_t safetystopDuration, safetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 char text[64];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 safetystopDuration = settingsGetPointer()->safetystopDuration;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216 safetystopDepth = settingsGetPointer()->safetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 text[1] = TXT_SafetyStop;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225 write_label_fix( 20, 800, y_line, &FontT48, TXT_SafetyStop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 strcpy(text,"\016\016");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 text[2] = TXT_Minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 strcpy(&text[3],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 " @ "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235 " ft"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 strcpy(&text[3],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 " @ "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245 " m"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249 write_label_var( 410, 800, y_line, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 if(settingsGetPointer()->nonMetricalSystem)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 write_field_2digit(StMDECO4_SafetyStop, 350, 800, y_line, &FontT48, "## ##", safetystopDuration, unit_depth_integer(safetystopDepth), 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 write_field_udigit(StMDECO4_SafetyStop, 370, 800, y_line, &FontT48, "# #", safetystopDuration, safetystopDepth, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 setEvent(StMDECO4_SafetyStop, (uint32_t)OnAction_SafetyStop);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266
882
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
267 static void openEdit_ExitTime(void)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
268 {
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
269 uint32_t SlowExitTime;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
270 char text[64];
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
271 uint16_t y_line;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
272
905
24c08a80a5f7 DevBugfix SlowExit edit display:
ideenmodellierer
parents: 882
diff changeset
273 SlowExitTime = settingsGetPointer()->slowExitTime;
882
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
274
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
275 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
276
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
277 text[0] = '\001';
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
278 text[1] = TXT_2BYTE;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
279 text[2] = TXT2BYTE_SlowExit;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
280 text[3] = 0;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
281 write_topline(text);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
282
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
283 write_label_var( 20, 800, y_line, &FontT48, &text[1]);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
284
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
285 strcpy(text,"\016\016");
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
286 text[2] = TXT_Minutes;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
287 if(settingsGetPointer()->nonMetricalSystem)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
288 {
914
5ce7708a9095 Devbugfix SlowExit depth:
Ideenmodellierer
parents: 905
diff changeset
289 sprintf(&text[3], "\017 ^ %u\016\016 ft\017", unit_depth_integer(settingsGetPointer()->last_stop_depth_meter));
882
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
290 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
291 else
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
292 {
914
5ce7708a9095 Devbugfix SlowExit depth:
Ideenmodellierer
parents: 905
diff changeset
293 sprintf(&text[3], "\017 ^ %u\016\016 m\017", settingsGetPointer()->last_stop_depth_meter);
882
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
294 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
295 write_label_var( 410, 800, y_line, &FontT48, text);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
296
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
297 write_field_udigit(StMDECO_SlowExit, 370, 800, y_line, &FontT48, "#", SlowExitTime, 0, 0, 0);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
298 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
299
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
300 setEvent(StMDECO_SlowExit, (uint32_t)OnAction_SlowExitTime);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
301 startEdit();
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
302 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
303
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 uint32_t newSafetystopDuration, newSafetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 evaluateNewString(editId, &newSafetystopDuration, &newSafetystopDepth, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 if(settingsGetPointer()->nonMetricalSystem != 0) // new hw 170718
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 newSafetystopDepth += 2; // f�r rundung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321 newSafetystopDepth = (newSafetystopDepth * 3) / 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 settingsGetPointer()->safetystopDuration = newSafetystopDuration;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 settingsGetPointer()->safetystopDepth = newSafetystopDepth;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328 tMenuEdit_newInput(editId, newSafetystopDuration, newSafetystopDepth, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 if(blockNumber == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 if(digitContentNew > '5')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 if(settingsGetPointer()->nonMetricalSystem == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 if(digitContentNew > '6')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 digitContentNew = '3';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 if(digitContent < 13 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 digitContentNew = 13 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 else if(digitContent < 16 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351 digitContentNew = 16 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 else if(digitContent < 20 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 digitContentNew = 20 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 digitContentNew = 10 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 if(blockNumber == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 digitContentNew = '5';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 if(settingsGetPointer()->nonMetricalSystem == 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 if(digitContentNew < '3')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 digitContentNew = '6';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 if(digitContent >= 20 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 digitContentNew = 16 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 else if(digitContent >= 16 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 digitContentNew = 13 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 else if(digitContent >= 13 + '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 digitContentNew = 10 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 digitContentNew = 20 + '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391
882
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
392 static uint8_t OnAction_SlowExitTime (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
393 {
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
394 uint8_t digitContentNew;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
395 uint32_t newExitTime;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
396
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
397 if(action == ACTION_BUTTON_ENTER)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
398 {
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
399 return digitContent;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
400 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
401 if(action == ACTION_BUTTON_ENTER_FINAL)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
402 {
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
403 evaluateNewString(editId, &newExitTime, 0, 0, 0);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
404
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
405 settingsGetPointer()->slowExitTime = newExitTime;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
406
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
407 tMenuEdit_newInput(editId, newExitTime, 0, 0, 0);
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
408 return UPDATE_AND_EXIT_TO_MENU;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
409 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
410 if(action == ACTION_BUTTON_NEXT)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
411 {
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
412 digitContentNew = digitContent + 1;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
413 if(blockNumber == 0)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
414 {
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
415 if(digitContentNew > '9')
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
416 digitContentNew = '0';
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
417 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
418
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
419 return digitContentNew;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
420 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
421 if(action == ACTION_BUTTON_BACK)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
422 {
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
423 digitContentNew = digitContent - 1;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
424 if(blockNumber == 0)
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
425 {
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
426 if(digitContentNew < '0')
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
427 digitContentNew = '9';
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
428 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
429
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
430 return digitContentNew;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
431 }
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
432 return EXIT_TO_MENU;
608d3e918146 Added slow exit timer function:
Ideenmodellierer
parents: 707
diff changeset
433 }
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 text[1] = TXT_Salinity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 write_label_fix( 30, 800, y_line, &FontT48, TXT_Salinity);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 write_label_var( 400, 800, y_line, &FontT48, "\016\016 %\017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 write_field_udigit(StMDECO6_SALINITY, 370, 800, y_line, &FontT48, "#", (uint32_t)settingsGetPointer()->salinity, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454 setEvent(StMDECO6_SALINITY, (uint32_t)OnAction_Salinity);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 uint32_t salinity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 evaluateNewString(editId, &salinity, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 if(salinity >= 4)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 salinity = 4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 pSettings->salinity = salinity;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 tMenuEdit_newInput(editId, salinity, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 if(digitContentNew > '4')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 digitContentNew = '4';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 uint8_t maxL_std, maxL_deco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 maxL_std = pSettings->ppO2_max_std - 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 maxL_deco = pSettings->ppO2_max_deco - 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 text[1] = TXT_ppO2Name;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 strcpy(text,"ppO2\016\016max\017");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 write_label_var( 20, 800, y_line, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 strcpy(text,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 " bar "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 " deco "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 " "
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 "\016\016"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 " bar"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 "\017"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 write_label_var( 460, 800, y_line, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 // write_field_udigit(StMDECO4_PPO2Max, 410, 800, y_line, &FontT48, "## ##", (uint32_t)maxL_std, (uint32_t)maxL_deco, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 write_field_udigit(StMDECO3_PPO2Max, 370, 800, y_line, &FontT48, "1.## 1.##", (uint32_t)maxL_std, (uint32_t)maxL_deco, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 setEvent(StMDECO3_PPO2Max, (uint32_t)OnAction_ppO2Max);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546 uint8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 uint32_t newPPO2LStd, newPPO2LDeco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 evaluateNewString(editId, &newPPO2LStd, &newPPO2LDeco, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 if(newPPO2LStd > 90)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 newPPO2LStd = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 if(newPPO2LDeco > 90)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 newPPO2LDeco = 90;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 pSettings->ppO2_max_std = 100 + newPPO2LStd;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 pSettings->ppO2_max_deco = 100 + newPPO2LDeco;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 tMenuEdit_newInput(editId, newPPO2LStd, newPPO2LDeco, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 if(digitContentNew > '9')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 digitContentNew = '9';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 uint8_t futureTTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 uint16_t y_line;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 char text[32];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 SSettings *pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 futureTTS = pSettings->future_TTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 y_line = ME_Y_LINE_BASE + (lineSelected * ME_Y_LINE_STEP);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 text[0] = '\001';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 text[1] = TXT_FutureTTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 text[2] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 write_topline(text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 strcpy(text,"\016\016");
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 text[2] = TXT_Minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 text[3] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 write_label_fix( 20, 800, y_line, &FontT48, TXT_FutureTTS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 write_label_var( 435, 800, y_line, &FontT48, text);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609 write_field_2digit(StMDECO5_FUTURE, 370, 500, y_line, &FontT48, "##", (uint32_t)futureTTS, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 write_buttonTextline(TXT2BYTE_ButtonMinus,TXT2BYTE_ButtonEnter,TXT2BYTE_ButtonPlus);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 setEvent(StMDECO5_FUTURE, (uint32_t)OnAction_FutureTTS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 startEdit();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
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
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 SSettings *pSettings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 int8_t digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 uint32_t newFutureTTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624 if(action == ACTION_BUTTON_ENTER)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 return digitContent;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 if(action == ACTION_BUTTON_ENTER_FINAL)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 evaluateNewString(editId, &newFutureTTS, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 if(newFutureTTS > 15)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 newFutureTTS = 15;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 pSettings = settingsGetPointer();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 pSettings->future_TTS = newFutureTTS;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 tMenuEdit_newInput(editId, newFutureTTS, 0, 0, 0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 return UPDATE_AND_EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 if(action == ACTION_BUTTON_NEXT)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 digitContentNew = digitContent + 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 if(digitContentNew > '0'+ 15)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 digitContentNew = '0';
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 if(action == ACTION_BUTTON_BACK)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 digitContentNew = digitContent - 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 if(digitContentNew < '0')
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 digitContentNew = '0' + 15;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 return digitContentNew;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655 return EXIT_TO_MENU;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 }