Mercurial > public > ostc4
annotate Discovery/Src/check_warning.c @ 640:f735f1123526
Development bugfix Viewport settings:
Settings of the viewport have been reset after every update. Root cause: plausibility check value has not been adapted to latest implementation.
In addition settings for frame have been overwritten while focus was changed because of an invalid and combination. Both issues have been solved
author | Ideenmodellierer |
---|---|
date | Thu, 11 Mar 2021 21:43:43 +0100 |
parents | c47766ec3f96 |
children | 1b995079c045 |
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 { |
131 if(fallback && ((pDiveState->mode != MODE_DIVE) || (pDiveState->diveSettings.diveMode != DIVEMODE_CCR))) | |
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 | |
184 if((pDiveState->diveSettings.diveMode == DIVEMODE_CCR) && (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 | |
221 if(pDiveSettings->diveMode == DIVEMODE_CCR) | |
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 | |
289 if((stateUsed->mode != MODE_DIVE) || (pDiveState->diveSettings.diveMode != DIVEMODE_CCR) || (pDiveState->diveSettings.CCR_Mode != CCRMODE_FixedSetpoint)) | |
290 { | |
291 return 0; | |
292 } | |
293 | |
294 uint8_t bestSetpointDepth = 0; // travel the deeper, the better | |
295 uint8_t betterSetpointIdLocal = 0; // nothing better | |
296 | |
297 if(!actualLeftMaxDepth(pDiveState)) /* travel gases */ | |
298 { | |
299 for(int i=1; i<=NUM_GASES; i++) | |
300 { | |
301 if( (pDiveState->diveSettings.setpoint[i].note.ub.active) | |
302 && (pDiveState->diveSettings.setpoint[i].depth_meter) | |
303 && (pDiveState->diveSettings.setpoint[i].depth_meter <= ( pDiveState->lifeData.depth_meter + 0.01f )) | |
304 && (pDiveState->diveSettings.setpoint[i].depth_meter >= bestSetpointDepth) | |
305 ) | |
306 { | |
307 betterSetpointIdLocal = i; | |
308 bestSetpointDepth = pDiveState->diveSettings.setpoint[i].depth_meter; | |
309 } | |
310 } | |
311 if((betterSetpointIdLocal) && (pDiveState->diveSettings.setpoint[betterSetpointIdLocal].setpoint_cbar != pDiveState->lifeData.actualGas.setPoint_cbar)) | |
312 { | |
313 betterSetpointId = betterSetpointIdLocal; | |
314 pDiveState->warnings.betterSetpoint = 1; | |
315 } | |
316 } | |
317 return pDiveState->warnings.betterSetpoint; | |
318 } | |
319 | |
320 | |
321 /* hw 151030 | |
322 */ | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
323 static int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2) |
38 | 324 { |
325 if(gas1->helium_percentage != gas2->helium_percentage) | |
326 return 0; | |
327 else | |
328 if(gas1->oxygen_percentage != gas2->oxygen_percentage) | |
329 return 0; | |
330 else | |
331 return 1; | |
332 } | |
333 | |
334 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
335 static int8_t check_CNS(SDiveState * pDiveState) |
38 | 336 { |
337 if(stateUsed->mode != MODE_DIVE) | |
338 { | |
339 pDiveState->warnings.cnsHigh = 0; | |
340 return 0; | |
341 } | |
342 | |
343 if(pDiveState->lifeData.cns >= (float)(settingsGetPointer()->CNS_max)) | |
344 pDiveState->warnings.cnsHigh = 1; | |
345 else | |
346 pDiveState->warnings.cnsHigh = 0; | |
347 return pDiveState->warnings.cnsHigh; | |
348 } | |
349 | |
350 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
351 static int8_t check_Battery(SDiveState * pDiveState) |
38 | 352 { |
353 if(pDiveState->lifeData.battery_charge < 10) | |
354 pDiveState->warnings.lowBattery = 1; | |
355 else | |
356 pDiveState->warnings.lowBattery = 0; | |
357 | |
358 return pDiveState->warnings.lowBattery; | |
359 } | |
360 | |
361 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
362 static int8_t check_Deco(SDiveState * pDiveState) |
38 | 363 { |
364 if(stateUsed->mode != MODE_DIVE) | |
365 { | |
366 pDiveState->warnings.decoMissed = 0; | |
367 return 0; | |
368 } | |
369 | |
370 uint8_t depthNext = decom_get_actual_deco_stop(pDiveState); | |
371 | |
372 if(!depthNext) | |
373 pDiveState->warnings.decoMissed = 0; | |
374 else | |
375 if(pDiveState->lifeData.depth_meter + 0.1f < (float)depthNext) | |
376 pDiveState->warnings.decoMissed = 1; | |
377 else | |
378 pDiveState->warnings.decoMissed = 0; | |
379 | |
380 return pDiveState->warnings.decoMissed; | |
381 } | |
382 | |
383 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
384 static int8_t check_AscentRate(SDiveState * pDiveState) |
38 | 385 { |
386 if(stateUsed->mode != MODE_DIVE) | |
387 { | |
388 pDiveState->warnings.ascentRateHigh = 0; | |
389 return 0; | |
390 } | |
391 | |
392 float warnAscentRateFloat; | |
393 | |
394 warnAscentRateFloat = (float)(settingsGetPointer()->ascent_MeterPerMinute_max); | |
395 | |
396 if(pDiveState->lifeData.ascent_rate_meter_per_min >= warnAscentRateFloat) | |
397 pDiveState->warnings.ascentRateHigh = 1; | |
398 else | |
399 pDiveState->warnings.ascentRateHigh = 0; | |
400 return pDiveState->warnings.ascentRateHigh; | |
401 } | |
402 | |
403 | |
268
1b9847d40e81
cleanup: make things static where possible.
Jan Mulder <jlmulder@xs4all.nl>
parents:
38
diff
changeset
|
404 static int8_t check_aGF(SDiveState * pDiveState) |
38 | 405 { |
406 if(stateUsed->mode != MODE_DIVE) | |
407 { | |
408 pDiveState->warnings.aGf = 0; | |
409 return 0; | |
410 } | |
411 | |
412 pDiveState->warnings.aGf = 0; | |
413 if(pDiveState->diveSettings.deco_type.ub.standard == GF_MODE) | |
414 { | |
415 if((pDiveState->diveSettings.gf_high != settingsGetPointer()->GF_high) || (pDiveState->diveSettings.gf_low != settingsGetPointer()->GF_low)) | |
416 pDiveState->warnings.aGf = 1; | |
417 } | |
418 return pDiveState->warnings.aGf; | |
419 } | |
420 | |
478
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
421 #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
|
422 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
|
423 { |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
424 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
|
425 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
|
426 { |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
427 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
|
428 ret = 1; |
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 else |
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 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
|
433 } |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
434 return ret; |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
435 } |
58200d756365
Development option only: Show Pressure update for a short time in the custom field (as warning)
ideenmodellierer
parents:
272
diff
changeset
|
436 #endif |
636 | 437 |
438 uint8_t debounce_warning_fallback(uint16_t debounceStepms) | |
439 { | |
440 uint8_t retVal = 0; | |
441 | |
442 debounceFallbackTimeMS += debounceStepms; | |
443 if(debounceFallbackTimeMS > DEBOUNCE_FALLBACK_TIME_MS) | |
444 { | |
445 debounceFallbackTimeMS = DEBOUNCE_FALLBACK_TIME_MS; | |
446 retVal = 1; | |
447 } | |
448 return retVal; | |
449 } | |
450 void reset_debounce_warning_fallback() | |
451 { | |
452 debounceFallbackTimeMS = 0; | |
453 } | |
38 | 454 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/ |
455 |