diff Discovery/Src/buehlmann.c @ 291:24ff72e627f4 div-fixes-6

Deco Models: limit NDL to 240 minutes Limit the deco models to report up to 240 minutes of NDL. This was triggered by commit 54d14bc2083c. The logbook uses a 8bit UINT, so storing a value of 300 is impossible (which was taken care of in that commit). But, as the small OSTCs also use 240 min. as maximum NDL, we better do that here too (from a consistency point of view). And while we are at it ... kick out some commented and useless code. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author Jan Mulder <jlmulder@xs4all.nl>
date Thu, 02 May 2019 09:16:07 +0200
parents cc2406b835ff
children 305f251cc981
line wrap: on
line diff
--- a/Discovery/Src/buehlmann.c	Thu May 02 08:43:07 2019 +0200
+++ b/Discovery/Src/buehlmann.c	Thu May 02 09:16:07 2019 +0200
@@ -517,7 +517,7 @@
 	return (pDiveSettings->gf_high - gfSteigung * (pressure - gSurface_pressure_bar) )/ 100.0f;
 }
 
-
+#define MAX_NDL 240
 static int buehlmann_calc_ndl(SDiveSettings *pDiveSettings)
 {
 	float local_tissue_nitrogen_bar[16];
@@ -528,7 +528,7 @@
 	//Check ndl always use gHigh
 	gGF_value = ((float)pDiveSettings->gf_high) / 100.0f;
 	//10 minutes steps
-	while(ndl < (300 * 60))
+	while(ndl < (MAX_NDL * 60))
 	{
 		memcpy(local_tissue_nitrogen_bar, gTissue_nitrogen_bar, (4*16));
 		memcpy(local_tissue_helium_bar, gTissue_helium_bar, (4*16));
@@ -545,10 +545,10 @@
 		buehlmann_backup_and_restore(false);
 	}
 
-	if(ndl < (300 * 60))
+	if(ndl < (MAX_NDL * 60))
 		ndl -= 600;
 
-	if(ndl > (150 * 60))
+	if(ndl > (MAX_NDL/2 * 60))
 		return ndl;
 
 	// refine
@@ -559,7 +559,6 @@
 	for(i = 0; i < 10; i++)
 	{
 		ndl += 60;
-		//tissues_exposure_at_gPressure_seconds(60);
 		decom_tissues_exposure2(60, &pDiveSettings->decogaslist[gGas_id], gPressure,gTissue_nitrogen_bar,gTissue_helium_bar);
 		decom_oxygen_calculate_cns_exposure(60,&pDiveSettings->decogaslist[gGas_id],gPressure,&gCNS);
 		buehlmann_backup_and_restore(true);