changeset 321:a99073445c18

Cleanup auto setpoint switch
author JeanDo
date Thu, 05 May 2011 22:18:24 +0200
parents 08a3f503e93e
children 676d18bce8d7
files code_part1/OSTC_code_c_part2/p2_deco.c code_part1/OSTC_code_c_part2/p2_deco.o code_part1/OSTC_code_c_part2/p2_definitions.h code_part1/OSTC_code_c_part2/shared_definitions.h
diffstat 4 files changed, 7 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Thu May 05 13:06:37 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Thu May 05 22:18:24 2011 +0200
@@ -190,8 +190,6 @@
 
 static float            pres_diluent;               // new in v.101
 static float            const_ppO2;                 // new in v.101
-static float            deco_ppO2_change;           // new in v.101
-static float            deco_ppO2;                  // new in v.101
 
 static unsigned char    sim_gas_last_depth;             // Depth of last used gas, to detected a gas switch. 
 static unsigned char    sim_gas_last_used;              // Number of last used gas, to detected a gas switch. 
@@ -239,8 +237,6 @@
 static float			DBG_GF_low;				// new in v.108
 static float			DBG_GF_high;			// new in v.108
 static float			DBG_const_ppO2;			// new in v.108
-static float			DBG_deco_ppO2_change;	// new in v.108
-static float			DBG_deco_ppO2;			// new in v.108
 static float			DBG_float_saturation_multiplier;	// new in v.108
 static float			DBG_float_desaturation_multiplier;	// new in v.108
 static float			DBG_float_deco_distance;			// new in v.108
@@ -320,8 +316,6 @@
 	DBG_GF_low = GF_low;
 	DBG_GF_high = GF_high;
 	DBG_const_ppO2 = const_ppO2;
-	DBG_deco_ppO2_change = deco_ppO2_change;
-	DBG_deco_ppO2 = deco_ppO2;
 	DBG_deco_N2_ratio = char_I_deco_N2_ratio[0];
 	DBG_deco_He_ratio = char_I_deco_He_ratio[0];
 	DBG_deco_gas_change = deco_gas_change[0];
@@ -337,8 +331,6 @@
 	for(i = 16; i < 32; i++)
 		if(pres_tissue[i])
 			int_O_DBS_bitfield |= DBS_HE_sat;
-	if(deco_ppO2_change)
-		int_O_DBS_bitfield |= DBS_ppO2chg;
 	if(float_saturation_multiplier < 0.99)
 		int_O_DBS_bitfield |= DBS_SAT2l;
 	if(float_saturation_multiplier > 1.3)
@@ -429,9 +421,6 @@
 			if(pres_tissue[i])
 				temp_DBS |= DBG_HEwoHE;
 
-	if(DBG_deco_ppO2 != deco_ppO2)
-		temp_DBS |= DBG_C_DPPO2;
-
 	if( DBG_deco_gas_change != deco_gas_change[0]
 	 || DBG_deco_N2_ratio != char_I_deco_N2_ratio[0]
 	 || DBG_deco_He_ratio != char_I_deco_He_ratio[0] )
@@ -1146,10 +1135,7 @@
         // In CCR mode, use calc_XX_ratio instead of XX_ratio.
         // Note: PPO2 and ratios are known outside the lumbs, so there is no
         //       ppWater in the equations below:
-   		if( temp_deco > deco_ppO2_change )
-            deco_diluent -= const_ppO2;
-   		else
-            deco_diluent -= deco_ppO2;
+        deco_diluent -= const_ppO2;
         deco_diluent /= calc_N2_ratio + calc_He_ratio;
 
         if (deco_diluent > temp_deco)
@@ -1378,10 +1364,6 @@
     }
 
     const_ppO2 = char_I_const_ppO2 * 0.01;
-    deco_ppO2_change = char_I_deco_ppO2_change * METER_TO_BAR
-                     + pres_surface
-                     + float_deco_distance;
-    deco_ppO2 = char_I_deco_ppO2 * 0.01;
     float_desaturation_multiplier = char_I_desaturation_multiplier * 0.01;
     float_saturation_multiplier   = char_I_saturation_multiplier   * 0.01;
     GF_low   = char_I_GF_Low_percentage  * 0.01;
@@ -1404,11 +1386,13 @@
     {
   		pres_diluent -= const_ppO2;                                             // new in v.101
   		pres_diluent /= N2_ratio + He_ratio;                                    // new in v.101
+        if( pres_diluent < 0.0 )
+            pres_diluent = 0.0;
  	    if( pres_diluent > pres_respiration )                                   // new in v.101
   		    pres_diluent = pres_respiration;                                    // new in v.101
 
- 		char_O_diluent = (char)(pres_diluent/pres_respiration*100.0 + 0.5);
- 		char_O_diluent_ppO2 = (char)(pres_diluent * (1.0 - N2_ratio - He_ratio) * 100.0 + 0.5);
+ 		char_O_diluent = (unsigned char)(pres_diluent/pres_respiration*100.0 + 0.5);
+ 		char_O_diluent_ppO2 = (unsigned char)(pres_diluent * (1.0 - N2_ratio - He_ratio) * 100.0 + 0.5);
     }
 
     if( pres_diluent > ppWater )                                              // new in v.101
Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed
--- a/code_part1/OSTC_code_c_part2/p2_definitions.h	Thu May 05 13:06:37 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_definitions.h	Thu May 05 22:18:24 2011 +0200
@@ -33,7 +33,7 @@
 #define	DBG_C_SURF	0x0040
 #define	DBG_HEwoHE 	0x0080
 
-#define	DBG_C_DPPO2	0x0100
+// #define	DBG_UNUSED	0x0100
 #define	DBG_C_DGAS 	0x0200
 #define	DBG_C_DIST	0x0400
 #define	DBG_C_LAST	0x0800
@@ -46,7 +46,7 @@
 #define	DBS_mode	0x0001
 #define	DBS_ppO2	0x0002
 #define	DBS_HE_sat	0x0004
-#define	DBS_ppO2chg 0x0008
+// #define	DBS_UNUSED  0x0008
                     
 #define	DBS_SAT2l	0x0010
 #define	DBS_SAT2h	0x0020
--- a/code_part1/OSTC_code_c_part2/shared_definitions.h	Thu May 05 13:06:37 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/shared_definitions.h	Thu May 05 22:18:24 2011 +0200
@@ -135,8 +135,6 @@
 VAR_UCHAR (char_I_GF_Low_percentage);      // new in v.102
 VAR_UCHAR (char_I_deco_distance);          // 
 VAR_UCHAR (char_I_const_ppO2);             // new in v.101
-VAR_UCHAR (char_I_deco_ppO2_change);       // new in v.101
-VAR_UCHAR (char_I_deco_ppO2);              // new in v.101
 VAR_UCHAR (char_I_depth_last_deco);        // new in v.101 unit: [m]
 VAR_UCHAR (char_I_deco_model);             // new in v.102. 0 == ZH-L16, 1 = ZH-L16-GF (Grandiant facttor)
 VAR_UCHAR (char_I_bottom_depth);           // Bottom depth for planning (used in gas volume evaluation).