changeset 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 5e6a612d03b5
children 4b9427ae0a65
files Common/Inc/data_central.h Discovery/Src/check_warning.c
diffstat 2 files changed, 25 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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;
 
 
--- 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****/