Mercurial > public > ostc4
annotate Discovery/Src/tMenuEditSetpoint.c @ 659:0a915a789873
Update build file for testing
author | heinrichs weikamp |
---|---|
date | Wed, 28 Apr 2021 09:47:25 +0200 |
parents | f6212495f34f |
children | 1b995079c045 |
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 | |
650 | 194 if(line < 6) |
195 { | |
196 set_globalState_Menu_Line(line); | |
38 | 197 |
650 | 198 resetMenuEdit(CLUT_MenuPageGasSP); |
199 | |
200 spId = line; | |
201 editSetpointPage.spID = spId; | |
202 SSettings *data = settingsGetPointer(); | |
203 editSetpointPage.pSetpointLine = data->setpoint; | |
38 | 204 |
650 | 205 setpoint_cbar = editSetpointPage.pSetpointLine[spId].setpoint_cbar; |
206 depthDeco = editSetpointPage.pSetpointLine[spId].depth_meter; | |
207 //active = editSetpointPage.pSetpointLine[spId].note.ub.active; | |
208 first = editSetpointPage.pSetpointLine[spId].note.ub.first; | |
38 | 209 |
650 | 210 sp_high = setpoint_cbar / 100; |
38 | 211 |
650 | 212 strcpy(text, "\001" "Setpoint #0 X"); |
213 text[11] += spId; | |
214 text[13] = TXT_Setpoint_Edit; | |
215 write_topline(text); | |
38 | 216 |
217 | |
650 | 218 y_line = ME_Y_LINE_BASE + (line * ME_Y_LINE_STEP); |
38 | 219 |
650 | 220 textPointer = 0; |
221 text[textPointer++] = 'S'; | |
222 text[textPointer++] = 'P'; | |
223 text[textPointer++] = '0' + spId; | |
224 text[textPointer++] = ' '; | |
225 text[textPointer++] = ' '; | |
38 | 226 |
650 | 227 if(first == 0) |
228 strcpy(&text[textPointer++],"\177"); | |
38 | 229 |
650 | 230 textPointer += snprintf(&text[textPointer], 60,\ |
231 "* " | |
232 " " | |
233 "\016\016" | |
234 " bar" | |
235 "\017" | |
236 "\034" | |
237 " " | |
238 "\016\016" | |
239 " " | |
240 "\017" | |
241 " " | |
242 "\016\016" | |
243 "meter" | |
244 "\017" | |
245 "\035" | |
246 "\n\r" | |
247 ); | |
248 write_label_var( 20, 800, y_line, &FontT48, text); | |
38 | 249 |
650 | 250 write_field_udigit(StMSP_ppo2_setting, 160, 800, y_line, &FontT48, "#.## ###", (uint32_t)sp_high, (uint32_t)(setpoint_cbar - (100 * sp_high)), depthDeco, 0); |
251 setEvent(StMSP_ppo2_setting, (uint32_t)OnAction_SP_Setpoint); | |
252 startEdit(); | |
253 } | |
254 else | |
255 { | |
256 SSettings *pSettings = settingsGetPointer(); | |
257 | |
258 if(pSettings->autoSetpoint == 0) | |
259 { | |
260 pSettings->autoSetpoint = 1; | |
261 } | |
262 else | |
263 { | |
264 pSettings->autoSetpoint = 0; | |
265 } | |
266 exitMenuEdit_to_Menu_with_Menu_Update_do_not_write_settings_for_this_only(); | |
267 } | |
38 | 268 } |
269 } | |
270 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
271 static uint8_t OnAction_SP_Setpoint(uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 272 { |
273 int8_t digitContentNew; | |
274 uint32_t new_integer_part, new_fractional_part, new_cbar, newDepth; | |
275 | |
276 if(action == ACTION_BUTTON_ENTER) | |
277 return digitContent; | |
278 | |
279 if(action == ACTION_BUTTON_ENTER_FINAL) | |
280 { | |
281 evaluateNewString(editId, &new_integer_part, &new_fractional_part, &newDepth, 0); | |
282 | |
283 new_cbar = (new_integer_part * 100) + new_fractional_part; | |
284 | |
652 | 285 if(new_cbar < MIN_PPO2_SP_CBAR) |
286 new_cbar = MIN_PPO2_SP_CBAR; | |
38 | 287 |
288 if(new_cbar > 160) | |
289 new_cbar = 160; | |
290 | |
291 new_integer_part = new_cbar / 100; | |
292 new_fractional_part = new_cbar - (new_integer_part * 100); | |
293 | |
294 editSetpointPage.pSetpointLine[editSetpointPage.spID].setpoint_cbar = new_cbar; | |
295 | |
296 if(newDepth > 255) | |
297 newDepth = 255; | |
298 | |
299 editSetpointPage.pSetpointLine[editSetpointPage.spID].depth_meter = newDepth; | |
300 | |
301 return UPDATE_AND_EXIT_TO_MENU; | |
302 } | |
303 | |
304 if(action == ACTION_BUTTON_NEXT) | |
305 { | |
306 digitContentNew = digitContent + 1; | |
307 if((blockNumber == 0) && (digitContentNew > '1')) | |
308 digitContentNew = '0'; | |
309 if(digitContentNew > '9') | |
310 digitContentNew = '0'; | |
311 return digitContentNew; | |
312 } | |
313 | |
314 if(action == ACTION_BUTTON_BACK) | |
315 { | |
316 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
|
317 if((blockNumber == 0) && (digitContentNew < '0')) |
38 | 318 digitContentNew = '1'; |
319 if(digitContentNew < '0') | |
320 digitContentNew = '9'; | |
321 return digitContentNew; | |
322 } | |
323 | |
324 return EXIT_TO_MENU; | |
325 } | |
326 | |
327 void openEdit_DiveSelectBetterSetpoint(void) | |
328 { | |
329 uint8_t spId; | |
330 uint8_t depth; | |
331 | |
332 spId = actualBetterSetpointId(); | |
333 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
334 depth = stateUsedWrite->diveSettings.setpoint[spId].depth_meter; |
38 | 335 |
336 // BetterSetpoint warning only once -> clear active | |
337 for(int i=0; i<=NUM_GASES; i++) | |
338 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
339 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
|
340 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
|
341 stateUsedWrite->diveSettings.setpoint[i].note.ub.active = 0; |
38 | 342 } |
343 | |
344 // new setpoint | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
345 stateUsedWrite->diveSettings.setpoint[spId].note.ub.first = 1; |
38 | 346 |
347 // change in lifeData | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
348 setActualGas_DM(&stateUsedWrite->lifeData, stateUsedWrite->lifeData.actualGas.GasIdInSettings, stateUsedWrite->diveSettings.setpoint[spId].setpoint_cbar); |
38 | 349 } |
350 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
351 static uint8_t OnAction_SP_DM_Sensor1 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 352 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
353 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 1) |
38 | 354 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
355 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+2; |
38 | 356 tMenuEdit_set_on_off(editId, 1); |
357 } | |
358 else | |
359 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
360 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 1; |
38 | 361 tMenuEdit_set_on_off(editId, 0); |
362 } | |
363 | |
364 return UNSPECIFIC_RETURN; | |
365 } | |
366 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
367 static uint8_t OnAction_SP_DM_Sensor2 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 368 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
369 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 2) |
38 | 370 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
371 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 4+1; |
38 | 372 tMenuEdit_set_on_off(editId, 1); |
373 } | |
374 else | |
375 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
376 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 2; |
38 | 377 tMenuEdit_set_on_off(editId, 0); |
378 } | |
379 | |
380 return UNSPECIFIC_RETURN; | |
381 } | |
382 | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
383 static uint8_t OnAction_SP_DM_Sensor3 (uint32_t editId, uint8_t blockNumber, uint8_t digitNumber, uint8_t digitContent, uint8_t action) |
38 | 384 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
385 if(stateUsedWrite->diveSettings.ppo2sensors_deactivated & 4) |
38 | 386 { |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
387 stateUsedWrite->diveSettings.ppo2sensors_deactivated &= 2+1; |
38 | 388 tMenuEdit_set_on_off(editId, 1); |
389 } | |
390 else | |
391 { | |
288
ba229a012ac7
cleanup: no useless checks for simulator state
Jan Mulder <jlmulder@xs4all.nl>
parents:
213
diff
changeset
|
392 stateUsedWrite->diveSettings.ppo2sensors_deactivated |= 4; |
38 | 393 tMenuEdit_set_on_off(editId, 0); |
394 } | |
395 return UNSPECIFIC_RETURN; | |
396 } |