Mercurial > public > ostc4
annotate Discovery/Src/tCCR.c @ 325:8e62f4701676 fix-batt-1
bugfix: implement battery at end in dive header
For some reason, the byte 50/51 data in the dive header was not
populated at the end of dive. These bytes represent the battery
voltage (in mV) at end in dive. Simply implement it in this commit.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Thu, 20 Jun 2019 14:24:57 +0200 |
parents | 31e471d60797 |
children | f1257a32f2d4 |
rev | line source |
---|---|
38 | 1 /////////////////////////////////////////////////////////////////////////////// |
2 /// -*- coding: UTF-8 -*- | |
3 /// | |
4 /// \file Discovery/Src/tCCR.c | |
5 /// \brief HUD data via optical port | |
6 /// \author Heinrichs Weikamp gmbh | |
7 /// \date 18-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 <string.h> | |
31 #include "tCCR.h" | |
32 #include "ostc.h" | |
33 #include "data_central.h" | |
34 #include "data_exchange.h" | |
35 #include "check_warning.h" | |
36 | |
37 /* Private types -------------------------------------------------------------*/ | |
38 typedef struct | |
39 { | |
40 uint8_t hud_firmwareVersion; | |
41 bit8_Type status_byte; | |
42 uint16_t sensor_voltage_100uV[3]; | |
43 uint8_t sensor_ppo2_cbar[3]; | |
44 uint8_t temp1; | |
45 uint16_t battery_voltage_mV; | |
46 uint16_t checksum; | |
47 } SIrLink; | |
48 | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
49 #define HUD_BABBLING_IDIOT (30u) /* 30 Bytes received without break */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
50 #define HUD_RX_FRAME_LENGTH (15u) /* Length of a HUD data frame */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
51 #define HUD_RX_FRAME_BREAK_MS (100u) /* Time used to detect a gap between two byte receptions => frame start */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
52 #define HUD_RX_START_DELAY_MS (500u) /* Delay for start of RX function to avoid start of reception while a transmission is ongoing. */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
53 /* Based on an assumed cycle time by the sensor of 1 second. Started at time of last RX */ |
38 | 54 |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
55 /* Private variables ---------------------------------------------------------*/ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
56 static SIrLink receiveHUD[2]; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
57 static uint8_t boolHUDdata = 0; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
58 static uint8_t data_old__lost_connection_to_HUD = 1; |
38 | 59 |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
60 static uint8_t receiveHUDraw[16]; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
61 |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
62 static uint8_t StartListeningToUART_HUD = 0; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
63 static uint16_t HUDTimeoutCount = 0; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
64 |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
65 static __IO ITStatus UartReadyHUD = RESET; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
66 static uint32_t LastReceivedTick_HUD = 0; |
38 | 67 |
68 /* Private variables with external access via get_xxx() function -------------*/ | |
69 | |
70 /* Private function prototypes -----------------------------------------------*/ | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
71 static void tCCR_fallbackToFixedSetpoint(void); |
38 | 72 |
73 #ifndef USART_IR_HUD | |
74 | |
75 void tCCR_init(void) | |
76 { | |
77 } | |
78 void tCCR_control(void) | |
79 { | |
80 } | |
81 void tCCR_test(void) | |
82 { | |
83 } | |
84 void tCCR_restart(void) | |
85 { | |
86 } | |
87 float get_ppO2Sensor_bar(uint8_t sensor_id) | |
88 { | |
89 } | |
90 float get_sensorVoltage_mV(uint8_t sensor_id) | |
91 { | |
92 } | |
93 float get_HUD_battery_voltage_V(void) | |
94 { | |
95 } | |
96 void tCCR_tick(void) | |
97 { | |
98 } | |
99 | |
100 #else | |
101 /* Exported functions --------------------------------------------------------*/ | |
102 | |
103 float get_ppO2Sensor_bar(uint8_t sensor_id) | |
104 { | |
105 if((sensor_id > 2) || data_old__lost_connection_to_HUD) | |
106 return 0; | |
107 | |
108 return (float)(receiveHUD[boolHUDdata].sensor_ppo2_cbar[sensor_id]) / 100.0f; | |
109 } | |
110 | |
111 float get_sensorVoltage_mV(uint8_t sensor_id) | |
112 { | |
113 if((sensor_id > 2) || data_old__lost_connection_to_HUD) | |
114 return 0; | |
115 | |
116 return (float)(receiveHUD[boolHUDdata].sensor_voltage_100uV[sensor_id]) / 10.0f; | |
117 } | |
118 | |
119 float get_HUD_battery_voltage_V(void) | |
120 { | |
121 if(data_old__lost_connection_to_HUD) | |
122 return 0; | |
123 | |
124 return (float)(receiveHUD[boolHUDdata].battery_voltage_mV) / 1000.0f; | |
125 } | |
126 | |
127 | |
128 void test_HUD_sensor_values_outOfBounds(int8_t * outOfBouds1, int8_t * outOfBouds2, int8_t * outOfBouds3) | |
129 { | |
130 uint8_t sensorNotActiveBinary; | |
131 uint8_t sensorActive[3]; | |
132 | |
133 // test1: user deactivation | |
134 sensorNotActiveBinary = stateUsed->diveSettings.ppo2sensors_deactivated; | |
135 | |
136 for(int i=0;i<3;i++) | |
137 sensorActive[i] = 1; | |
138 | |
139 if(sensorNotActiveBinary) | |
140 { | |
141 if(sensorNotActiveBinary & 1) | |
142 sensorActive[0] = 0; | |
143 | |
144 if(sensorNotActiveBinary & 2) | |
145 sensorActive[1] = 0; | |
146 | |
147 if(sensorNotActiveBinary & 4) | |
148 sensorActive[2] = 0; | |
149 } | |
150 | |
151 // test2: mV of remaining sensors | |
152 for(int i=0;i<3;i++) | |
153 { | |
154 if(sensorActive[i]) | |
155 { | |
156 if( (receiveHUD[boolHUDdata].sensor_voltage_100uV[i] < 80) || | |
157 (receiveHUD[boolHUDdata].sensor_voltage_100uV[i] > 2500)) | |
158 { | |
159 sensorActive[i] = 0; | |
160 switch(i) | |
161 { | |
162 case 0: | |
163 sensorNotActiveBinary |= 1; | |
164 break; | |
165 case 1: | |
166 sensorNotActiveBinary |= 2; | |
167 break; | |
168 case 2: | |
169 sensorNotActiveBinary |= 4; | |
170 break; | |
171 } | |
172 } | |
173 } | |
174 } | |
175 | |
176 *outOfBouds1 = 0; | |
177 *outOfBouds2 = 0; | |
178 *outOfBouds3 = 0; | |
179 | |
180 /* with two, one or no sensor, there is nothing to compare anymore | |
181 */ | |
182 if(sensorNotActiveBinary) | |
183 { | |
184 // set outOfBounds for both tests | |
185 if(!sensorActive[0]) | |
186 *outOfBouds1 = 1; | |
187 | |
188 if(!sensorActive[1]) | |
189 *outOfBouds2 = 1; | |
190 | |
191 if(!sensorActive[2]) | |
192 *outOfBouds3 = 1; | |
193 | |
194 return; | |
195 } | |
196 else | |
197 { | |
198 uint8_t sensor_id_ordered[3]; | |
199 uint8_t difference[2]; | |
200 | |
201 if((receiveHUD[boolHUDdata].sensor_ppo2_cbar[1]) > (receiveHUD[boolHUDdata].sensor_ppo2_cbar[0])) | |
202 { | |
203 sensor_id_ordered[0] = 0; | |
204 sensor_id_ordered[1] = 1; | |
205 } | |
206 else | |
207 { | |
208 sensor_id_ordered[0] = 1; | |
209 sensor_id_ordered[1] = 0; | |
210 } | |
211 if(receiveHUD[boolHUDdata].sensor_ppo2_cbar[2] > receiveHUD[boolHUDdata].sensor_ppo2_cbar[sensor_id_ordered[1]]) | |
212 { | |
213 sensor_id_ordered[2] = 2; | |
214 } | |
215 else | |
216 { | |
217 sensor_id_ordered[2] = sensor_id_ordered[1]; | |
218 if(receiveHUD[boolHUDdata].sensor_ppo2_cbar[2] > receiveHUD[boolHUDdata].sensor_ppo2_cbar[sensor_id_ordered[0]]) | |
219 { | |
220 sensor_id_ordered[1] = 2; | |
221 } | |
222 else | |
223 { | |
224 sensor_id_ordered[1] = sensor_id_ordered[0]; | |
225 sensor_id_ordered[0] = 2; | |
226 } | |
227 } | |
228 | |
229 difference[0] = receiveHUD[boolHUDdata].sensor_ppo2_cbar[sensor_id_ordered[1]]- receiveHUD[boolHUDdata].sensor_ppo2_cbar[sensor_id_ordered[0]]; | |
230 difference[1] = receiveHUD[boolHUDdata].sensor_ppo2_cbar[sensor_id_ordered[2]]- receiveHUD[boolHUDdata].sensor_ppo2_cbar[sensor_id_ordered[1]]; | |
231 | |
232 if((difference[0] > difference[1]) && (difference[0] > 15)) | |
233 { | |
234 switch(sensor_id_ordered[0]) | |
235 { | |
236 case 0: | |
237 *outOfBouds1 = 1; | |
238 break; | |
239 case 1: | |
240 *outOfBouds2 = 1; | |
241 break; | |
242 case 2: | |
243 *outOfBouds3 = 1; | |
244 break; | |
245 } | |
246 } | |
247 else | |
248 if((difference[0] < difference[1]) && (difference[1] > 15)) | |
249 { | |
250 switch(sensor_id_ordered[2]) | |
251 { | |
252 case 0: | |
253 *outOfBouds1 = 1; | |
254 break; | |
255 case 1: | |
256 *outOfBouds2 = 1; | |
257 break; | |
258 case 2: | |
259 *outOfBouds3 = 1; | |
260 break; | |
261 } | |
262 } | |
263 } | |
264 } | |
265 | |
266 | |
267 uint8_t get_ppO2SensorWeightedResult_cbar(void) | |
268 { | |
269 int8_t sensorOutOfBound[3]; | |
270 uint16_t result = 0; | |
271 uint8_t count = 0; | |
272 | |
273 test_HUD_sensor_values_outOfBounds(&sensorOutOfBound[0], &sensorOutOfBound[1], &sensorOutOfBound[2]); | |
274 | |
275 for(int i=0;i<3;i++) | |
276 { | |
277 if(!sensorOutOfBound[i]) | |
278 { | |
279 result += receiveHUD[boolHUDdata].sensor_ppo2_cbar[i]; | |
280 count++; | |
281 } | |
282 } | |
283 if(count == 0) // all sensors out of bounds! | |
284 return 0; | |
285 else | |
286 return (uint8_t)(result / count); | |
287 } | |
288 | |
289 | |
290 void tCCR_init(void) | |
291 { | |
292 StartListeningToUART_HUD = 1; | |
293 } | |
294 | |
295 | |
296 /* after 3 seconds without update from HUD | |
297 * data is considered old | |
298 */ | |
299 void tCCR_tick(void) | |
300 { | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
301 if(HUDTimeoutCount < 3 * 10) |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
302 HUDTimeoutCount++; |
38 | 303 else |
304 { | |
305 data_old__lost_connection_to_HUD = 1; | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
306 if(HUDTimeoutCount < 20 * 10) |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
307 HUDTimeoutCount++; |
38 | 308 else |
309 tCCR_fallbackToFixedSetpoint(); | |
310 } | |
311 } | |
312 | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
313 void tCCR_SetRXIndication(void) |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
314 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
315 static uint8_t floatingRXCount = 0; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
316 |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
317 if((UartIR_HUD_Handle.RxXferSize == HUD_RX_FRAME_LENGTH) || (UartIR_HUD_Handle.RxXferSize == HUD_RX_FRAME_LENGTH - 1)) /* we expected a complete frame */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
318 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
319 UartReadyHUD = SET; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
320 LastReceivedTick_HUD = HAL_GetTick(); |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
321 floatingRXCount = 0; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
322 } |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
323 else /* follow up of error handling */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
324 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
325 if(time_elapsed_ms(LastReceivedTick_HUD, HAL_GetTick()) > HUD_RX_FRAME_BREAK_MS) /* Reception took a while => frame start detected */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
326 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
327 HAL_UART_Receive_IT(&UartIR_HUD_Handle, &receiveHUDraw[1], 14); /* We have already the first byte => get the missing 14 */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
328 } |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
329 else |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
330 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
331 if(floatingRXCount++ < HUD_BABBLING_IDIOT) |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
332 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
333 HAL_UART_Receive_IT(&UartIR_HUD_Handle, receiveHUDraw, 1); /* Start polling of incoming bytes */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
334 } |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
335 else /* Significant amount of data comming in without break => disable input */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
336 { /* by not reactivation HUD RX, no recovery fromthis state */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
337 stateUsedWrite->diveSettings.ppo2sensors_deactivated = 0x07; /* Display deactivation */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
338 } |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
339 } |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
340 } |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
341 |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
342 } |
38 | 343 |
344 void tCCR_restart(void) | |
345 { | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
346 HAL_UART_AbortReceive_IT(&UartIR_HUD_Handle); /* Called by the error handler. RX will be restarted by control function */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
347 StartListeningToUART_HUD = 1; |
38 | 348 } |
349 | |
350 | |
351 void tCCR_control(void) | |
352 { | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
353 |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
354 if((UartReadyHUD == RESET) && StartListeningToUART_HUD && (time_elapsed_ms(LastReceivedTick_HUD, HAL_GetTick()) > HUD_RX_START_DELAY_MS)) |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
355 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
356 StartListeningToUART_HUD = 0; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
357 HAL_UART_Receive_IT(&UartIR_HUD_Handle, receiveHUDraw, HUD_RX_FRAME_LENGTH); |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
358 } |
38 | 359 |
360 if(UartReadyHUD == SET) | |
361 { | |
362 UartReadyHUD = RESET; | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
363 StartListeningToUART_HUD = 1; |
38 | 364 |
365 memcpy(&receiveHUD[!boolHUDdata], receiveHUDraw, 11); | |
366 receiveHUD[!boolHUDdata].battery_voltage_mV = receiveHUDraw[11] + (256 * receiveHUDraw[12]); | |
367 receiveHUD[!boolHUDdata].checksum = receiveHUDraw[13] + (256 * receiveHUDraw[14]); | |
368 | |
369 uint16_t checksum = 0; | |
370 | |
371 for(int i=0;i<13;i++) | |
372 { | |
373 checksum += receiveHUDraw[i]; | |
374 } | |
375 if(checksum == receiveHUD[!boolHUDdata].checksum) | |
376 { | |
377 boolHUDdata = !boolHUDdata; | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
378 HUDTimeoutCount = 0; |
38 | 379 data_old__lost_connection_to_HUD = 0; |
380 } | |
322
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
381 else |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
382 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
383 if(data_old__lost_connection_to_HUD) /* we lost connection, maybe due to RX shift => start single byte read to resynchronize */ |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
384 { |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
385 HAL_UART_Receive_IT(&UartIR_HUD_Handle, receiveHUDraw, 1); |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
386 StartListeningToUART_HUD = 0; |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
387 } |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
388 } |
31e471d60797
Added start of frame detection for HUD data
ideenmodellierer
parents:
272
diff
changeset
|
389 memset(receiveHUDraw,0,sizeof(receiveHUDraw)); |
38 | 390 } |
391 } | |
392 | |
393 #endif | |
394 /* Private functions ---------------------------------------------------------*/ | |
395 | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
396 static void tCCR_fallbackToFixedSetpoint(void) |
38 | 397 { |
398 if((stateUsed->mode == MODE_DIVE) && (stateUsed->diveSettings.diveMode == DIVEMODE_CCR) && (stateUsed->diveSettings.CCR_Mode == CCRMODE_Sensors) && (stateUsed->diveSettings.fallbackOption)) | |
399 { | |
400 uint8_t setpointCbar, actualGasID; | |
401 | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
402 setpointCbar = stateUsed->diveSettings.setpoint[1].setpoint_cbar; |
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
403 stateUsedWrite->diveSettings.CCR_Mode = CCRMODE_FixedSetpoint; |
38 | 404 |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
405 actualGasID = stateUsed->lifeData.actualGas.GasIdInSettings; |
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
406 setActualGas_DM(&stateUsedWrite->lifeData,actualGasID,setpointCbar); |
38 | 407 |
408 set_warning_fallback(); | |
409 } | |
410 } |