comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 697:53e41fa1e3f0

BUGFIX Vault low_depth too.
author JeanDo
date Wed, 06 Mar 2013 14:21:48 +0100
parents 5bf4f526f552
children 1a5804e21d3f
comparison
equal deleted inserted replaced
696:59a9402ba6dd 697:53e41fa1e3f0
83 // 2011/12/17: [mH] Remove of the useless debug stuff 83 // 2011/12/17: [mH] Remove of the useless debug stuff
84 // 2012/02/24: [jDG] Remove missed stop bug. 84 // 2012/02/24: [jDG] Remove missed stop bug.
85 // 2012/02/25: [jDG] Looking for a more stable LOW grad factor reference. 85 // 2012/02/25: [jDG] Looking for a more stable LOW grad factor reference.
86 // 2012/09/10: [mH] Fill char_O_deco_time_for_log for logbook write 86 // 2012/09/10: [mH] Fill char_O_deco_time_for_log for logbook write
87 // 2012/10/05: [jDG] Better deco_gas_volumes accuracy (average depth, switch between stop). 87 // 2012/10/05: [jDG] Better deco_gas_volumes accuracy (average depth, switch between stop).
88 // 2013/03/05: [jDG] Should vault low_depth too.
88 // 89 //
89 // TODO: 90 // TODO:
90 // + Allow to abort MD2 calculation (have to restart next time). 91 // + Allow to abort MD2 calculation (have to restart next time).
91 // 92 //
92 // Literature: 93 // Literature:
176 177
177 static unsigned char internal_deco_time[NUM_STOPS]; 178 static unsigned char internal_deco_time[NUM_STOPS];
178 static unsigned char internal_deco_depth[NUM_STOPS]; 179 static unsigned char internal_deco_depth[NUM_STOPS];
179 180
180 static float cns_vault; 181 static float cns_vault;
182 static float low_depth_vault;
181 static float pres_tissue_N2_vault[NUM_COMP]; 183 static float pres_tissue_N2_vault[NUM_COMP];
182 static float pres_tissue_He_vault[NUM_COMP]; 184 static float pres_tissue_He_vault[NUM_COMP];
183 185
184 //---- Bank 5 parameters ----------------------------------------------------- 186 //---- Bank 5 parameters -----------------------------------------------------
185 #ifndef UNIX 187 #ifndef UNIX
1053 calc_gradient_factor(); 1055 calc_gradient_factor();
1054 1056
1055 // toggle between calculation for nullzeit (bottom time), 1057 // toggle between calculation for nullzeit (bottom time),
1056 // deco stops 1058 // deco stops
1057 // and more deco stops (continue) 1059 // and more deco stops (continue)
1058 switch( char_O_deco_status ) 1060 switch( char_O_deco_status )
1059 { 1061 {
1060 case 3: //---- At surface: start a new dive ------------------------------ 1062 case 3: //---- At surface: start a new dive ------------------------------
1061 clear_deco_table(); 1063 clear_deco_table();
1062 copy_deco_table(); 1064 copy_deco_table();
1063 int_O_ascenttime = 0; // Reset DTR. 1065 int_O_ascenttime = 0; // Reset DTR.
2491 { 2493 {
2492 overlay unsigned char x; 2494 overlay unsigned char x;
2493 RESET_C_STACK 2495 RESET_C_STACK
2494 2496
2495 cns_vault = CNS_fraction; 2497 cns_vault = CNS_fraction;
2498 low_depth_vault = low_depth;
2499
2496 for (x=0;x<NUM_COMP;x++) 2500 for (x=0;x<NUM_COMP;x++)
2497 { 2501 {
2498 pres_tissue_N2_vault[x] = pres_tissue_N2[x]; 2502 pres_tissue_N2_vault[x] = pres_tissue_N2[x];
2499 pres_tissue_He_vault[x] = pres_tissue_He[x]; 2503 pres_tissue_He_vault[x] = pres_tissue_He[x];
2500 } 2504 }
2512 } 2516 }
2513 2517
2514 // Restore both CNS variable, too. 2518 // Restore both CNS variable, too.
2515 CNS_fraction = cns_vault; 2519 CNS_fraction = cns_vault;
2516 char_O_CNS_fraction = (unsigned char)(CNS_fraction * 100.0 + 0.5); 2520 char_O_CNS_fraction = (unsigned char)(CNS_fraction * 100.0 + 0.5);
2521
2522 // GF history too:
2523 low_depth = low_depth_vault;
2524 locked_GF_step = GF_delta / low_depth;
2517 } 2525 }
2518 2526
2519 ////////////////////////////////////////////////////////////////////////////// 2527 //////////////////////////////////////////////////////////////////////////////
2520 // 2528 //
2521 #ifndef CROSS_COMPILE 2529 #ifndef CROSS_COMPILE