# HG changeset patch # User JeanDo # Date 1326149178 -3600 # Node ID 9e838e0b374911fa576c712a80d2a012e9c8663a # Parent a587f491693d0c9cdb44b417439bf09f89d355a1 BUGFIX decoplan: missing gas changes in CNS prediction, when CF55 = 0 diff -r a587f491693d -r 9e838e0b3749 code_part1/OSTC_code_c_part2/p2_deco.c --- a/code_part1/OSTC_code_c_part2/p2_deco.c Sun Jan 08 18:52:19 2012 +0100 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Mon Jan 09 23:46:18 2012 +0100 @@ -866,17 +866,11 @@ sim_gas_last_depth = switch_deco; sim_gas_last_used = switch_last; - sim_gas_delay = read_custom_function(55); + sim_gas_delay = read_custom_function(55) + + sim_dive_mins; + temp_depth_limit = switch_deco; - // Apply depth correction ONLY if CF#55 is not null: - if( sim_gas_delay > 0 ) - { - sim_gas_delay += sim_dive_mins; - temp_depth_limit = switch_deco; - return 1; - } - - return 0; + return 1; } sim_gas_delay = 0; @@ -1720,7 +1714,7 @@ if( internal_deco_depth[x] == 0 ) { internal_deco_depth[x] = temp_depth_limit; - if( sim_gas_delay > sim_dive_mins ) + if( sim_gas_delay >= sim_dive_mins ) internal_deco_depth[x] |= 0x80; internal_deco_time[x] = 1; @@ -2241,7 +2235,8 @@ //---- Gas Switch ? if( char_O_deco_depth[i] & 0x80 ) - gas_switch_deepest(); + if( gas_switch_deepest() ) + gas_switch_set(); //---- Convert Depth and N2_ratio to ppO2 actual_ppO2 = (pres_surface + temp_depth_limit * METER_TO_BAR - ppWater)