changeset 858:08ea8e9d6cfe Evo_2_23

Bugfix initialisation of surface pressure: A reset of the RTE less than one minute before a dive starts may cause problems in the depth calculation because the default pressure is not set yet. To avoid this the first measured pressure value will now be used as stable surface pressure to close the gap till the stable surface pressure is evaluated.
author Ideenmodellierer
date Tue, 07 May 2024 21:12:37 +0200
parents ba1aebc6d5af
children d32901746950
files Small_CPU/Src/pressure.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Small_CPU/Src/pressure.c	Sun May 05 17:27:28 2024 +0200
+++ b/Small_CPU/Src/pressure.c	Tue May 07 21:12:37 2024 +0200
@@ -130,6 +130,7 @@
 		for(int i=0; i<PRESSURE_SURFACE_QUE; i++)
 			surface_ring_mbar[i] = ambient_pressure_mbar;
 		surface_pressure_mbar = ambient_pressure_mbar;
+		surface_pressure_stable_value = surface_pressure_mbar;
 		surface_pressure_writeIndex = 0;			/* index of the oldest value in the ring buffer */
 	}
 }
@@ -236,8 +237,9 @@
 
 			secondCounterSurfaceRing = 0;
 			avgCount = 1;	/* use the current value as starting point but restart the weight decrement of the measurements */
+
+			evaluate_surface_pressure();
 		}
-		evaluate_surface_pressure();
 	}
 }