# HG changeset patch # User JeanDo # Date 1318880388 -7200 # Node ID 7c48692dd17c76ff2fe15169e1bdbeae32a2f459 # Parent 4c93c2154f1896fb644f726547c17bcecba5d4a3 BUGFIX Missed surface pressure for CNS in decoplan. diff -r 4c93c2154f18 -r 7c48692dd17c code_part1/OSTC_code_asm_part1/changelog.txt --- a/code_part1/OSTC_code_asm_part1/changelog.txt Sun Oct 16 13:37:14 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Mon Oct 17 21:39:48 2011 +0200 @@ -1,3 +1,7 @@ +New in 2.04 beta: +BETA Version - Do NOT use for diving! +BUGFIX: Missed surface pressure for CNS in decoplan + New in 2.03 beta: BETA Version - Do NOT use for diving! BUGFIX: Logbook write diff -r 4c93c2154f18 -r 7c48692dd17c code_part1/OSTC_code_c_part2/p2_deco.c --- a/code_part1/OSTC_code_c_part2/p2_deco.c Sun Oct 16 13:37:14 2011 +0200 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Mon Oct 17 21:39:48 2011 +0200 @@ -518,11 +518,16 @@ ////////////////////////////////////////////////////////////////////////////// // Read CF values from the C code. +#ifdef CROSS_COMPILE +// Full description of the OSTC EEPROM map, including CF values. +# include "OSTC_eeprom.h" +#endif + static short read_custom_function(PARAMETER unsigned char cf) { #ifdef CROSS_COMPILE - extern unsigned short custom_functions[]; - return custom_functions[cf]; + return (cf & 32) ? eeprom.bank1_CF[cf-32].value + : eeprom.bank0_CF[cf ].value; #else extern unsigned char hi, lo; extern void getcustom15(); @@ -2384,8 +2389,15 @@ ////////////////////////////////////////////////////////////////////////////// // deco_calc_CNS_planning // -// Input: -// Output: +// Compute CNS during predicetd ascent. +// +// Note: Needs a call to deco_push_tissues_to_vault(), +// deco_pull_tissues_from_vault() to avoid trashing everything... +// +// Input: CNS_fraction, char_O_deco_time[], char_O_deco_depth[] +// Output: CNS_fraction, char_O_CNS_fraction +// Trashed: char_I_actual_ppO2 +// void deco_calc_CNS_planning(void) { RESET_C_STACK @@ -2415,7 +2427,7 @@ //---- Ascent to surface delay // NOTE: count as if time is spent with bottom pressure, // AND the bottom gas - actual_ppO2 = (char_I_bottom_depth * METER_TO_BAR - ppWater) + actual_ppO2 = (pres_surface + char_I_bottom_depth * METER_TO_BAR - ppWater) * (1.0 - calc_N2_ratio - calc_He_ratio); if( actual_ppO2 < 0.0 ) actual_ppO2 = 0.0; if( actual_ppO2 > 2.50 ) actual_ppO2 = 2.55; @@ -2440,7 +2452,7 @@ gas_switch_deepest(); //---- Convert Depth and N2_ratio to ppO2 - actual_ppO2 = (temp_depth_limit * METER_TO_BAR - ppWater) + actual_ppO2 = (pres_surface + temp_depth_limit * METER_TO_BAR - ppWater) * (1.0 - calc_N2_ratio - calc_He_ratio); if( actual_ppO2 < 0.0 ) actual_ppO2 = 0.0; if( actual_ppO2 > 2.50 ) actual_ppO2 = 2.55; @@ -2450,7 +2462,10 @@ for(t=0; t