Mercurial > public > mk2
changeset 307:5bc3467fc421
New live EAD/END in divemode (both OCR and CCR).
author | JeanDo |
---|---|
date | Sun, 01 May 2011 03:35:42 +0200 |
parents | ab1678d98e46 |
children | 122324dafba7 |
files | code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_c_part2/p2_deco.c code_part1/OSTC_code_c_part2/p2_deco.o code_part1/OSTC_code_c_part2/shared_definitions.h |
diffstat | 5 files changed, 73 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt Sat Apr 30 20:54:23 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Sun May 01 03:35:42 2011 +0200 @@ -5,13 +5,14 @@ NEW: Display CNS in decoplan NEW: Colored stops in decoplan (CF55 > 0) NEW: 115kbaud/s bootloader -NEW: Colored battery sign when charging (yellow) or charged (green). +NEW: Colored battery sign when charging (yellow) or charged (green) CHANGE: Battery symbol filled BUGFIX: Apply salinity for ceiling warning -CHANGE: Gas Setup page 2 reworked +CHANGE: Gas Setup page 2 reworked (MOD depth default) BUGFIX: x-scale in Logbook fixed CHANGE: Some typos in English text NEW: Display ppO2[Diluent] in CCR modes +NEW: Display EAD/END in OCR and CCR modes New in 1.86 beta: BETA Version - Do NOT use for diving!
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Sat Apr 30 20:54:23 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Sun May 01 03:35:42 2011 +0200 @@ -3059,92 +3059,68 @@ call PLED_standard_color return +;============================================================================= +; Display EAD/END computed in calc_hauptroutine_update_tissues() every 2sec. +; PLED_show_end_ead_divemode: + call PLED_divemask_color ; Set Color for Divemode mask + + WIN_FONT FT_SMALL WIN_LEFT .95 WIN_TOP .192 - WIN_FONT FT_SMALL - call PLED_divemask_color ; Set Color for Divemode mask lfsr FSR2,letter - OUTPUTTEXTH .299 ; EAD: + OUTPUTTEXTH .299 ; EAD: call word_processor - WIN_LEFT .95 + WIN_TOP .216 lfsr FSR2,letter - OUTPUTTEXTH .298 ; END: + OUTPUTTEXTH .298 ; END: call word_processor - call PLED_standard_color - - btfss FLAG_const_ppO2_mode ; are we in ppO2 mode? - bra PLED_show_end_ead_divemode2 ; no, show OC EAD and END - -; We are in CCR mode... - btfss is_bailout ; In bailout mode? - bra PLED_show_end_ead_divemode3 ; No, show CC EAD and END - -PLED_show_end_ead_divemode2: ; Show OC EAD and END -; Show EAD: + + call PLED_standard_color ; Back to white. WIN_LEFT .125 WIN_TOP .192 - -; Show END: - WIN_LEFT .125 + lfsr FSR2,letter + movff char_O_EAD,lo + bsf leftbind + output_8 ; Print EAD w/o leading space. + STRCAT_PRINT "m" + WIN_TOP .216 - return - -PLED_show_end_ead_divemode3: ; Show CC EAD, END and pO2[Diluent] -; Show ppO2[Diluent] + lfsr FSR2,letter + movff char_O_END,lo + output_8 ; Print END w/o leading space. + bcf leftbind + STRCAT_PRINT "m" + + btfsc is_bailout ; In bailout mode? + return ; Yes: done. + + btfss FLAG_const_ppO2_mode ; In (true) CCR mode ? + return ; No: done. + +; Show ppO2[Diluent] + WIN_LEFT .95 WIN_TOP .168 call PLED_divemask_color ; Set Color for Divemode mask STRCPY_PRINT "ppO2:" ; ppO2 of diluent call PLED_standard_color - movff amb_pressure+0,xA+0 - movff amb_pressure+1,xA+1 - movlw d'10' - movwf xB+0 - clrf xB+1 - call div16x16 ; xC=p_amb/10 - movff xC+0,xA+0 - movff xC+1,xA+1 - movff char_I_O2_ratio,xB+0 - clrf xB+1 - call mult16x16 ; char_I_O2_ratio * p_amb/10 - movff xC+0,lo - movff xC+1,hi ; for output - WIN_LEFT .130 WIN_TOP .168 lfsr FSR2,letter - movff xC+0,sub_a+0 - movff xC+1,sub_a+1 ; for compare - movlw LOW d'10000' - movwf sub_b+0 - movlw HIGH d'10000' ; ppO2 has mbar resolution... - movwf sub_b+1 - call sub16 ; sub_c = sub_a - sub_b - movlw '0' - btfsc neg_flag ; Display leading zero manually? - movwf POSTINC2 ; Yes! - + movff char_O_diluent_ppO2, lo + clrf hi bsf leftbind - bsf ignore_digit4 - output_16dp d'1' ; Show ppO2 w/o leading zero - bcf ignore_digit4 + output_16dp d'3' ; Show ppO2 w/o leading zero bcf leftbind STRCAT_PRINT " " ; Display ppO2[Diluent] -; EAD and END: ToDo... -; Show EAD: - WIN_LEFT .125 - WIN_TOP .192 - -; Show END: - WIN_LEFT .125 - WIN_TOP .216 return +;============================================================================= PLED_show_leading_tissue: call PLED_divemask_color ; Set Color for Divemode mask
--- a/code_part1/OSTC_code_c_part2/p2_deco.c Sat Apr 30 20:54:23 2011 +0200 +++ b/code_part1/OSTC_code_c_part2/p2_deco.c Sun May 01 03:35:42 2011 +0200 @@ -1365,7 +1365,7 @@ } const_ppO2 = char_I_const_ppO2 * 0.01; - deco_ppO2_change = char_I_deco_ppO2_change / 99.95 + deco_ppO2_change = char_I_deco_ppO2_change / 99.85 + pres_surface + float_deco_distance; deco_ppO2 = char_I_deco_ppO2 * 0.01; @@ -1387,24 +1387,51 @@ assert( 0.800 < pres_respiration && pres_respiration < 14.0 ); pres_diluent = pres_respiration; - if (char_I_const_ppO2 != 0) // new in v.101 + if( char_I_const_ppO2 != 0 ) // new in v.101 { pres_diluent -= const_ppO2; // new in v.101 pres_diluent /= N2_ratio + He_ratio; // new in v.101 if( pres_diluent > pres_respiration ) // new in v.101 pres_diluent = pres_respiration; // new in v.101 + + char_O_diluent = (char)(pres_diluent/pres_respiration*100.0 + 0.5); + char_O_diluent_ppO2 = (char)(pres_diluent * (1.0 - N2_ratio - He_ratio) * 100.0 + 0.5); } - if (pres_diluent > ppWVapour) // new in v.101 + + if( pres_diluent > ppWVapour ) // new in v.101 { + overlay float EAD, END; + ppN2 = N2_ratio * (pres_diluent - ppWVapour); // changed in v.101 ppHe = He_ratio * (pres_diluent - ppWVapour); // changed in v.101 - char_O_diluent = (char)(pres_diluent/pres_respiration*100.0); + + // EAD : Equivalent Air Dive. Equivalent depth for the same N2 level + // with plain air. + // ppN2 = 79% * (P_EAD - ppWVapour) + // EAD = (P_EAD - Psurface) * 10 + // ie: EAD = (ppN2 / 0.7902 + ppWVapour -Psurface) * 10 + EAD = (ppN2 / 0.7902 + ppWVapour - pres_surface) * 9.985; + if( EAD < 0.0 || EAD > 245.5 ) EAD = 0.0; + char_O_EAD = (char)(EAD + 0.5); + + // END : Equivalent Narcotic Dive. + // Here we count O2 as narcotic too. Hence everything but helium (has a narcosis factor of + // 0.23 btw). Hence the formula becomes: + // END * BarPerMeter * (1.0 - 0.0) - ppWVapour + Psurface == Pambient - ppHe - ppWVapour + // ie: END = (Pambient - ppHe - Psurface) * 9.985 + // + // Source cited: + // The Physiology and Medicine of Diving by Peter Bennett and David Elliott, + // 4th edition, 1993, W.B.Saunders Company Ltd, London. + END = (pres_respiration - ppHe - pres_surface) * 9.985; + if( END < 0.0 || END > 245.5 ) END = 0.0; + char_O_END = (char)(END + 0.5); } else // new in v.101 { ppN2 = 0.0; // new in v.101 ppHe = 0.0; // new in v.101 - char_O_diluent = 0; + char_O_EAD = char_O_END = 0; } if(!char_I_step_is_1min)
--- a/code_part1/OSTC_code_c_part2/shared_definitions.h Sat Apr 30 20:54:23 2011 +0200 +++ b/code_part1/OSTC_code_c_part2/shared_definitions.h Sun May 01 03:35:42 2011 +0200 @@ -85,6 +85,9 @@ VAR_UCHAR (char_O_gradient_factor); // VAR_UCHAR (char_O_gtissue_no); // VAR_UCHAR (char_O_diluent); // new in v.101 +VAR_UCHAR (char_O_diluent_ppO2); // 2011-05-01: ppO2 from diluant (CCR mode). +VAR_UCHAR (char_O_EAD); // 2011-05-01: Added EAD/END in deco model. +VAR_UCHAR (char_O_END); // 2011-05-01: Added EAD/END in deco model. VAR_UCHAR (char_O_CNS_fraction); // new in v.101 VAR_UCHAR (char_O_relative_gradient_GF); // new in v.102