# HG changeset patch # User jdg@air # Date 1432860043 -7200 # Node ID 08986d479b94c647e69ebd6434e4250094bcfc68 # Parent f342853afcd9b0d36aa659c5a218ba5ccf9266a1 FIX gas_volume shall read gas switches from char_O_deco_gas diff -r f342853afcd9 -r 08986d479b94 src/Tests/deco_volume_test.cpp --- a/src/Tests/deco_volume_test.cpp Fri May 29 02:24:03 2015 +0200 +++ b/src/Tests/deco_volume_test.cpp Fri May 29 02:40:43 2015 +0200 @@ -4,7 +4,7 @@ /// Copyright (c) 2015, JD Gascuel, HeinrichsWeikamp, all right reserved. ////////////////////////////////////////////////////////////////////////////// // HISTORY -// 2015-05-27 jDG: Creation for gas volum re-introduction in hwOS 1.80 +// 2015-05-27 jDG: Creation for gas volum re-introduction in hwOS 1.82 extern "C" { # include "p2_deco.c" diff -r f342853afcd9 -r 08986d479b94 src/p2_deco.c --- a/src/p2_deco.c Fri May 29 02:24:03 2015 +0200 +++ b/src/p2_deco.c Fri May 29 02:40:43 2015 +0200 @@ -2165,7 +2165,6 @@ overlay float bottom_usage, deco_usage; overlay unsigned char i; overlay unsigned char gas, depth; - overlay unsigned char lastGasStop = 255; RESET_C_STACK //---- initialize with bottom consumption -------------------------------- @@ -2189,65 +2188,24 @@ for(i=0; i= newStop ) - { - newGas = j; - newStop = char_I_deco_gas_change[j]; - } - } - } + //---- usage BEFORE gas switch (if any), at 10m/min ------------------ + volumes[gas] += ((depth+newDepth)*0.05 + 1.0) // average depth --> bar. + * (depth-newDepth)*0.1 // metre --> min + * deco_usage; - // Did we find something ? - if( !newStop ) - break; - - //---- 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; - - lastGasStop = newStop; // Mark last used gas - if( newStop < depth ) // ascent to gas switch, - depth = newStop; - } - - //---- usage AFTER gas switch (if any), at 10m/min : - if( depth > newDepth ) - volumes[gas] += ((depth+newDepth)*0.05 + 1.0) // average depth --> bar. - * (depth-newDepth)*0.1 // metre --> min - * deco_usage; - - //---- Do stop: + //---- Do gas switch, at new depth + gas = newGas; depth = newDepth; // Usage at stop: