comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 388:681bdc91114c 64kByte Logbook

BUGFIX Gas switch number.
author JeanDo
date Sun, 19 Jun 2011 00:07:31 +0200
parents de3b267e1fd9
children b9cf06de8aca
comparison
equal deleted inserted replaced
387:106b95a33244 388:681bdc91114c
987 // 987 //
988 static void gas_switch_find_current(void) 988 static void gas_switch_find_current(void)
989 { 989 {
990 assert( 0 <= char_I_current_gas && char_I_current_gas <= (NUM_GAS+1) ); 990 assert( 0 <= char_I_current_gas && char_I_current_gas <= (NUM_GAS+1) );
991 991
992 if( (char_I_current_gas <= NUM_GAS) // Gas6 == manual set. 992 if( char_I_current_gas <= NUM_GAS ) // Gas1..Gas5
993 && char_I_deco_gas_change[char_I_current_gas-1] 993 {
994 ) 994 sim_gas_last_used = char_I_current_gas;
995 { 995
996 sim_gas_last_used = char_I_current_gas-1; 996 // Note: if current is first gas, we must find it, but not set
997 sim_gas_last_depth = char_I_deco_gas_change[sim_gas_last_used]; 997 // last depth change to surface.
998 // temp_depth_limit = ??? 998 if( char_I_deco_gas_change[sim_gas_last_used-1] )
999 } 999 sim_gas_last_depth = char_I_deco_gas_change[sim_gas_last_used-1];
1000 }
1001 else
1002 sim_gas_last_used = 0; // Gas 6 = manual set
1000 } 1003 }
1001 1004
1002 ////////////////////////////////////////////////////////////////////////////// 1005 //////////////////////////////////////////////////////////////////////////////
1003 // Find deepest available gas. 1006 // Find deepest available gas.
1004 // 1007 //
1036 1039
1037 // First, or deeper ? 1040 // First, or deeper ?
1038 if( switch_deco < deco_gas_change[j] ) 1041 if( switch_deco < deco_gas_change[j] )
1039 { 1042 {
1040 switch_deco = deco_gas_change[j]; 1043 switch_deco = deco_gas_change[j];
1041 switch_last = j+1; 1044 switch_last = j+1; // 1..5
1042 } 1045 }
1043 } 1046 }
1044 } 1047 }
1045 1048
1046 // If there is a better gas available 1049 // If there is a better gas available
1081 // 1084 //
1082 static void gas_switch_set(void) 1085 static void gas_switch_set(void)
1083 { 1086 {
1084 assert( 0 <= sim_gas_last_used && sim_gas_last_used <= NUM_GAS ); 1087 assert( 0 <= sim_gas_last_used && sim_gas_last_used <= NUM_GAS );
1085 1088
1086 if( sim_gas_last_used == 0 ) 1089 if( sim_gas_last_used == 0 ) // Gas6 = manualy set gas.
1087 { 1090 {
1088 calc_N2_ratio = N2_ratio; 1091 calc_N2_ratio = N2_ratio;
1089 calc_He_ratio = He_ratio; 1092 calc_He_ratio = He_ratio;
1090 } 1093 }
1091 else 1094 else