Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditSetpoint.c @ 747:df0d43da1614
Added pressure compensation to CO2 detection:
A pressure compensation is needed if the ExplorIR shall be used under extended pressure conditions. The procedure recommended by the application note has been integrated. To keep things simple the focus of the CO2 measurement is not the precision, as it is needed for the decompression calculation, but the indication of a critical increase of CO2 in the breathing loop. That's why only a lookup table with 1000ppm steps has been implemented instead of calculating the polynom for every measurement.
author | Ideenmodellierer |
---|---|
date | Sun, 05 Mar 2023 22:06:47 +0100 |
parents | 1b995079c045 |
children | 2c243233c999 |
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; | |
662 | 61 char text[20]; |
62 uint8_t sensorActive[3]; | |
38 | 63 |
64 /* dive mode */ | |
65 if(actual_menu_content != MENU_SURFACE) | |
66 { | |
67 uint8_t setpointCbar, actualGasID; | |
130
b7689d9e888a
Minor changes to improved code quality and to eliminate warnings
Ideenmodellierer
parents:
38
diff
changeset
|
68 setpointCbar = 100; |
38 | 69 |
70 // actualGasID | |
662 | 71 if(!isLoopMode(stateUsedWrite->diveSettings.diveMode)) |
38 | 72 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
73 actualGasID = stateUsedWrite->lifeData.lastDiluent_GasIdInSettings; |
38 | 74 if((actualGasID <= NUM_OFFSET_DILUENT) || (actualGasID > NUM_GASES + NUM_OFFSET_DILUENT)) |
75 actualGasID = NUM_OFFSET_DILUENT + 1; | |
76 } | |
77 else | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
78 actualGasID = stateUsedWrite->lifeData.actualGas.GasIdInSettings; |
38 | 79 |
80 // setpointCbar, CCR_Mode and sensor menu | |
662 | 81 if((line < 6) && (stateUsedWrite->diveSettings.diveMode != DIVEMODE_PSCR)) /* setpoints inactive in PSCR mode */ |
38 | 82 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
83 setpointCbar = stateUsedWrite->diveSettings.setpoint[line].setpoint_cbar; |
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
84 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint; |
38 | 85 |
86 // BetterSetpoint warning only once | |
87 if(actualBetterSetpointId() == line) | |
88 { | |
89 uint8_t depth; | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
90 depth = stateUsedWrite->diveSettings.setpoint[line].depth_meter; |
38 | 91 // BetterSetpoint warning only once -> clear active |
92 for(int i=0; i<=NUM_GASES; i++) | |
93 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
94 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
|
95 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
|
96 stateUsedWrite->diveSettings.setpoint[i].note.ub.active = 0; |
38 | 97 } |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
98 stateUsedWrite->diveSettings.setpoint[line].note.ub.first = 1; |
38 | 99 } |
100 } | |
662 | 101 else /* menu item not pointing to setpoint selection => use sensor or ppo2 simulation */ |
38 | 102 { |
662 | 103 if((stateUsedWrite->diveSettings.diveMode == DIVEMODE_PSCR) && (line == 2)) |
104 { | |
105 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_Simulation; | |
106 } | |
107 else /* => use sensor */ | |
108 { | |
109 if(stateUsedWrite->diveSettings.CCR_Mode != CCRMODE_Sensors) | |
110 { | |
111 /* setpoint_cbar will be written by updateSetpointStateUsed() in main.c loop */ | |
112 setpointCbar = 255; | |
113 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_Sensors; | |
114 } | |
115 else | |
116 { | |
117 useSensorSubMenu = 1; | |
118 } | |
119 } | |
38 | 120 } |
121 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
122 setActualGas_DM(&stateUsedWrite->lifeData,actualGasID,setpointCbar); |
38 | 123 |
662 | 124 if(!isLoopMode(stateUsedWrite->diveSettings.diveMode)) |
38 | 125 { |
662 | 126 stateUsedWrite->diveSettings.diveMode = settingsGetPointer()->dive_mode; |
38 | 127 unblock_diluent_page(); |
128 } | |
129 | |
130 clear_warning_fallback(); | |
131 | |
132 if(!useSensorSubMenu) | |
133 { | |
134 exitMenuEdit_to_Home(); | |
135 } | |
136 else // entire sub menu during dive to select sensors active | |
137 { | |
138 set_globalState_Menu_Line(line); | |
139 resetMenuEdit(CLUT_MenuPageGasSP); | |
140 | |
141 text[0] = '\001'; | |
142 text[1] = TXT_o2Sensors; | |
143 text[2] = 0; | |
144 write_topline(text); | |
145 | |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
146 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1) |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
147 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
148 snprintf (text,20,"Sensor 1"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
149 sensorActive[0] = 0; |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
150 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
151 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
152 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
153 snprintf (text,20,"Sensor 1 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[0] ); |
662 | 154 sensorActive[0] = 1; |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
155 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
156 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
|
157 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2) |
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 snprintf (text,20,"Sensor 2"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
160 sensorActive[1] = 0; |
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 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
163 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
164 snprintf (text,20,"Sensor 2 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[1] ); |
662 | 165 sensorActive[1] = 1; |
638
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 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
|
168 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4) |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
169 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
170 snprintf (text,20,"Sensor 3"); |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
171 sensorActive[2] = 0; |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
172 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
173 else |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
174 { |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
175 snprintf (text,20,"Sensor 3 (%01.2f)", stateUsed->lifeData.ppO2Sensor_bar[2] ); |
662 | 176 sensorActive[2] = 1; |
638
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
177 } |
4532953ac1a0
Added last measured PPO2 value to sensor selection dialog:
Ideenmodellierer
parents:
288
diff
changeset
|
178 write_label_var( 96, 600, ME_Y_LINE3, &FontT48, text); |
38 | 179 |
180 write_field_on_off(StMSP_Sensor1, 30, 95, ME_Y_LINE1, &FontT48, "", sensorActive[0]); | |
181 write_field_on_off(StMSP_Sensor2, 30, 95, ME_Y_LINE2, &FontT48, "", sensorActive[1]); | |
182 write_field_on_off(StMSP_Sensor3, 30, 95, ME_Y_LINE3, &FontT48, "", sensorActive[2]); | |
183 | |
184 setEvent(StMSP_Sensor1, (uint32_t)OnAction_SP_DM_Sensor1); | |
185 setEvent(StMSP_Sensor2, (uint32_t)OnAction_SP_DM_Sensor2); | |
186 setEvent(StMSP_Sensor3, (uint32_t)OnAction_SP_DM_Sensor3); | |
187 } | |
188 return; | |
189 } | |
190 else | |
191 { | |
192 /* surface mode */ | |
193 uint8_t spId, setpoint_cbar, sp_high, depthDeco, first; | |
194 // uint8_t active, | |
166
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
195 char text[70]; |
255eedad4155
cleanup: get rid of some compile warnings
Jan Mulder <jlmulder@xs4all.nl>
parents:
130
diff
changeset
|
196 uint8_t textPointer; |
38 | 197 uint16_t y_line; |
198 | |
650 | 199 if(line < 6) |
200 { | |
201 set_globalState_Menu_Line(line); | |
38 | 202 |
650 | 203 resetMenuEdit(CLUT_MenuPageGasSP); |
204 | |
205 spId = line; | |
206 editSetpointPage.spID = spId; | |
207 SSettings *data = settingsGetPointer(); | |
208 editSetpointPage.pSetpointLine = data->setpoint; | |
38 | 209 |
650 | 210 setpoint_cbar = editSetpointPage.pSetpointLine[spId].setpoint_cbar; |
211 depthDeco = editSetpointPage.pSetpointLine[spId].depth_meter; | |
212 //active = editSetpointPage.pSetpointLine[spId].note.ub.active; | |
213 first = editSetpointPage.pSetpointLine[spId].note.ub.first; | |
38 | 214 |
650 | 215 sp_high = setpoint_cbar / 100; |
38 | 216 |
650 | 217 strcpy(text, "\001" "Setpoint #0 X"); |
218 text[11] += spId; | |
219 text[13] = TXT_Setpoint_Edit; | |
220 write_topline(text); | |
38 | 221 |
222 | |
650 | 223 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); |
38 | 224 |
650 | 225 textPointer = 0; |
226 text[textPointer++] = 'S'; | |
227 text[textPointer++] = 'P'; | |
228 text[textPointer++] = '0' + spId; | |
229 text[textPointer++] = ' '; | |
230 text[textPointer++] = ' '; | |
38 | 231 |
650 | 232 if(first == 0) |
233 strcpy(&text[textPointer++],"\177"); | |
38 | 234 |
650 | 235 textPointer += snprintf(&text[textPointer], 60,\ |
236 "* " | |
237 " " | |
238 "\016\016" | |
239 " bar" | |
240 "\017" | |
241 "\034" | |
242 " " | |
243 "\016\016" | |
244 " " | |
245 "\017" | |
246 " " | |
247 "\016\016" | |
248 "meter" | |
249 "\017" | |
250 "\035" | |
251 "\n\r" | |
252 ); | |
253 write_label_var( 20, 800, y_line, &FontT48, text); | |
38 | 254 |
650 | 255 write_field_udigit(StMSP_ppo2_setting, 160, 800, y_line, &FontT48, "#.## ###", (uint32_t)sp_high, (uint32_t)(setpoint_cbar - (100 * sp_high)), depthDeco, 0); |
256 setEvent(StMSP_ppo2_setting, (uint32_t)OnAction_SP_Setpoint); | |
257 startEdit(); | |
258 } | |
259 else | |
260 { | |
261 SSettings *pSettings = settingsGetPointer(); | |
262 | |
263 if(pSettings->autoSetpoint == 0) | |
264 { | |
265 pSettings->autoSetpoint = 1; | |
266 } | |
267 else | |
268 { | |
269 pSettings->autoSetpoint = 0; | |
270 } | |
271 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); | |
272 } | |
38 | 273 } |
274 } | |
275 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
276 static uint8_t OnAction_SP_Setpoint(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 277 { |
278 int8_t digitContentNew; | |
279 uint32_t new_integer_part, new_fractional_part, new_cbar, newDepth; | |
280 | |
281 if(action == ACTION_BUTTON_ENTER) | |
282 return digitContent; | |
283 | |
284 if(action == ACTION_BUTTON_ENTER_FINAL) | |
285 { | |
286 evaluateNewString(editId, &new_integer_part, &new_fractional_part, &newDepth, 0); | |
287 | |
288 new_cbar = (new_integer_part * 100) + new_fractional_part; | |
289 | |
652 | 290 if(new_cbar < MIN_PPO2_SP_CBAR) |
291 new_cbar = MIN_PPO2_SP_CBAR; | |
38 | 292 |
293 if(new_cbar > 160) | |
294 new_cbar = 160; | |
295 | |
296 new_integer_part = new_cbar / 100; | |
297 new_fractional_part = new_cbar - (new_integer_part * 100); | |
298 | |
299 editSetpointPage.pSetpointLine[editSetpointPage.spID].setpoint_cbar = new_cbar; | |
300 | |
301 if(newDepth > 255) | |
302 newDepth = 255; | |
303 | |
304 editSetpointPage.pSetpointLine[editSetpointPage.spID].depth_meter = newDepth; | |
305 | |
306 return UPDATE_AND_EXIT_TO_MENU; | |
307 } | |
308 | |
309 if(action == ACTION_BUTTON_NEXT) | |
310 { | |
311 digitContentNew = digitContent + 1; | |
312 if((blockNumber == 0) && (digitContentNew > '1')) | |
313 digitContentNew = '0'; | |
314 if(digitContentNew > '9') | |
315 digitContentNew = '0'; | |
316 return digitContentNew; | |
317 } | |
318 | |
319 if(action == ACTION_BUTTON_BACK) | |
320 { | |
321 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
|
322 if((blockNumber == 0) && (digitContentNew < '0')) |
38 | 323 digitContentNew = '1'; |
324 if(digitContentNew < '0') | |
325 digitContentNew = '9'; | |
326 return digitContentNew; | |
327 } | |
328 | |
329 return EXIT_TO_MENU; | |
330 } | |
331 | |
332 void openEdit_DiveSelectBetterSetpoint(void) | |
333 { | |
334 uint8_t spId; | |
335 uint8_t depth; | |
336 | |
662 | 337 if(stateUsedWrite->diveSettings.diveMode != DIVEMODE_PSCR) /* no setpoints in PSCR mode */ |
38 | 338 { |
662 | 339 spId = actualBetterSetpointId(); |
340 | |
341 depth = stateUsedWrite->diveSettings.setpoint[spId].depth_meter; | |
38 | 342 |
662 | 343 // BetterSetpoint warning only once -> clear active |
344 for(int i=0; i<=NUM_GASES; i++) | |
345 { | |
346 stateUsedWrite->diveSettings.setpoint[i].note.ub.first = 0; | |
347 if(stateUsedWrite->diveSettings.setpoint[i].depth_meter <= depth) | |
348 stateUsedWrite->diveSettings.setpoint[i].note.ub.active = 0; | |
349 } | |
38 | 350 |
662 | 351 // new setpoint |
352 stateUsedWrite->diveSettings.setpoint[spId].note.ub.first = 1; | |
353 | |
354 // change in lifeData | |
355 setActualGas_DM(&stateUsedWrite->lifeData, stateUsedWrite->lifeData.actualGas.GasIdInSettings, stateUsedWrite->diveSettings.setpoint[spId].setpoint_cbar); | |
356 } | |
38 | 357 } |
358 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
359 static uint8_t OnAction_SP_DM_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 360 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
361 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1) |
38 | 362 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
363 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+2; |
38 | 364 tMenuEdit_set_on_off(editId, 1); |
365 } | |
366 else | |
367 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
368 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 1; |
38 | 369 tMenuEdit_set_on_off(editId, 0); |
370 } | |
371 | |
372 return UNSPECIFIC_RETURN; | |
373 } | |
374 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
375 static uint8_t OnAction_SP_DM_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 376 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
377 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2) |
38 | 378 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
379 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+1; |
38 | 380 tMenuEdit_set_on_off(editId, 1); |
381 } | |
382 else | |
383 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
384 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 2; |
38 | 385 tMenuEdit_set_on_off(editId, 0); |
386 } | |
387 | |
388 return UNSPECIFIC_RETURN; | |
389 } | |
390 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
391 static uint8_t OnAction_SP_DM_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 392 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
393 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4) |
38 | 394 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
395 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 2+1; |
38 | 396 tMenuEdit_set_on_off(editId, 1); |
397 } | |
398 else | |
399 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
400 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 4; |
38 | 401 tMenuEdit_set_on_off(editId, 0); |
402 } | |
403 return UNSPECIFIC_RETURN; | |
404 } |