Mercurial > public > mk2
comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 579:fff1d38625f0
BUGFIX: GasVolumes should check for a gas switch before the first stop.
author | JeanDo |
---|---|
date | Tue, 24 Apr 2012 23:47:13 +0200 |
parents | a4586e115ded |
children | 32448d5ca734 |
comparison
equal
deleted
inserted
replaced
578:fbd5e2b75a63 | 579:fff1d38625f0 |
---|---|
2343 if( bottom_usage > 0.0 ) | 2343 if( bottom_usage > 0.0 ) |
2344 volumes[gas] | 2344 volumes[gas] |
2345 = (char_I_bottom_depth*0.1 + 1.0) // Use Psurface = 1.0 bar. | 2345 = (char_I_bottom_depth*0.1 + 1.0) // Use Psurface = 1.0 bar. |
2346 * char_I_bottom_time // in minutes. | 2346 * char_I_bottom_time // in minutes. |
2347 * bottom_usage; // In liter/minutes. | 2347 * bottom_usage; // In liter/minutes. |
2348 else | 2348 |
2349 volumes[gas] = 65535.0; | 2349 //---- Starts by a gas switch ? ------------------------------------------ |
2350 // If there is no special gas-switch stops inserted, then | |
2351 // we should pay attention to the gas when starting to ascent, before | |
2352 // the first stop... | |
2353 if( read_custom_function(55) == 0 ) | |
2354 { | |
2355 overlay unsigned char j; | |
2356 for(j=0; j<NUM_GAS; ++j) | |
2357 { | |
2358 if( char_O_first_deco_depth < char_I_deco_gas_change[j] ) | |
2359 if( !char_I_deco_gas_change[gas] || (char_I_deco_gas_change[gas] > char_I_deco_gas_change[j]) ) | |
2360 gas = j; | |
2361 } | |
2362 } | |
2350 | 2363 |
2351 //---- Ascent usage ------------------------------------------------------ | 2364 //---- Ascent usage ------------------------------------------------------ |
2352 | |
2353 deepest_first = read_custom_function(54) == 0; | 2365 deepest_first = read_custom_function(54) == 0; |
2354 deco_usage = (float) read_custom_function(57); // In liter/minutes. | 2366 deco_usage = (float) read_custom_function(57); // In liter/minutes. |
2355 | 2367 |
2356 // Usage up to the first stop: | 2368 // Usage up to the first stop: |
2357 // - computed at MAX depth (easier, safer), | 2369 // - computed at MAX depth (easier, safer), |
2361 if( deco_usage > 0.0 ) | 2373 if( deco_usage > 0.0 ) |
2362 volumes[gas] | 2374 volumes[gas] |
2363 += (char_I_bottom_depth*0.1 + 1.0) // Depth -> bar | 2375 += (char_I_bottom_depth*0.1 + 1.0) // Depth -> bar |
2364 * (char_I_bottom_depth - char_O_first_deco_depth) * 0.1 // ascent time (min) | 2376 * (char_I_bottom_depth - char_O_first_deco_depth) * 0.1 // ascent time (min) |
2365 * deco_usage; // Consumption ( xxx / min @ 1 bar) | 2377 * deco_usage; // Consumption ( xxx / min @ 1 bar) |
2366 else | |
2367 volumes[gas] = 65535.0; | |
2368 | 2378 |
2369 for(i=0; i<NUM_STOPS; ++i) | 2379 for(i=0; i<NUM_STOPS; ++i) |
2370 { | 2380 { |
2371 overlay unsigned char j; | 2381 overlay unsigned char j; |
2372 overlay unsigned char depth, time, ascent; | 2382 overlay unsigned char depth, time, ascent; |