Mercurial > public > ostc4
annotate Discovery/Src/check_warning.c @ 689:4dd487b407f7 Betatest
Added Sentinel as O2 sensor source:
The Sentinel rebrather may now be selected as input for sensor data (only if compile switch is activated)
author | Ideenmodellierer |
---|---|
date | Fri, 05 Aug 2022 15:15:01 +0200 |
parents | b456be1e152d |
children | 6de83d8205a0 |
rev | line source |
---|---|
38 | 1 /** |
2 ****************************************************************************** | |
3 * @file check_warning.c | |
4 * @author heinrichs weikamp gmbh | |
5 * @date 17-Nov-2014 | |
6 * @version V0.0.1 | |
7 * @since 17-Nov-2014 | |
8 * @brief check and set warnings for warnings | |
9 * | |
10 @verbatim | |
11 ============================================================================== | |
12 ##### How to use ##### | |
13 ============================================================================== | |
14 OSTC3 Warnings: | |
15 niedriger Batteriezustand ( | |
16 zu hoher oder zu niedriger Sauerstoffpartialdruck (ppO2) 0.2 - 1.6 | |
17 zu hoher CNS (Gefahr der Sauerstoffvergiftung) 90% | |
18 zu hohe Gradientenfaktoren 90 - 90 | |
19 Missachtung der Dekostopps (der �berschrittene Dekostopp wird rot angezeigt) 0 m | |
20 zu hohe Aufstiegsgeschwindigkeit 30 m/min | |
21 aGF-Warnung: die Berechnung der Dekompression wird �ber alternative GF-Werte durchgef�hrt | |
22 Fallback-Warnung bei ausgefallenem Sensor | |
23 | |
24 @endverbatim | |
25 ****************************************************************************** | |
26 * @attention | |
27 * | |
28 * <h2><center>© COPYRIGHT(c) 2014 heinrichs weikamp</center></h2> | |
29 * | |
30 ****************************************************************************** | |
31 */ | |
32 | |
33 /* Includes ------------------------------------------------------------------*/ | |
34 | |
35 #include "data_exchange.h" | |
36 #include "check_warning.h" | |
37 #include "settings.h" | |
38 #include "decom.h" | |
39 #include "tCCR.h" | |
40 | |
636 | 41 |
42 #define DEBOUNCE_FALLBACK_TIME_MS (5000u) /* set warning after 5 seconds of pending error condition */ | |
43 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
44 /* Private variables with access ----------------------------------------------*/ |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
45 static uint8_t betterGasId = 0; |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
46 static uint8_t betterSetpointId = 0; |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
47 static int8_t fallback = 0; |
636 | 48 static uint16_t debounceFallbackTimeMS = 0; |
38 | 49 |
50 /* Private function prototypes -----------------------------------------------*/ | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
51 static int8_t check_fallback(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
52 static int8_t check_ppO2(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
53 static int8_t check_O2_sensors(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
54 static int8_t check_CNS(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
55 static int8_t check_Deco(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
56 static int8_t check_AscentRate(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
57 static int8_t check_aGF(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
58 static int8_t check_BetterGas(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
59 static int8_t check_BetterSetpoint(SDiveState * pDiveState); |
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
60 static int8_t check_Battery(SDiveState * pDiveState); |
478
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
61 #ifdef ENABLE_BOTTLE_SENSOR |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
62 static int8_t check_pressureSensor(SDiveState * pDiveState); |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
63 #endif |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
64 static int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2); |
38 | 65 |
66 /* Exported functions --------------------------------------------------------*/ | |
67 | |
68 void check_warning(void) | |
69 { | |
272
74a8296a2318
cleanup: simplify stateUsed usage
Jan Mulder <jlmulder@xs4all.nl>
parents:
268
diff
changeset
|
70 check_warning2(stateUsedWrite); |
38 | 71 } |
72 | |
73 | |
74 void check_warning2(SDiveState * pDiveState) | |
75 { | |
76 pDiveState->warnings.numWarnings = 0; | |
77 | |
78 pDiveState->warnings.numWarnings += check_aGF(pDiveState); | |
79 pDiveState->warnings.numWarnings += check_AscentRate(pDiveState); | |
80 pDiveState->warnings.numWarnings += check_CNS(pDiveState); | |
81 pDiveState->warnings.numWarnings += check_Deco(pDiveState); | |
82 pDiveState->warnings.numWarnings += check_ppO2(pDiveState); | |
83 pDiveState->warnings.numWarnings += check_O2_sensors(pDiveState); | |
84 pDiveState->warnings.numWarnings += check_BetterGas(pDiveState); | |
85 pDiveState->warnings.numWarnings += check_BetterSetpoint(pDiveState); | |
86 pDiveState->warnings.numWarnings += check_Battery(pDiveState); | |
87 pDiveState->warnings.numWarnings += check_fallback(pDiveState); | |
478
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
88 #ifdef ENABLE_BOTTLE_SENSOR |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
89 pDiveState->warnings.numWarnings += check_pressureSensor(pDiveState); |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
90 #endif |
38 | 91 } |
92 | |
93 | |
94 void set_warning_fallback(void) | |
95 { | |
96 fallback = 1; | |
97 } | |
98 | |
99 | |
100 void clear_warning_fallback(void) | |
101 { | |
102 fallback = 0; | |
636 | 103 debounceFallbackTimeMS = 0; |
38 | 104 } |
105 | |
106 | |
107 uint8_t actualBetterGasId(void) | |
108 { | |
109 return betterGasId; | |
110 } | |
111 | |
112 | |
113 uint8_t actualBetterSetpointId(void) | |
114 { | |
115 return betterSetpointId; | |
116 } | |
117 | |
118 | |
119 uint8_t actualLeftMaxDepth(const SDiveState * pDiveState) | |
120 { | |
121 if(pDiveState->lifeData.depth_meter > (pDiveState->lifeData.max_depth_meter - 3.0f)) | |
122 return 0; | |
123 else | |
124 return 1; | |
125 } | |
126 | |
127 | |
128 /* Private functions ---------------------------------------------------------*/ | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
129 static int8_t check_fallback(SDiveState * pDiveState) |
38 | 130 { |
662 | 131 if(fallback && ((pDiveState->mode != MODE_DIVE) || (!isLoopMode(pDiveState->diveSettings.diveMode)))) |
38 | 132 fallback = 0; |
133 | |
134 pDiveState->warnings.fallback = fallback; | |
135 return pDiveState->warnings.fallback; | |
136 } | |
137 | |
138 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
139 static int8_t check_ppO2(SDiveState * pDiveState) |
38 | 140 { |
582
64bf41faab83
Show Fallback if no valid sensor value is available:
Ideenmodellierer
parents:
563
diff
changeset
|
141 if((pDiveState->mode != MODE_DIVE) || (pDiveState->warnings.fallback)) |
38 | 142 { |
143 pDiveState->warnings.ppO2Low = 0; | |
144 pDiveState->warnings.ppO2High = 0; | |
145 return 0; | |
146 } | |
147 | |
148 uint8_t localPPO2, testPPO2high; | |
149 | |
150 if(pDiveState->lifeData.ppO2 < 0) | |
151 localPPO2 = 0; | |
152 else | |
153 if(pDiveState->lifeData.ppO2 >= 2.5f) | |
154 localPPO2 = 255; | |
155 else | |
156 localPPO2 = (uint8_t)(pDiveState->lifeData.ppO2 * 100); | |
157 | |
158 if((localPPO2 + 1) <= settingsGetPointer()->ppO2_min) | |
159 pDiveState->warnings.ppO2Low = 1; | |
160 else | |
161 pDiveState->warnings.ppO2Low = 0; | |
162 | |
163 if(actualLeftMaxDepth(pDiveState)) | |
164 testPPO2high = settingsGetPointer()->ppO2_max_deco; | |
165 else | |
166 testPPO2high = settingsGetPointer()->ppO2_max_std; | |
167 | |
168 if(localPPO2 >= (testPPO2high + 1)) | |
169 pDiveState->warnings.ppO2High = 1; | |
170 else | |
171 pDiveState->warnings.ppO2High = 0; | |
172 | |
173 return pDiveState->warnings.ppO2Low + pDiveState->warnings.ppO2High; | |
174 } | |
175 | |
176 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
177 static int8_t check_O2_sensors(SDiveState * pDiveState) |
38 | 178 { |
179 pDiveState->warnings.sensorLinkLost = 0; | |
180 pDiveState->warnings.sensorOutOfBounds[0] = 0; | |
181 pDiveState->warnings.sensorOutOfBounds[1] = 0; | |
182 pDiveState->warnings.sensorOutOfBounds[2] = 0; | |
183 | |
662 | 184 if(isLoopMode(pDiveState->diveSettings.diveMode) && (pDiveState->diveSettings.CCR_Mode == CCRMODE_Sensors)) |
563 | 185 |
186 if(settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC) | |
187 { | |
188 { | |
189 if(!get_HUD_battery_voltage_V()) | |
190 pDiveState->warnings.sensorLinkLost = 1; | |
191 } | |
192 } | |
634 | 193 test_O2_sensor_values_outOfBounds(&pDiveState->warnings.sensorOutOfBounds[0], &pDiveState->warnings.sensorOutOfBounds[1], &pDiveState->warnings.sensorOutOfBounds[2]); |
38 | 194 return pDiveState->warnings.sensorLinkLost |
195 + pDiveState->warnings.sensorOutOfBounds[0] | |
196 + pDiveState->warnings.sensorOutOfBounds[1] | |
197 + pDiveState->warnings.sensorOutOfBounds[2]; | |
198 } | |
199 | |
200 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
201 static int8_t check_BetterGas(SDiveState * pDiveState) |
38 | 202 { |
203 if(stateUsed->mode != MODE_DIVE) | |
204 { | |
205 pDiveState->warnings.betterGas = 0; | |
206 betterGasId = 0; | |
207 return 0; | |
208 } | |
209 | |
210 uint8_t gasIdOffset; | |
211 uint8_t bestGasDepth, betterGasIdLocal; | |
212 | |
213 SLifeData* pLifeData = &pDiveState->lifeData; | |
214 SDiveSettings* pDiveSettings = &pDiveState->diveSettings; | |
215 | |
216 pDiveState->warnings.betterGas = 0; | |
217 betterGasId = 0; | |
218 betterGasIdLocal = pLifeData->actualGas.GasIdInSettings; | |
219 bestGasDepth = 255; | |
220 | |
662 | 221 if(isLoopMode(pDiveSettings->diveMode)) |
38 | 222 gasIdOffset = NUM_OFFSET_DILUENT; |
223 else | |
224 gasIdOffset = 0; | |
225 | |
226 /* life data is float, gas data is uint8 */ | |
227 if(actualLeftMaxDepth(pDiveState)) /* deco gases */ | |
228 { | |
229 for(int i=1+gasIdOffset; i<= 5+gasIdOffset; i++) | |
230 { | |
231 if( (pDiveSettings->gas[i].note.ub.active) | |
232 && (pDiveSettings->gas[i].note.ub.deco) | |
233 && (pDiveSettings->gas[i].depth_meter) | |
234 && (pDiveSettings->gas[i].depth_meter >= (pLifeData->depth_meter - 0.01f )) | |
235 && (pDiveSettings->gas[i].depth_meter <= bestGasDepth) | |
236 ) | |
237 { | |
238 betterGasIdLocal = i; | |
239 bestGasDepth = pDiveSettings->gas[i].depth_meter; | |
240 } | |
241 } | |
242 | |
243 if(betterGasIdLocal != pLifeData->actualGas.GasIdInSettings) | |
244 { | |
245 if(!check_helper_same_oxygen_and_helium_content(&pDiveSettings->gas[betterGasIdLocal], &pDiveSettings->gas[pLifeData->actualGas.GasIdInSettings])) | |
246 { | |
247 betterGasId = betterGasIdLocal; | |
248 pDiveState->warnings.betterGas = 1; | |
249 } | |
250 } | |
251 } | |
252 else /* travel gases */ | |
253 { | |
254 bestGasDepth = 0; | |
255 //check for travalgas | |
256 for(int i=1+gasIdOffset; i<= 5+gasIdOffset; i++) | |
257 { | |
258 if( (pDiveSettings->gas[i].note.ub.active) | |
259 && (pDiveSettings->gas[i].note.ub.travel) | |
260 && (pDiveSettings->gas[i].depth_meter_travel) | |
261 && (pDiveSettings->gas[i].depth_meter_travel <= (pLifeData->depth_meter + 0.01f )) | |
262 && (pDiveSettings->gas[i].depth_meter_travel >= bestGasDepth) | |
263 ) | |
264 { | |
265 betterGasIdLocal = i; | |
266 bestGasDepth = pDiveSettings->gas[i].depth_meter; | |
267 } | |
268 } | |
269 | |
270 if(betterGasIdLocal != pLifeData->actualGas.GasIdInSettings) | |
271 { | |
272 if(!check_helper_same_oxygen_and_helium_content(&pDiveSettings->gas[betterGasIdLocal], &pDiveSettings->gas[pLifeData->actualGas.GasIdInSettings])) | |
273 { | |
274 betterGasId = betterGasIdLocal; | |
275 pDiveState->warnings.betterGas = 1; | |
276 } | |
277 } | |
278 } | |
279 return pDiveState->warnings.betterGas; | |
280 } | |
281 | |
282 /* check for better travel!!! setpoint hw 151210 | |
283 */ | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
284 static int8_t check_BetterSetpoint(SDiveState * pDiveState) |
38 | 285 { |
286 pDiveState->warnings.betterSetpoint = 0; | |
287 betterSetpointId = 0; | |
288 uint8_t bestSetpointDepth = 0; // travel the deeper, the better | |
289 uint8_t betterSetpointIdLocal = 0; // nothing better | |
290 | |
662 | 291 |
292 if((stateUsed->mode == MODE_DIVE) && (pDiveState->diveSettings.diveMode == DIVEMODE_CCR)) | |
38 | 293 { |
662 | 294 if(!actualLeftMaxDepth(pDiveState)) /* travel gases */ |
38 | 295 { |
662 | 296 for(int i=1; i<=NUM_GASES; i++) |
297 { | |
298 if( (pDiveState->diveSettings.setpoint[i].note.ub.active) | |
299 && (pDiveState->diveSettings.setpoint[i].depth_meter) | |
300 && (pDiveState->diveSettings.setpoint[i].depth_meter <= ( pDiveState->lifeData.depth_meter + 0.01f )) | |
301 && (pDiveState->diveSettings.setpoint[i].depth_meter >= bestSetpointDepth) | |
302 ) | |
303 { | |
304 betterSetpointIdLocal = i; | |
305 bestSetpointDepth = pDiveState->diveSettings.setpoint[i].depth_meter; | |
306 } | |
307 } | |
308 if((betterSetpointIdLocal) && (pDiveState->diveSettings.setpoint[betterSetpointIdLocal].setpoint_cbar != pDiveState->lifeData.actualGas.setPoint_cbar)) | |
309 { | |
310 betterSetpointId = betterSetpointIdLocal; | |
311 pDiveState->warnings.betterSetpoint = 1; | |
312 } | |
38 | 313 } |
314 } | |
315 return pDiveState->warnings.betterSetpoint; | |
316 } | |
317 | |
318 | |
319 /* hw 151030 | |
320 */ | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
321 static int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2) |
38 | 322 { |
323 if(gas1->helium_percentage != gas2->helium_percentage) | |
324 return 0; | |
325 else | |
326 if(gas1->oxygen_percentage != gas2->oxygen_percentage) | |
327 return 0; | |
328 else | |
329 return 1; | |
330 } | |
331 | |
332 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
333 static int8_t check_CNS(SDiveState * pDiveState) |
38 | 334 { |
335 if(stateUsed->mode != MODE_DIVE) | |
336 { | |
337 pDiveState->warnings.cnsHigh = 0; | |
338 return 0; | |
339 } | |
340 | |
341 if(pDiveState->lifeData.cns >= (float)(settingsGetPointer()->CNS_max)) | |
342 pDiveState->warnings.cnsHigh = 1; | |
343 else | |
344 pDiveState->warnings.cnsHigh = 0; | |
345 return pDiveState->warnings.cnsHigh; | |
346 } | |
347 | |
348 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
349 static int8_t check_Battery(SDiveState * pDiveState) |
38 | 350 { |
671
b456be1e152d
Support of unknown charging counter values:
Ideenmodellierer
parents:
662
diff
changeset
|
351 if((pDiveState->lifeData.battery_charge > 0) && (pDiveState->lifeData.battery_charge < 10)) |
38 | 352 pDiveState->warnings.lowBattery = 1; |
353 else | |
354 pDiveState->warnings.lowBattery = 0; | |
355 | |
356 return pDiveState->warnings.lowBattery; | |
357 } | |
358 | |
359 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
360 static int8_t check_Deco(SDiveState * pDiveState) |
38 | 361 { |
362 if(stateUsed->mode != MODE_DIVE) | |
363 { | |
364 pDiveState->warnings.decoMissed = 0; | |
365 return 0; | |
366 } | |
367 | |
368 uint8_t depthNext = decom_get_actual_deco_stop(pDiveState); | |
369 | |
370 if(!depthNext) | |
371 pDiveState->warnings.decoMissed = 0; | |
372 else | |
373 if(pDiveState->lifeData.depth_meter + 0.1f < (float)depthNext) | |
374 pDiveState->warnings.decoMissed = 1; | |
375 else | |
376 pDiveState->warnings.decoMissed = 0; | |
377 | |
378 return pDiveState->warnings.decoMissed; | |
379 } | |
380 | |
381 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
382 static int8_t check_AscentRate(SDiveState * pDiveState) |
38 | 383 { |
384 if(stateUsed->mode != MODE_DIVE) | |
385 { | |
386 pDiveState->warnings.ascentRateHigh = 0; | |
387 return 0; | |
388 } | |
389 | |
390 float warnAscentRateFloat; | |
391 | |
392 warnAscentRateFloat = (float)(settingsGetPointer()->ascent_MeterPerMinute_max); | |
393 | |
394 if(pDiveState->lifeData.ascent_rate_meter_per_min >= warnAscentRateFloat) | |
395 pDiveState->warnings.ascentRateHigh = 1; | |
396 else | |
397 pDiveState->warnings.ascentRateHigh = 0; | |
398 return pDiveState->warnings.ascentRateHigh; | |
399 } | |
400 | |
401 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
402 static int8_t check_aGF(SDiveState * pDiveState) |
38 | 403 { |
404 if(stateUsed->mode != MODE_DIVE) | |
405 { | |
406 pDiveState->warnings.aGf = 0; | |
407 return 0; | |
408 } | |
409 | |
410 pDiveState->warnings.aGf = 0; | |
411 if(pDiveState->diveSettings.deco_type.ub.standard == GF_MODE) | |
412 { | |
413 if((pDiveState->diveSettings.gf_high != settingsGetPointer()->GF_high) || (pDiveState->diveSettings.gf_low != settingsGetPointer()->GF_low)) | |
414 pDiveState->warnings.aGf = 1; | |
415 } | |
416 return pDiveState->warnings.aGf; | |
417 } | |
418 | |
478
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
419 #ifdef ENABLE_BOTTLE_SENSOR |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
420 static int8_t check_pressureSensor(SDiveState * pDiveState) |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
421 { |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
422 int8_t ret = 0; |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
423 if(pDiveState->lifeData.bottle_bar_age_MilliSeconds[pDiveState->lifeData.actualGas.GasIdInSettings] < 50) /* we received a new value */ |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
424 { |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
425 pDiveState->warnings.newPressure = stateUsed->lifeData.bottle_bar[stateUsed->lifeData.actualGas.GasIdInSettings]; |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
426 ret = 1; |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
427 } |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
428 else |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
429 { |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
430 pDiveState->warnings.newPressure = 0; |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
431 } |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
432 return ret; |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
433 } |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
434 #endif |
636 | 435 |
436 uint8_t debounce_warning_fallback(uint16_t debounceStepms) | |
437 { | |
438 uint8_t retVal = 0; | |
439 | |
440 debounceFallbackTimeMS += debounceStepms; | |
441 if(debounceFallbackTimeMS > DEBOUNCE_FALLBACK_TIME_MS) | |
442 { | |
443 debounceFallbackTimeMS = DEBOUNCE_FALLBACK_TIME_MS; | |
444 retVal = 1; | |
445 } | |
446 return retVal; | |
447 } | |
448 void reset_debounce_warning_fallback() | |
449 { | |
450 debounceFallbackTimeMS = 0; | |
451 } | |
38 | 452 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |
453 |