# HG changeset patch # User JeanDo # Date 1351814229 -3600 # Node ID 75dc320f46817e1f82331e5876fc16c0656628cc # Parent 8dd730d3a5d734529c0fd3750e7242653f0b7d4f BUGFIX Gas volumes when many tanks and stops. diff -r 8dd730d3a5d7 -r 75dc320f4681 code_part1/OSTC_code_c_part2/p2_deco.c --- a/code_part1/OSTC_code_c_part2/p2_deco.c Thu Nov 01 20:36:19 2012 +0100 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Fri Nov 02 00:57:09 2012 +0100 @@ -2397,8 +2397,7 @@ for(i=0; i char_I_deco_gas_change[j]) ) + overlay unsigned char newGas = 0; + overlay unsigned char newStop = 0; // NO CHANGE yet + overlay unsigned char j; + + for(j=0; j= newStop ) + { + newGas = j; + newStop = char_I_deco_gas_change[j]; + } } - } + } - // usage BEFORE gas switch (if any), at 10m/min : - if( deco_usage > 0.0 && depth > newStop ) - // Plus usage during ascent to the next stop, at 10m/min. - volumes[gas] += ((depth+newStop)*0.05 + 1.0) // average depth --> bar. - * (depth-newStop)*0.1 // metre --> min - * deco_usage; + if( newStop ) // Did we find something ? + { + // usage BEFORE gas switch (if any), at 10m/min : + if( deco_usage > 0.0 && depth > newStop ) + // Plus usage during ascent to the next stop, at 10m/min. + volumes[gas] += ((depth+newStop)*0.05 + 1.0) // average depth --> bar. + * (depth-newStop)*0.1 // metre --> min + * deco_usage; - // Do gas switch: - gas = newGas; - depth = newStop; + // Do gas switch: + gas = newGas; + depth = newStop; + } + } // usage AFTER gas switch (if any), at 10m/min : if( depth > newDepth )