diff Common/Src/decom.c @ 129:239aa58b533d FlipDisplay

Added function to initialise structures with the actual ambient pressure
author Ideenmodellierer
date Sun, 17 Feb 2019 21:14:09 +0100
parents e941c9e49f73
children 1b995079c045
line wrap: on
line diff
--- a/Common/Src/decom.c	Sun Feb 17 21:12:22 2019 +0100
+++ b/Common/Src/decom.c	Sun Feb 17 21:14:09 2019 +0100
@@ -406,6 +406,24 @@
 	pLifeData->no_fly_time_minutes = 0;
 }
 
+void decom_reset_with_ambientmbar(float ambient, SLifeData * pLifeData)
+{
+
+	float saturation = 1.0;
+	saturation = ambient;
+	saturation -= WATER_VAPOUR_PRESSURE;
+	saturation *= FRACTION_N2_AIR;
+
+	for(int i=0;i<16;i++)
+	{
+		pLifeData->tissue_nitrogen_bar[i] = saturation;
+		pLifeData->tissue_helium_bar[i] = 0;
+	}
+	pLifeData->otu = 0;
+	pLifeData->cns = 0;
+	pLifeData->desaturation_time_minutes = 0;
+	pLifeData->no_fly_time_minutes = 0;
+}
 
 /* =============================================================================== */
 /*     NOTE ABOUT PRESSURE UNITS USED IN CALCULATIONS: */