diff Discovery/Src/check_warning.c @ 478:58200d756365 Improve_Button_Sleep

Development option only: Show Pressure update for a short time in the custom field (as warning)
author ideenmodellierer
date Tue, 12 May 2020 23:03:50 +0200
parents 74a8296a2318
children d97f0e395058
line wrap: on
line diff
--- a/Discovery/Src/check_warning.c	Tue May 12 23:03:29 2020 +0200
+++ b/Discovery/Src/check_warning.c	Tue May 12 23:03:50 2020 +0200
@@ -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****/