# HG changeset patch
# User ideenmodellierer
# Date 1589317430 -7200
# Node ID 58200d75636591932782b9818a4a890874b6f579
# Parent  5e6a612d03b5d2f65cf68746fa41fe445d7c0552
Development option only: Show Pressure update for a short time in the custom field (as warning)

diff -r 5e6a612d03b5 -r 58200d756365 Common/Inc/data_central.h
--- a/Common/Inc/data_central.h	Tue May 12 23:03:29 2020 +0200
+++ b/Common/Inc/data_central.h	Tue May 12 23:03:50 2020 +0200
@@ -248,6 +248,9 @@
 	int8_t betterGas;
 	int8_t fallback;
 	int8_t betterSetpoint;
+#ifdef ENABLE_BOTTLE_SENSOR
+	int8_t newPressure;
+#endif
 } SWarnings;
 
 
diff -r 5e6a612d03b5 -r 58200d756365 Discovery/Src/check_warning.c
--- 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****/