diff Discovery/Src/vpm.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 5e0bb91d4a12
children bfcea6e2ab3f
line wrap: on
line diff
--- a/Discovery/Src/vpm.c	Thu May 02 08:43:07 2019 +0200
+++ b/Discovery/Src/vpm.c	Thu May 02 09:16:07 2019 +0200
@@ -2278,6 +2278,8 @@
 //	vpm_calc_nullzeit
 //     Purpose: This function calcs zero time (time where no decostops are needed)
 //===============================================================================
+#define MAX_NDL	240
+
 static int vpm_calc_nullzeit(void)
 {
     static float future_helium_pressure[16];
@@ -2295,8 +2297,7 @@
     int i = 0;
     int count = 0;
     int status = CALC_END;
-    //if(begin)
-    //{
+
         for(i = 0; i < 16;i++)
         {
             future_helium_pressure[i] =  pInput->tissue_helium_bar[i] * 10;//tissue_He_saturation[st_dive][i] * 10;
@@ -2306,22 +2307,16 @@
 
         mix_number = 0;
         ambient_pressure = pInput->pressure_ambient_bar  * 10;
-//		 fraction_helium_begin;
-//		 fraction_nitrogen_begin;
         decom_get_inert_gases( ambient_pressure / 10,  (&pDiveSettings->decogaslist[mix_number]) , &fraction_nitrogen_begin, &fraction_helium_begin );
         inspired_helium_pressure =(ambient_pressure - WATER_VAPOR_PRESSURE) * fraction_helium_begin;
         inspired_nitrogen_pressure =(ambient_pressure - WATER_VAPOR_PRESSURE) *fraction_nitrogen_begin;
 
-        //if(!nullzeit_unter60)
-        //{
             status = CALC_END;
             while (status == CALC_END)
             {
                 count++;
-                //if(count == 7)
-                    //return CALC_NULLZEIT2;
                 temp_segment_time  +=  60;
-                if(temp_segment_time >= 300)
+                if(temp_segment_time >= MAX_NDL)
                 {
                     pDecoInfo->output_ndl_seconds = temp_segment_time * 60;
                     return CALC_NULLZEIT;
@@ -2348,10 +2343,6 @@
                 future_helium_pressure[i - 1] = previous_helium_pressure[i-1];
                 future_nitrogen_pressure[i - 1] = previous_nitrogen_pressure[i - 1];
             }
-        //}
-    //}
-    //if(!nullzeit_unter60 || begin ||  temp_segment_time > 10)
-    //{
 
         status = CALC_END;
         if(temp_segment_time < 60)
@@ -2359,11 +2350,8 @@
 
         while (status == CALC_END)
         {
-        //	count++;
-            //if(count >= 5)
-                //return CALC_NULLZEIT2;
             temp_segment_time  +=  5;
-            if(temp_segment_time >= 300)
+            if(temp_segment_time >= MAX_NDL)
             {
                 pDecoInfo->output_ndl_seconds = temp_segment_time * 60;
                 return CALC_NULLZEIT;
@@ -2371,7 +2359,6 @@
             if(nullzeit_unter60 && temp_segment_time > 60)
             {
                 nullzeit_unter60 = false;
-                //tts[NULLZEIT] = temp_segment_time * 60;
                 return CALC_NULLZEIT;
             }
             run_time += 5;
@@ -2394,19 +2381,11 @@
             future_nitrogen_pressure[i - 1] = previous_nitrogen_pressure[i - 1];
         }
         status = CALC_END;
-        //if(temp_segment_time < 5)
-            //count = 2;
-    //}
-    //else
-        //count = 1;
+
     if(temp_segment_time <= 20)
     {
         while (status == CALC_END)
         {
-            //time_counter = temp_segment_time;
-            //count++;
-            //if(count > 2)
-                //return CALC_NULLZEIT2;
             temp_segment_time  +=  minimum_deco_stop_time;
             run_time += minimum_deco_stop_time;
             //goto L700;