Mercurial > public > mk2
comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 540:9e838e0b3749
BUGFIX decoplan: missing gas changes in CNS prediction, when CF55 = 0
author | JeanDo |
---|---|
date | Mon, 09 Jan 2012 23:46:18 +0100 |
parents | ba1fb2e23f46 |
children | 6626a6c4eda3 |
comparison
equal
deleted
inserted
replaced
539:a587f491693d | 540:9e838e0b3749 |
---|---|
864 // Should restart gas-switch delay only when gas do changes... | 864 // Should restart gas-switch delay only when gas do changes... |
865 assert( sim_gas_delay <= sim_dive_mins ); | 865 assert( sim_gas_delay <= sim_dive_mins ); |
866 | 866 |
867 sim_gas_last_depth = switch_deco; | 867 sim_gas_last_depth = switch_deco; |
868 sim_gas_last_used = switch_last; | 868 sim_gas_last_used = switch_last; |
869 sim_gas_delay = read_custom_function(55); | 869 sim_gas_delay = read_custom_function(55) |
870 | 870 + sim_dive_mins; |
871 // Apply depth correction ONLY if CF#55 is not null: | 871 temp_depth_limit = switch_deco; |
872 if( sim_gas_delay > 0 ) | 872 |
873 { | 873 return 1; |
874 sim_gas_delay += sim_dive_mins; | |
875 temp_depth_limit = switch_deco; | |
876 return 1; | |
877 } | |
878 | |
879 return 0; | |
880 } | 874 } |
881 | 875 |
882 sim_gas_delay = 0; | 876 sim_gas_delay = 0; |
883 return 0; | 877 return 0; |
884 } | 878 } |
1718 } | 1712 } |
1719 | 1713 |
1720 if( internal_deco_depth[x] == 0 ) | 1714 if( internal_deco_depth[x] == 0 ) |
1721 { | 1715 { |
1722 internal_deco_depth[x] = temp_depth_limit; | 1716 internal_deco_depth[x] = temp_depth_limit; |
1723 if( sim_gas_delay > sim_dive_mins ) | 1717 if( sim_gas_delay >= sim_dive_mins ) |
1724 internal_deco_depth[x] |= 0x80; | 1718 internal_deco_depth[x] |= 0x80; |
1725 | 1719 |
1726 internal_deco_time[x] = 1; | 1720 internal_deco_time[x] = 1; |
1727 return 1; | 1721 return 1; |
1728 } | 1722 } |
2239 temp_depth_limit = char_O_deco_depth[i] & 0x7F; | 2233 temp_depth_limit = char_O_deco_depth[i] & 0x7F; |
2240 if( time == 0 ) break; // End of table: done. | 2234 if( time == 0 ) break; // End of table: done. |
2241 | 2235 |
2242 //---- Gas Switch ? | 2236 //---- Gas Switch ? |
2243 if( char_O_deco_depth[i] & 0x80 ) | 2237 if( char_O_deco_depth[i] & 0x80 ) |
2244 gas_switch_deepest(); | 2238 if( gas_switch_deepest() ) |
2239 gas_switch_set(); | |
2245 | 2240 |
2246 //---- Convert Depth and N2_ratio to ppO2 | 2241 //---- Convert Depth and N2_ratio to ppO2 |
2247 actual_ppO2 = (pres_surface + temp_depth_limit * METER_TO_BAR - ppWater) | 2242 actual_ppO2 = (pres_surface + temp_depth_limit * METER_TO_BAR - ppWater) |
2248 * (1.0 - calc_N2_ratio - calc_He_ratio); | 2243 * (1.0 - calc_N2_ratio - calc_He_ratio); |
2249 if( actual_ppO2 < 0.0 ) actual_ppO2 = 0.0; | 2244 if( actual_ppO2 < 0.0 ) actual_ppO2 = 0.0; |