changeset 757:50ed645c251d

CHANGE: save gas used during deco
author jDG
date Sun, 03 Nov 2013 13:37:04 +0100
parents a98365da41d3
children 3096294bb06e
files code_part1/OSTC_code_asm_part1/shared_definitions.h code_part1/OSTC_code_c_part2/p2_deco.c
diffstat 2 files changed, 16 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/shared_definitions.h	Wed Oct 30 14:46:26 2013 +0100
+++ b/code_part1/OSTC_code_asm_part1/shared_definitions.h	Sun Nov 03 13:37:04 2013 +0100
@@ -113,6 +113,7 @@
 VAR_UCHAR (char_O_first_deco_time) ;        // Duration of first stop.
 TAB_UCHAR (char_O_deco_depth, NUM_STOPS);   // Fusionned decompression table:
 TAB_UCHAR (char_O_deco_time,  NUM_STOPS);   // Both ZH-L16 and L16-GF models.
+TAB_UCHAR (char_O_deco_gas,   NUM_STOPS);   // Both ZH-L16 and L16-GF models.
 TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS); // For logging the full decoplan
 
 TAB_UCHAR (char_O_tissue_N2_saturation, NUM_COMP); // Nitrogen compartiment desaturation time, in min.
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Wed Oct 30 14:46:26 2013 +0100
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Sun Nov 03 13:37:04 2013 +0100
@@ -171,15 +171,9 @@
 static unsigned char    temp_depth_limit;
 float                   low_depth;                  // Depth of deepest stop
 
-// Simulation context: used to predict ascent.
-unsigned char           sim_lead_tissue_no;         // Leading compatiment number.
-float	                sim_lead_tissue_limit;      // Buhlmann tolerated pressure.
-
-// Real context: what we are doing now.
-static float			calc_lead_tissue_limit;     //
-
-static unsigned char	internal_deco_time[NUM_STOPS];
+static unsigned char	internal_deco_time [NUM_STOPS];
 static unsigned char	internal_deco_depth[NUM_STOPS];
+static unsigned char	internal_deco_gas  [NUM_STOPS];
 
 static float cns_vault;
 static float low_depth_vault;
@@ -224,6 +218,13 @@
 
 static unsigned char    deco_gas_change[NUM_GAS];       // new in v.109
 
+// Simulation context: used to predict ascent.
+unsigned char           sim_lead_tissue_no;         // Leading compatiment number.
+float	                sim_lead_tissue_limit;      // Buhlmann tolerated pressure.
+
+// Real context: what we are doing now.
+static float			calc_lead_tissue_limit;     //
+
 //---- Bank 6 parameters -----------------------------------------------------
 #ifndef UNIX
 #   pragma udata bank6=0x600
@@ -685,6 +686,7 @@
             char_O_deco_depth[y] = internal_deco_depth[x];
             char_O_deco_time_for_log[y] = internal_deco_time [x];
             char_O_deco_time [y] = internal_deco_time [x];
+            char_O_deco_gas  [y] = internal_deco_gas  [x];
 
             // Stop only once the last transfer is done.
             if( x == 0 ) break;
@@ -696,6 +698,7 @@
             char_O_deco_time [y] = 0;
             char_O_deco_depth[y] = 0;
             char_O_deco_time_for_log[y] = 0;
+            char_O_deco_gas  [y] = 0;
         }
     }
     else //---- Straight copy ------------------------------------------------
@@ -706,6 +709,7 @@
         {
             char_O_deco_depth[x] = internal_deco_depth[x];
             char_O_deco_time [x] = internal_deco_time [x];
+            char_O_deco_gas  [x] = internal_deco_gas  [x];
         }
 
         //Now fill the char_O_deco_time_for_log array
@@ -727,7 +731,6 @@
         {
             char_O_deco_time_for_log [y] = 0;
         }
-
     }
 }
 
@@ -1250,13 +1253,13 @@
             break;
 
            if( calc_nextdecodepth() )
-            {
+           {
                 if( temp_depth_limit == 0 )
                     goto Surface;
 
                 //---- We hit a stop at temp_depth_limit ---------------------
                 temp_deco = temp_depth_limit * METER_TO_BAR // Convert to relative bar,
-                              + pres_surface;                   // To absolute.
+                          + pres_surface;                   // To absolute.
                 if( !update_deco_table() )                  // Adds a one minute stops.
                     goto Surface;                           // Deco table full: abort...
             }
@@ -1725,6 +1728,7 @@
             internal_deco_depth[x] = temp_depth_limit;
 
             internal_deco_time[x]  = 1;
+            internal_deco_gas[x] = sim_gas_last_used;
             return 1;
         }
     }