# HG changeset patch # User JeanDo # Date 1295913755 -3600 # Node ID 494587193f5d8fa8eb87be333c62348598e65854 # Parent cb055a7d75f3bdb8aac52879c15cf3bad83929c7 Use 16bits for TTS sum. + Display in divemode as 16bits. + Display in decoplanning as 16bits. diff -r cb055a7d75f3 -r 494587193f5d code_part1/OSTC_code_asm_part1/pled_outputs.asm --- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Mon Jan 24 23:31:57 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Tue Jan 25 01:02:35 2011 +0100 @@ -470,17 +470,16 @@ ostc_debug 'x' ; Sends debug-information to screen if debugmode active WIN_TOP .136 - WIN_LEFT .119 + WIN_LEFT .140 - 6*7 - 4 ; let space for sign + 5 digits + ' WIN_FONT FT_MEDIUM - WIN_INVERT .0 ; Init new Wordprocessor + WIN_INVERT .0 ; Init new Wordprocessor + call PLED_standard_color lfsr FSR2,letter - movff char_O_ascenttime,lo ; complete ascend time - movlw d'199' ; limit display of total ascend time to 99mins.... - cpfslt lo ; skip if 199 (WREG) > lo - movwf lo - bcf leftbind - output_8 + movff int_O_ascenttime+0,lo ; complete ascend time + movff int_O_ascenttime+1,hi ; on 16bits + bcf leftbind + output_16 STRCAT_PRINT "'" PLED_display_deko1: diff -r cb055a7d75f3 -r 494587193f5d code_part1/OSTC_code_asm_part1/simulator.asm --- a/code_part1/OSTC_code_asm_part1/simulator.asm Mon Jan 24 23:31:57 2011 +0100 +++ b/code_part1/OSTC_code_asm_part1/simulator.asm Tue Jan 25 01:02:35 2011 +0100 @@ -159,8 +159,10 @@ call divemenu_see_decoplan ; Display TTS, if any... - movff char_O_ascenttime,WREG - iorwf WREG + movff int_O_ascenttime+0,lo + movff int_O_ascenttime+1,hi + movf lo,W + iorwf hi,W bz simulator_decoplan_notts WIN_LEFT .0 @@ -168,9 +170,8 @@ call PLED_standard_color STRCPY "TTS: " - movff char_O_ascenttime,lo bcf leftbind - output_8 + output_16 STRCAT_PRINT "'" simulator_decoplan_notts: diff -r cb055a7d75f3 -r 494587193f5d code_part1/OSTC_code_c_part2/p2_deco.c --- a/code_part1/OSTC_code_c_part2/p2_deco.c Mon Jan 24 23:31:57 2011 +0100 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Tue Jan 25 01:02:35 2011 +0100 @@ -65,9 +65,9 @@ // 12/25/10 v110: split in three files (deco.c, main.c, definitions.h) // 2011/01/20: [jDG] Create a common file included in ASM and C code. // 2011/01/23: [jDG] Added read_custom_function(). +// + Make int_O_ascenttime an int. // // TODO: -// + Make char_O_ascenttime an int. // + Fusion deco array for both models. // + Allow (CF) revesring stop order (while copying). // + Allow (CF) delay for gas switch while predicting ascent. @@ -143,7 +143,6 @@ static float temp_pres_gtissue_limit_GF_low; static float temp_pres_gtissue_limit_GF_low_below_surface; static unsigned int temp_depth_limit; -static unsigned char temp_decotime; static unsigned char temp_gtissue_no; static unsigned int temp_depth_last_deco; // new in v.101 @@ -936,7 +935,7 @@ clear_decoarray(); char_O_deco_status = 0; char_O_nullzeit = 0; - char_O_ascenttime = 0; + int_O_ascenttime = 0; char_O_gradient_factor = 0; char_O_relative_gradient_GF = 0; } @@ -964,7 +963,7 @@ clear_decoarray(); char_O_deco_status = 0; char_O_nullzeit = 0; - char_O_ascenttime = 0; + int_O_ascenttime = 0; calc_gradient_factor(); } @@ -1259,7 +1258,6 @@ } sim_tissue_1min(); update_internal_deco_table_GF(); - temp_decotime = 1; update_decoarray(); char_O_deco_status = char_O_deco_status + 1; if (char_O_deco_status < 16) @@ -1267,7 +1265,7 @@ } else // if (temp_depth_limit > 0) { - char_O_deco_status = 0; + char_O_deco_status = 0; } } while (int_temp_decostatus == 1); @@ -1339,12 +1337,12 @@ } else // new in v.101 { - if (temp_deco > deco_ppO2_change) - deco_diluent = ((temp_deco - const_ppO2)/(N2_ratio + He_ratio)); // new in v.101 // calculate at half of the ascent - else - deco_diluent = ((temp_deco - deco_ppO2)/(N2_ratio + He_ratio)); // new in v.101 // calculate at half of the ascent - if (deco_diluent > (temp_deco)) // new in v.101 - deco_diluent = temp_deco; // new in v.101 // calculate at half of the ascent + if (temp_deco > deco_ppO2_change) + deco_diluent = ((temp_deco - const_ppO2)/(N2_ratio + He_ratio)); // new in v.101 // calculate at half of the ascent + else + deco_diluent = ((temp_deco - deco_ppO2)/(N2_ratio + He_ratio)); // new in v.101 // calculate at half of the ascent + if (deco_diluent > (temp_deco)) // new in v.101 + deco_diluent = temp_deco; // new in v.101 // calculate at half of the ascent } temp_deco -= 0.5; if (deco_diluent > 0.0627) // new in v.101 @@ -1506,35 +1504,37 @@ switch (char_O_deco_status) { case 2: - char_O_ascenttime = 255; + int_O_ascenttime = -1; break; case 1: break; default: { - overlay unsigned char x; - overlay float ascent = pres_respiration - pres_surface + 0.6; // + 0.6 hence 1 minute ascent time from a depth of 4 meter on - + // + 0.6 to count 1 minute ascent time from 4 meter to surface + overlay float ascent = pres_respiration - pres_surface + 0.6; if (ascent < 0.0) ascent = 0.0; - if (ascent > 255.0) - ascent = 255.0; - char_O_ascenttime = (char)ascent; - - for(x=0; x<7; x++) + int_O_ascenttime = (unsigned int)ascent; + + if( char_I_deco_model == 0 ) //---- ZH-L16 model { - overlay int int_ascent = (int)char_O_ascenttime + (int)char_O_array_decotime[x]; - if(int_ascent >= 255) - char_O_ascenttime = 255; - else - char_O_ascenttime = int_ascent; + overlay unsigned char x; + for(x=0; x<7; x++) + int_O_ascenttime += (unsigned int)char_O_array_decotime[x]; } + else //---------------------------- ZH-L16-GF model + { + overlay unsigned char x; + for(x=0; x<32; x++) + int_O_ascenttime += (unsigned int)internal_deco_table[x]; + } + break; } } } else - char_O_ascenttime = 0; + int_O_ascenttime = 0; } ////////////////////////////////////////////////////////////////////////////// @@ -1661,7 +1661,7 @@ { if (char_O_array_decodepth[x] == temp_depth_limit) { - stop_time = char_O_array_decotime[x] + temp_decotime; + stop_time = char_O_array_decotime[x] + 1; if (stop_time < 0) stop_time = 0; if (stop_time > 240) @@ -1677,7 +1677,7 @@ char_O_array_decodepth[x] = 255; else char_O_array_decodepth[x] = (char)temp_depth_limit; - stop_time = char_O_array_decotime[x] + temp_decotime; + stop_time = char_O_array_decotime[x] + 1; if (stop_time > 240) char_O_array_decotime[x] = 240; else @@ -1690,7 +1690,7 @@ } while (x<6); if (x == 6) { - stop_time = char_O_array_decotime[6] + temp_decotime; + stop_time = char_O_array_decotime[6] + 1; if (stop_time > 220) char_O_array_decotime[6] = 220; else @@ -1883,7 +1883,7 @@ clear_decoarray(); char_O_deco_status = 0; char_O_nullzeit = 0; - char_O_ascenttime = 0; + int_O_ascenttime = 0; calc_gradient_factor(); } diff -r cb055a7d75f3 -r 494587193f5d code_part1/OSTC_code_c_part2/p2_deco.o Binary file code_part1/OSTC_code_c_part2/p2_deco.o has changed diff -r cb055a7d75f3 -r 494587193f5d code_part1/OSTC_code_c_part2/shared_definitions.h --- a/code_part1/OSTC_code_c_part2/shared_definitions.h Mon Jan 24 23:31:57 2011 +0100 +++ b/code_part1/OSTC_code_c_part2/shared_definitions.h Tue Jan 25 01:02:35 2011 +0100 @@ -80,14 +80,14 @@ VAR_UINT (int_O_limit_GF_low); VAR_UINT (int_O_gtissue_press_at_GF_low); VAR_UINT (int_O_calc_tissue_call_counter); +VAR_UINT (int_O_desaturation_time); // +VAR_UINT (int_O_ascenttime); // TTS (in minutes) VAR_UCHAR (char_O_GF_low_pointer); VAR_UCHAR (char_O_actual_pointer); -VAR_UINT (int_O_desaturation_time); // VAR_UCHAR (char_O_nullzeit); // VAR_UCHAR (char_O_deco_status); // -VAR_UCHAR (char_O_ascenttime); // VAR_UCHAR (char_O_gradient_factor); // VAR_UCHAR (char_O_gtissue_no); // VAR_UCHAR (char_O_diluent); // new in v.101