changeset 504:8428195a4967

Added worst case plausibility check (disabled by compile switch) Just used in case of development activities which may cause negativ values resulting in errors / timeout in the deco calculation
author Ideenmodellierer
date Mon, 24 Aug 2020 19:59:28 +0200
parents 734f7ad46bca
children 06b21f1e47a5
files Discovery/Src/data_exchange_main.c
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/data_exchange_main.c	Mon Aug 24 19:53:27 2020 +0200
+++ b/Discovery/Src/data_exchange_main.c	Mon Aug 24 19:59:28 2020 +0200
@@ -732,6 +732,17 @@
 	surface = d->data[d->boolPressureData].surface_mbar / 1000.0f;
 	density = ((float)( 100 + settingsGetPointer()->salinity)) / 100.0f;
 
+#ifdef TESTBENCH
+	/* do plausibility check (typically only needed at debug hardware) */
+	if(ambient < 0)
+	{
+		ambient = 1.0;
+	}
+	if(surface < 0)
+	{
+		surface = 1.0;
+	}
+#endif
 	ds->lifeData.pressure_ambient_bar = ambient;
 	ds->lifeData.pressure_surface_bar = surface;
 	depth = (ambient - surface) / (0.09807f * density);
@@ -745,6 +756,13 @@
 	float temp = 0;
 	temp = d->data[d->boolPressureData].temperature;
 
+#ifdef TESTBENCH
+	/* do plausibility check (typically only needed at debug hardware */
+	if(temp < -40.0)
+	{
+		temp = 20.0;
+	}
+#endif
 	return temp;
 }