diff Discovery/Src/check_warning.c @ 482:230aed360da0

Merged in Ideenmodellierer/ostc4/Improve_Button_Sleep (pull request #45) Improve Button Sleep
author heinrichsweikamp <bitbucket@heinrichsweikamp.com>
date Tue, 19 May 2020 07:27:18 +0000
parents 58200d756365
children d97f0e395058
line wrap: on
line diff
--- a/Discovery/Src/check_warning.c	Tue Apr 28 15:37:47 2020 +0000
+++ b/Discovery/Src/check_warning.c	Tue May 19 07:27:18 2020 +0000
@@ -54,7 +54,9 @@
 static int8_t check_BetterGas(SDiveState * pDiveState);
 static int8_t check_BetterSetpoint(SDiveState * pDiveState);
 static int8_t check_Battery(SDiveState * pDiveState);
-
+#ifdef ENABLE_BOTTLE_SENSOR
+static int8_t check_pressureSensor(SDiveState * pDiveState);
+#endif
 static int8_t check_helper_same_oxygen_and_helium_content(SGasLine * gas1, SGasLine * gas2);
 
 /* Exported functions --------------------------------------------------------*/
@@ -79,6 +81,9 @@
 	pDiveState->warnings.numWarnings += check_BetterSetpoint(pDiveState);
 	pDiveState->warnings.numWarnings += check_Battery(pDiveState);
 	pDiveState->warnings.numWarnings += check_fallback(pDiveState);
+#ifdef ENABLE_BOTTLE_SENSOR
+	pDiveState->warnings.numWarnings += check_pressureSensor(pDiveState);
+#endif
 }
 
 
@@ -406,5 +411,21 @@
   return pDiveState->warnings.aGf;
 }
 
+#ifdef ENABLE_BOTTLE_SENSOR
+static int8_t check_pressureSensor(SDiveState * pDiveState)
+{
+	int8_t ret = 0;
+	if(pDiveState->lifeData.bottle_bar_age_MilliSeconds[pDiveState->lifeData.actualGas.GasIdInSettings] < 50)	/* we received a new value */
+	{
+		pDiveState->warnings.newPressure = stateUsed->lifeData.bottle_bar[stateUsed->lifeData.actualGas.GasIdInSettings];
+		ret = 1;
+	}
+	else
+	{
+		pDiveState->warnings.newPressure = 0;
+	}
+	return ret;
+}
+#endif
 /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/