comparison Discovery/Src/check_warning.c @ 268:1b9847d40e81 write-from-sim

cleanup: make things static where possible. and comment out some code that is not used. Trivial cleanup. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Tue, 23 Apr 2019 17:41:20 +0200
parents 5f11787b4f42
children 74a8296a2318
comparison
equal deleted inserted replaced
267:cf6ad20380fb 268:1b9847d40e81
36 #include "check_warning.h" 36 #include "check_warning.h"
37 #include "settings.h" 37 #include "settings.h"
38 #include "decom.h" 38 #include "decom.h"
39 #include "tCCR.h" 39 #include "tCCR.h"
40 40
41 /* Private variables wit access ----------------------------------------------*/ 41 /* Private variables with access ----------------------------------------------*/
42 uint8_t betterGasId = 0; 42 static uint8_t betterGasId = 0;
43 uint8_t betterSetpointId = 0; 43 static uint8_t betterSetpointId = 0;
44 int8_t fallback = 0; 44 static int8_t fallback = 0;
45 45
46 /* Private function prototypes -----------------------------------------------*/ 46 /* Private function prototypes -----------------------------------------------*/
47 int8_t check_fallback(SDiveState * pDiveState); 47 static int8_t check_fallback(SDiveState * pDiveState);
48 int8_t check_ppO2(SDiveState * pDiveState); 48 static int8_t check_ppO2(SDiveState * pDiveState);
49 int8_t check_O2_sensors(SDiveState * pDiveState); 49 static int8_t check_O2_sensors(SDiveState * pDiveState);
50 int8_t check_CNS(SDiveState * pDiveState); 50 static int8_t check_CNS(SDiveState * pDiveState);
51 int8_t check_Deco(SDiveState * pDiveState); 51 static int8_t check_Deco(SDiveState * pDiveState);
52 int8_t check_AscentRate(SDiveState * pDiveState); 52 static int8_t check_AscentRate(SDiveState * pDiveState);
53 int8_t check_aGF(SDiveState * pDiveState); 53 static int8_t check_aGF(SDiveState * pDiveState);
54 int8_t check_BetterGas(SDiveState * pDiveState); 54 static int8_t check_BetterGas(SDiveState * pDiveState);
55 int8_t check_BetterSetpoint(SDiveState * pDiveState); 55 static int8_t check_BetterSetpoint(SDiveState * pDiveState);
56 int8_t check_Battery(SDiveState * pDiveState); 56 static int8_t check_Battery(SDiveState * pDiveState);
57 57
58 int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2); 58 static int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2);
59 59
60 /* Exported functions --------------------------------------------------------*/ 60 /* Exported functions --------------------------------------------------------*/
61 61
62 void check_warning(void) 62 void check_warning(void)
63 { 63 {
121 return 1; 121 return 1;
122 } 122 }
123 123
124 124
125 /* Private functions ---------------------------------------------------------*/ 125 /* Private functions ---------------------------------------------------------*/
126 int8_t check_fallback(SDiveState * pDiveState) 126 static int8_t check_fallback(SDiveState * pDiveState)
127 { 127 {
128 if(fallback && ((pDiveState->mode != MODE_DIVE) || (pDiveState->diveSettings.diveMode != DIVEMODE_CCR))) 128 if(fallback && ((pDiveState->mode != MODE_DIVE) || (pDiveState->diveSettings.diveMode != DIVEMODE_CCR)))
129 fallback = 0; 129 fallback = 0;
130 130
131 pDiveState->warnings.fallback = fallback; 131 pDiveState->warnings.fallback = fallback;
132 return pDiveState->warnings.fallback; 132 return pDiveState->warnings.fallback;
133 } 133 }
134 134
135 135
136 int8_t check_ppO2(SDiveState * pDiveState) 136 static int8_t check_ppO2(SDiveState * pDiveState)
137 { 137 {
138 if(pDiveState->mode != MODE_DIVE) 138 if(pDiveState->mode != MODE_DIVE)
139 { 139 {
140 pDiveState->warnings.ppO2Low = 0; 140 pDiveState->warnings.ppO2Low = 0;
141 pDiveState->warnings.ppO2High = 0; 141 pDiveState->warnings.ppO2High = 0;
169 169
170 return pDiveState->warnings.ppO2Low + pDiveState->warnings.ppO2High; 170 return pDiveState->warnings.ppO2Low + pDiveState->warnings.ppO2High;
171 } 171 }
172 172
173 173
174 int8_t check_O2_sensors(SDiveState * pDiveState) 174 static int8_t check_O2_sensors(SDiveState * pDiveState)
175 { 175 {
176 pDiveState->warnings.sensorLinkLost = 0; 176 pDiveState->warnings.sensorLinkLost = 0;
177 pDiveState->warnings.sensorOutOfBounds[0] = 0; 177 pDiveState->warnings.sensorOutOfBounds[0] = 0;
178 pDiveState->warnings.sensorOutOfBounds[1] = 0; 178 pDiveState->warnings.sensorOutOfBounds[1] = 0;
179 pDiveState->warnings.sensorOutOfBounds[2] = 0; 179 pDiveState->warnings.sensorOutOfBounds[2] = 0;
191 + pDiveState->warnings.sensorOutOfBounds[1] 191 + pDiveState->warnings.sensorOutOfBounds[1]
192 + pDiveState->warnings.sensorOutOfBounds[2]; 192 + pDiveState->warnings.sensorOutOfBounds[2];
193 } 193 }
194 194
195 195
196 int8_t check_BetterGas(SDiveState * pDiveState) 196 static int8_t check_BetterGas(SDiveState * pDiveState)
197 { 197 {
198 if(stateUsed->mode != MODE_DIVE) 198 if(stateUsed->mode != MODE_DIVE)
199 { 199 {
200 pDiveState->warnings.betterGas = 0; 200 pDiveState->warnings.betterGas = 0;
201 betterGasId = 0; 201 betterGasId = 0;
274 return pDiveState->warnings.betterGas; 274 return pDiveState->warnings.betterGas;
275 } 275 }
276 276
277 /* check for better travel!!! setpoint hw 151210 277 /* check for better travel!!! setpoint hw 151210
278 */ 278 */
279 int8_t check_BetterSetpoint(SDiveState * pDiveState) 279 static int8_t check_BetterSetpoint(SDiveState * pDiveState)
280 { 280 {
281 pDiveState->warnings.betterSetpoint = 0; 281 pDiveState->warnings.betterSetpoint = 0;
282 betterSetpointId = 0; 282 betterSetpointId = 0;
283 283
284 if((stateUsed->mode != MODE_DIVE) || (pDiveState->diveSettings.diveMode != DIVEMODE_CCR) || (pDiveState->diveSettings.CCR_Mode != CCRMODE_FixedSetpoint)) 284 if((stateUsed->mode != MODE_DIVE) || (pDiveState->diveSettings.diveMode != DIVEMODE_CCR) || (pDiveState->diveSettings.CCR_Mode != CCRMODE_FixedSetpoint))
313 } 313 }
314 314
315 315
316 /* hw 151030 316 /* hw 151030
317 */ 317 */
318 int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2) 318 static int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2)
319 { 319 {
320 if(gas1->helium_percentage != gas2->helium_percentage) 320 if(gas1->helium_percentage != gas2->helium_percentage)
321 return 0; 321 return 0;
322 else 322 else
323 if(gas1->oxygen_percentage != gas2->oxygen_percentage) 323 if(gas1->oxygen_percentage != gas2->oxygen_percentage)
325 else 325 else
326 return 1; 326 return 1;
327 } 327 }
328 328
329 329
330 int8_t check_CNS(SDiveState * pDiveState) 330 static int8_t check_CNS(SDiveState * pDiveState)
331 { 331 {
332 if(stateUsed->mode != MODE_DIVE) 332 if(stateUsed->mode != MODE_DIVE)
333 { 333 {
334 pDiveState->warnings.cnsHigh = 0; 334 pDiveState->warnings.cnsHigh = 0;
335 return 0; 335 return 0;
341 pDiveState->warnings.cnsHigh = 0; 341 pDiveState->warnings.cnsHigh = 0;
342 return pDiveState->warnings.cnsHigh; 342 return pDiveState->warnings.cnsHigh;
343 } 343 }
344 344
345 345
346 int8_t check_Battery(SDiveState * pDiveState) 346 static int8_t check_Battery(SDiveState * pDiveState)
347 { 347 {
348 if(pDiveState->lifeData.battery_charge < 10) 348 if(pDiveState->lifeData.battery_charge < 10)
349 pDiveState->warnings.lowBattery = 1; 349 pDiveState->warnings.lowBattery = 1;
350 else 350 else
351 pDiveState->warnings.lowBattery = 0; 351 pDiveState->warnings.lowBattery = 0;
352 352
353 return pDiveState->warnings.lowBattery; 353 return pDiveState->warnings.lowBattery;
354 } 354 }
355 355
356 356
357 int8_t check_Deco(SDiveState * pDiveState) 357 static int8_t check_Deco(SDiveState * pDiveState)
358 { 358 {
359 if(stateUsed->mode != MODE_DIVE) 359 if(stateUsed->mode != MODE_DIVE)
360 { 360 {
361 pDiveState->warnings.decoMissed = 0; 361 pDiveState->warnings.decoMissed = 0;
362 return 0; 362 return 0;
374 374
375 return pDiveState->warnings.decoMissed; 375 return pDiveState->warnings.decoMissed;
376 } 376 }
377 377
378 378
379 int8_t check_AscentRate(SDiveState * pDiveState) 379 static int8_t check_AscentRate(SDiveState * pDiveState)
380 { 380 {
381 if(stateUsed->mode != MODE_DIVE) 381 if(stateUsed->mode != MODE_DIVE)
382 { 382 {
383 pDiveState->warnings.ascentRateHigh = 0; 383 pDiveState->warnings.ascentRateHigh = 0;
384 return 0; 384 return 0;
394 pDiveState->warnings.ascentRateHigh = 0; 394 pDiveState->warnings.ascentRateHigh = 0;
395 return pDiveState->warnings.ascentRateHigh; 395 return pDiveState->warnings.ascentRateHigh;
396 } 396 }
397 397
398 398
399 int8_t check_aGF(SDiveState * pDiveState) 399 static int8_t check_aGF(SDiveState * pDiveState)
400 { 400 {
401 if(stateUsed->mode != MODE_DIVE) 401 if(stateUsed->mode != MODE_DIVE)
402 { 402 {
403 pDiveState->warnings.aGf = 0; 403 pDiveState->warnings.aGf = 0;
404 return 0; 404 return 0;