Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditSetpoint.c @ 646:0fc1b47d2482
Remove battery charge counter from information menu:
Due to long timeouts during charging (e.g. temperature break) multiple charge cycles could be counted without removment of the charger. To avoid confusions the visualization of this parameter has been removed.
author | Ideenmodellierer |
---|---|
date | Tue, 13 Apr 2021 19:21:14 +0200 |
parents | 4532953ac1a0 |
children | 5f0d3dce5ef4 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tMenuEditSetpoint.c | |
5 /// \brief | |
6 /// \author heinrichs weikamp gmbh | |
7 /// \date 19-Dec-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 "tMenuEditSetpoint.h" | |
31 | |
32 #include "check_warning.h" | |
33 #include "gfx_fonts.h" | |
34 #include "tMenuEdit.h" | |
35 #include "unit.h" | |
36 | |
37 /* Private types -------------------------------------------------------------*/ | |
38 typedef struct | |
39 { | |
40 uint8_t spID; | |
41 SSetpointLine * pSetpointLine; | |
42 } SEditSetpointPage; | |
43 | |
44 | |
45 /* Private variables ---------------------------------------------------------*/ | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
46 static SEditSetpointPage editSetpointPage; |
38 | 47 |
48 /* Private function prototypes -----------------------------------------------*/ | |
49 | |
50 /* Announced function prototypes -----------------------------------------------*/ | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
51 static uint8_t OnAction_SP_Setpoint (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:
213
diff
changeset
|
52 static uint8_t OnAction_SP_DM_Sensor1 (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:
213
diff
changeset
|
53 static uint8_t OnAction_SP_DM_Sensor2 (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:
213
diff
changeset
|
54 static uint8_t OnAction_SP_DM_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action); |
38 | 55 |
56 /* Exported functions --------------------------------------------------------*/ | |
57 | |
58 void openEdit_Setpoint(uint8_t line) | |
59 { | |
60 uint8_t useSensorSubMenu = 0; | |
61 | |
62 /* dive mode */ | |
63 if(actual_menu_content != MENU_SURFACE) | |
64 { | |
65 uint8_t setpointCbar, actualGasID; | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
38
diff
changeset
|
66 setpointCbar = 100; |
38 | 67 |
68 // actualGasID | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
69 if(stateUsedWrite->diveSettings.diveMode != DIVEMODE_CCR) |
38 | 70 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
71 actualGasID = stateUsedWrite->lifeData.lastDiluent_GasIdInSettings; |
38 | 72 if((actualGasID <= NUM_OFFSET_DILUENT) || (actualGasID > NUM_GASES + NUM_OFFSET_DILUENT)) |
73 actualGasID = NUM_OFFSET_DILUENT + 1; | |
74 } | |
75 else | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
76 actualGasID = stateUsedWrite->lifeData.actualGas.GasIdInSettings; |
38 | 77 |
78 // setpointCbar, CCR_Mode and sensor menu | |
79 if(line < 6) | |
80 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
81 setpointCbar = stateUsedWrite->diveSettings.setpoint[line].setpoint_cbar; |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
82 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint; |
38 | 83 |
84 // BetterSetpoint warning only once | |
85 if(actualBetterSetpointId() == line) | |
86 { | |
87 uint8_t depth; | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
88 depth = stateUsedWrite->diveSettings.setpoint[line].depth_meter; |
38 | 89 // BetterSetpoint warning only once -> clear active |
90 for(int i=0; i<=NUM_GASES; i++) | |
91 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
92 stateUsedWrite->diveSettings.setpoint[i].note.ub.first = 0; |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
93 if(stateUsedWrite->diveSettings.setpoint[i].depth_meter <= depth) |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
94 stateUsedWrite->diveSettings.setpoint[i].note.ub.active = 0; |
38 | 95 } |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
96 stateUsedWrite->diveSettings.setpoint[line].note.ub.first = 1; |
38 | 97 } |
98 } | |
99 else | |
100 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
101 if(stateUsedWrite->diveSettings.CCR_Mode != CCRMODE_Sensors) |
38 | 102 { |
103 /* setpoint_cbar will be written by updateSetpointStateUsed() in main.c loop */ | |
104 setpointCbar = 255; | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
105 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_Sensors; |
38 | 106 } |
107 else | |
108 { | |
109 useSensorSubMenu = 1; | |
110 } | |
111 } | |
112 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
113 setActualGas_DM(&stateUsedWrite->lifeData,actualGasID,setpointCbar); |
38 | 114 |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
115 if(stateUsedWrite->diveSettings.diveMode != DIVEMODE_CCR) |
38 | 116 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
117 stateUsedWrite->diveSettings.diveMode = DIVEMODE_CCR; |
38 | 118 unblock_diluent_page(); |
119 } | |
120 | |
121 clear_warning_fallback(); | |
122 | |
123 if(!useSensorSubMenu) | |
124 { | |
125 exitMenuEdit_to_Home(); | |
126 } | |
127 else // entire sub menu during dive to select sensors active | |
128 { | |
129 set_globalState_Menu_Line(line); | |
130 resetMenuEdit(CLUT_MenuPageGasSP); | |
131 | |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
132 char text[20]; |
38 | 133 uint8_t sensorActive[3]; |
134 | |
135 text[0] = '\001'; | |
136 text[1] = TXT_o2Sensors; | |
137 text[2] = 0; | |
138 write_topline(text); | |
139 | |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
140 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1) |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
141 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
142 snprintf (text,20,"Sensor 1"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
143 sensorActive[0] = 0; |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
144 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
145 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
146 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
147 snprintf (text,20,"Sensor 1 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[0] ); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
148 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
149 write_label_var( 96, 600, ME_Y_LINE1, &FontT48, text); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
150 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2) |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
151 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
152 snprintf (text,20,"Sensor 2"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
153 sensorActive[1] = 0; |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
154 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
155 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
156 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
157 snprintf (text,20,"Sensor 2 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[1] ); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
158 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
159 write_label_var( 96, 600, ME_Y_LINE2, &FontT48, text); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
160 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4) |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
161 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
162 snprintf (text,20,"Sensor 3"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
163 sensorActive[2] = 0; |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
164 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
165 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
166 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
167 snprintf (text,20,"Sensor 3 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[2] ); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
168 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
169 write_label_var( 96, 600, ME_Y_LINE3, &FontT48, text); |
38 | 170 |
171 sensorActive[0] = 1; | |
172 sensorActive[1] = 1; | |
173 sensorActive[2] = 1; | |
174 | |
175 write_field_on_off(StMSP_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); | |
176 write_field_on_off(StMSP_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); | |
177 write_field_on_off(StMSP_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", sensorActive[2]); | |
178 | |
179 setEvent(StMSP_Sensor1, (uint32_t)OnAction_SP_DM_Sensor1); | |
180 setEvent(StMSP_Sensor2, (uint32_t)OnAction_SP_DM_Sensor2); | |
181 setEvent(StMSP_Sensor3, (uint32_t)OnAction_SP_DM_Sensor3); | |
182 } | |
183 return; | |
184 } | |
185 else | |
186 { | |
187 /* surface mode */ | |
188 uint8_t spId, setpoint_cbar, sp_high, depthDeco, first; | |
189 // uint8_t active, | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
190 char text[70]; |
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
191 uint8_t textPointer; |
38 | 192 uint16_t y_line; |
193 | |
194 set_globalState_Menu_Line(line); | |
195 | |
196 resetMenuEdit(CLUT_MenuPageGasSP); | |
197 | |
198 spId = line; | |
199 editSetpointPage.spID = spId; | |
200 SSettings *data = settingsGetPointer(); | |
201 editSetpointPage.pSetpointLine = data->setpoint; | |
202 | |
203 setpoint_cbar = editSetpointPage.pSetpointLine[spId].setpoint_cbar; | |
204 depthDeco = editSetpointPage.pSetpointLine[spId].depth_meter; | |
205 //active = editSetpointPage.pSetpointLine[spId].note.ub.active; | |
206 first = editSetpointPage.pSetpointLine[spId].note.ub.first; | |
207 | |
208 sp_high = setpoint_cbar / 100; | |
209 | |
210 strcpy(text, "\001" "Setpoint #0 X"); | |
211 text[11] += spId; | |
212 text[13] = TXT_Setpoint_Edit; | |
213 write_topline(text); | |
214 | |
215 | |
216 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); | |
217 | |
218 textPointer = 0; | |
219 text[textPointer++] = 'S'; | |
220 text[textPointer++] = 'P'; | |
221 text[textPointer++] = '0' + spId; | |
222 text[textPointer++] = ' '; | |
223 text[textPointer++] = ' '; | |
224 | |
225 if(first == 0) | |
226 strcpy(&text[textPointer++],"\177"); | |
227 | |
228 textPointer += snprintf(&text[textPointer], 60,\ | |
229 "* " | |
230 " " | |
231 "\016\016" | |
232 " bar" | |
233 "\017" | |
234 "\034" | |
235 " " | |
236 "\016\016" | |
237 " " | |
238 "\017" | |
239 " " | |
240 "\016\016" | |
241 "meter" | |
242 "\017" | |
243 "\035" | |
244 "\n\r" | |
245 ); | |
246 write_label_var( 20, 800, y_line, &FontT48, text); | |
247 | |
248 write_field_udigit(StMSP_ppo2_setting, 160, 800, y_line, &FontT48, "#.## ###", (uint32_t)sp_high, (uint32_t)(setpoint_cbar - (100 * sp_high)), depthDeco, 0); | |
249 setEvent(StMSP_ppo2_setting, (uint32_t)OnAction_SP_Setpoint); | |
250 startEdit(); | |
251 } | |
252 } | |
253 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
254 static uint8_t OnAction_SP_Setpoint(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 255 { |
256 int8_t digitContentNew; | |
257 uint32_t new_integer_part, new_fractional_part, new_cbar, newDepth; | |
258 | |
259 if(action == ACTION_BUTTON_ENTER) | |
260 return digitContent; | |
261 | |
262 if(action == ACTION_BUTTON_ENTER_FINAL) | |
263 { | |
264 evaluateNewString(editId, &new_integer_part, &new_fractional_part, &newDepth, 0); | |
265 | |
266 new_cbar = (new_integer_part * 100) + new_fractional_part; | |
267 | |
268 if(new_cbar < 50) | |
269 new_cbar = 50; | |
270 | |
271 if(new_cbar > 160) | |
272 new_cbar = 160; | |
273 | |
274 new_integer_part = new_cbar / 100; | |
275 new_fractional_part = new_cbar - (new_integer_part * 100); | |
276 | |
277 editSetpointPage.pSetpointLine[editSetpointPage.spID].setpoint_cbar = new_cbar; | |
278 | |
279 if(newDepth > 255) | |
280 newDepth = 255; | |
281 | |
282 editSetpointPage.pSetpointLine[editSetpointPage.spID].depth_meter = newDepth; | |
283 | |
284 return UPDATE_AND_EXIT_TO_MENU; | |
285 } | |
286 | |
287 if(action == ACTION_BUTTON_NEXT) | |
288 { | |
289 digitContentNew = digitContent + 1; | |
290 if((blockNumber == 0) && (digitContentNew > '1')) | |
291 digitContentNew = '0'; | |
292 if(digitContentNew > '9') | |
293 digitContentNew = '0'; | |
294 return digitContentNew; | |
295 } | |
296 | |
297 if(action == ACTION_BUTTON_BACK) | |
298 { | |
299 digitContentNew = digitContent - 1; | |
213
d539ed9aa5b8
Bugfix, trivial: do not visit 9 on first digit for setpoint
Jan Mulder <jlmulder@xs4all.nl>
parents:
166
diff
changeset
|
300 if((blockNumber == 0) && (digitContentNew < '0')) |
38 | 301 digitContentNew = '1'; |
302 if(digitContentNew < '0') | |
303 digitContentNew = '9'; | |
304 return digitContentNew; | |
305 } | |
306 | |
307 return EXIT_TO_MENU; | |
308 } | |
309 | |
310 void openEdit_DiveSelectBetterSetpoint(void) | |
311 { | |
312 uint8_t spId; | |
313 uint8_t depth; | |
314 | |
315 spId = actualBetterSetpointId(); | |
316 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
317 depth = stateUsedWrite->diveSettings.setpoint[spId].depth_meter; |
38 | 318 |
319 // BetterSetpoint warning only once -> clear active | |
320 for(int i=0; i<=NUM_GASES; i++) | |
321 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
322 stateUsedWrite->diveSettings.setpoint[i].note.ub.first = 0; |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
323 if(stateUsedWrite->diveSettings.setpoint[i].depth_meter <= depth) |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
324 stateUsedWrite->diveSettings.setpoint[i].note.ub.active = 0; |
38 | 325 } |
326 | |
327 // new setpoint | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
328 stateUsedWrite->diveSettings.setpoint[spId].note.ub.first = 1; |
38 | 329 |
330 // change in lifeData | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
331 setActualGas_DM(&stateUsedWrite->lifeData, stateUsedWrite->lifeData.actualGas.GasIdInSettings, stateUsedWrite->diveSettings.setpoint[spId].setpoint_cbar); |
38 | 332 } |
333 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
334 static uint8_t OnAction_SP_DM_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 335 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
336 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1) |
38 | 337 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
338 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+2; |
38 | 339 tMenuEdit_set_on_off(editId, 1); |
340 } | |
341 else | |
342 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
343 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 1; |
38 | 344 tMenuEdit_set_on_off(editId, 0); |
345 } | |
346 | |
347 return UNSPECIFIC_RETURN; | |
348 } | |
349 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
350 static uint8_t OnAction_SP_DM_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 351 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
352 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2) |
38 | 353 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
354 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+1; |
38 | 355 tMenuEdit_set_on_off(editId, 1); |
356 } | |
357 else | |
358 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
359 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 2; |
38 | 360 tMenuEdit_set_on_off(editId, 0); |
361 } | |
362 | |
363 return UNSPECIFIC_RETURN; | |
364 } | |
365 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
366 static uint8_t OnAction_SP_DM_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 367 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
368 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4) |
38 | 369 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
370 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 2+1; |
38 | 371 tMenuEdit_set_on_off(editId, 1); |
372 } | |
373 else | |
374 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
375 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 4; |
38 | 376 tMenuEdit_set_on_off(editId, 0); |
377 } | |
378 return UNSPECIFIC_RETURN; | |
379 } |