# HG changeset patch
# User Ideenmodellierer
# Date 1598291968 -7200
# Node ID 8428195a49673a9cb52810b0cecf8ff563a4a3b3
# Parent  734f7ad46bcaaecd1c54264ab2ad400b776ba3e8
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

diff -r 734f7ad46bca -r 8428195a4967 Discovery/Src/data_exchange_main.c
--- 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;
 }