Mercurial > public > mk2
changeset 552:44e9b961f156
Compute ppO2 for pSCR diving
author | heinrichsweikamp |
---|---|
date | Sat, 04 Feb 2012 18:23:36 +0100 |
parents | c67bf1ca73ef |
children | 97b11ff4bcea |
files | code_part1/OSTC_code_asm_part1/MAIN.ASM code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/customview.asm code_part1/OSTC_code_asm_part1/english_text.asm code_part1/OSTC_code_asm_part1/french_text.asm code_part1/OSTC_code_asm_part1/german_text.asm code_part1/OSTC_code_asm_part1/math.asm code_part1/OSTC_code_asm_part1/menu_reset.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/russian_text.asm code_part1/OSTC_code_asm_part1/spanish_text.asm code_part1/OSTC_code_asm_part1/turkish_text.asm |
diffstat | 12 files changed, 166 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/MAIN.ASM Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/MAIN.ASM Sat Feb 04 18:23:36 2012 +0100 @@ -122,7 +122,7 @@ #include aa_fonts.asm ;============================================================================= - MESSG "OSTC - diving computer code, Copyright (C) 2011 HeinrichsWeikamp" + MESSG "OSTC - diving computer code, Copyright (C) 2012 HeinrichsWeikamp" MESSG "This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the" MESSG "Free Software Foundation, either version 3 of the License, or (at your option) any later version." MESSG "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY"
--- a/code_part1/OSTC_code_asm_part1/changelog.txt Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Sat Feb 04 18:23:36 2012 +0100 @@ -1,6 +1,10 @@ New in 2.21 beta: BETA Version - Do NOT use for diving! BUGFIX: GF warning in logbook memory +NEW: Compute ppO2 for pSCR diving +NEW: CF61: Show pSCR ppO2 in customview +NEW: CF62: pSCR O2 Drop in percent +NEW: CF63: pSCR counterlung ratio 1/x New in 2.20: Stable Release
--- a/code_part1/OSTC_code_asm_part1/customview.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/customview.asm Sat Feb 04 18:23:36 2012 +0100 @@ -89,7 +89,8 @@ bra customview_1sec_@5 ; Show TTS for extra time. dcfsnz WREG,F bra customview_1sec_cave_bailout; Show Cave conso prediction. - + dcfsnz WREG,F + bra customview_1sec_pSCR_ppO2 ; Show/Update pSCR ppO2 ; Menupos3=0, do nothing return @@ -133,6 +134,10 @@ bsf menu3_active ; Set Flag goto PLED_show_cave_bailout +customview_1sec_pSCR_ppO2: + goto PLED_show_pSCR_ppO2 ; Yes, compute and show value + + ;============================================================================= ; Do every-minute tasks for the custom view area @@ -156,6 +161,8 @@ bra customview_minute_@5 ; Show TTS for extra time. dcfsnz WREG,F bra customview_minute_cave_bailout; Show Cave consomation prediction. + dcfsnz WREG,F + bra customview_minute_pSCR_ppO2; Show pSCR ppO2 level ; Menupos3=0, do nothing return @@ -173,6 +180,7 @@ customview_minute_stopwatch: ; Do nothing extra customview_minute_average: ; Do nothing extra customview_minute_graphs: ; Do nothing extra +customview_minute_pSCR_ppO2: ; Do nothing extra return ;============================================================================= @@ -186,7 +194,7 @@ bra customview_toggle_exit ; Yes, ignore custom view in divemode completely incf menupos3,F ; Number of customview to show - movlw d'9' ; Max number + movlw d'10' ; Max number cpfsgt menupos3 ; Max reached? bra customview_mask ; No, show clrf menupos3 ; Reset to zero (Zero=no custom view) @@ -214,6 +222,8 @@ bra customview_init_@5 ; 8: Show TTS for extra time. dcfsnz WREG,F bra customview_init_cave_bailout ; 9: Show Cave consomation prediction. + dcfsnz WREG,F + bra customview_init_pSCR_ppo2 ; 10: Show ppO2 for pSCR users customview_init_nocustomview: bra customview_toggle_exit @@ -320,6 +330,15 @@ bra customview_toggle_exit +customview_init_pSCR_ppo2: + GETCUSTOM8 d'61' ; Show pSCR ppO2? + decfsz WREG,F ; WREG=1? + bra customview_toggle ; No, use next Customview + + call PLED_show_pSCR_ppO2 ; Yes, compute and show value + + bra customview_toggle_exit + customview_toggle_exit: bcf toggle_customview ; Clear flag ostc_debug 'Y' ; Sends debug-information to screen in debugmode
--- a/code_part1/OSTC_code_asm_part1/english_text.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/english_text.asm Sat Feb 04 18:23:36 2012 +0100 @@ -312,9 +312,9 @@ TCODE .40, .35, "Future TTS[min]" ;180 Future TTS[min] (Compute TTS for extra time at current depth) TCODE .40, .35, "Cave Warning[l]" ;181 Cave Warning[l] (Consomation warning for cave divers) TCODE .40, .35, "Graph. Velocity" ;182 Graph. Velocity (Show a graphical representation of the ascend speed) - TCODE .40, .35, "not used " ;183 not used - TCODE .40, .35, "not used " ;184 not used - TCODE .40, .35, "not used " ;185 not used + TCODE .40, .35, "Show pSCR ppO2 " ;183 Show pSCR ppO2 (Show the ppO2 for pSCR divers) + TCODE .40, .35, "pSCR O2 Drop[%]" ;184 pSCR O2 Drop[%] (pSCR O2 drop in percent) + TCODE .40, .35, "pSCR lung ratio" ;185 pSCR lung ratio (pSCR counterlung ratio) ; End of function descriptor II ; TCODE .13, .2, "Custom Functions II" ;186 Custom Functions II @@ -408,7 +408,7 @@ TCODE .7, .48, "Air " ;264 Air TCODE .120, .135, "Air " ;265 Air - TCODE .0, .0, "" ;266 unused + TCODE .0, .0, "pSCR Info" ;266 pSCR Info (Must be 9Chars!) TCODE .0, .216, "Max." ;267 Max. TCODE .0, .0, "" ;268 unused TCODE .0, .0, "" ;269 unused
--- a/code_part1/OSTC_code_asm_part1/french_text.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/french_text.asm Sat Feb 04 18:23:36 2012 +0100 @@ -312,9 +312,9 @@ TCODE .40, .35, "DTR Rйchap[min]" ;180 Future TTS[min] (Compute TTS for extra time at current depth) TCODE .40, .35, "Alarme Sout.[l]" ;181 Cave Warning[l] (Consomation warning for cave divers) TCODE .40, .35, "Graph. Velocity" ;182 Graph. Velocity (Show a graphical representation of the ascend speed) - TCODE .40, .35, "not used " ;183 not used - TCODE .40, .35, "not used " ;184 not used - TCODE .40, .35, "not used " ;185 not used + TCODE .40, .35, "Show pSCR ppO2 " ;183 Show pSCR ppO2 (Show the ppO2 for pSCR divers) + TCODE .40, .35, "pSCR O2 Drop[%]" ;184 pSCR O2 Drop[%] (pSCR O2 drop in percent) + TCODE .40, .35, "pSCR lung ratio" ;185 pSCR lung ratio (pSCR counterlung ratio) ; End of function descriptor II ; TCODE .13, .2, "Config Fonctions II" ;186 Custom Functions II @@ -408,7 +408,7 @@ TCODE .7, .48, "Air " ;264 Air TCODE .120, .135, "Air " ;265 Air - TCODE .0, .0, "" ;266 unused + TCODE .0, .0, "pSCR Info" ;266 pSCR Info (Must be 9Chars!) TCODE .0, .216, "Max." ;267 Max. TCODE .0, .0, "" ;268 unused TCODE .0, .0, "" ;269 unused
--- a/code_part1/OSTC_code_asm_part1/german_text.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/german_text.asm Sat Feb 04 18:23:36 2012 +0100 @@ -312,9 +312,9 @@ TCODE .40, .35, "TTS @ Zeit[min]" ;180 Future TTS[min] (Compute TTS for extra time at current depth) TCODE .40, .35, "Cave Warning[l]" ;181 Cave Warning[l] (Consomation warning for cave divers) TCODE .40, .35, "Graph. Velocity" ;182 Graph. Velocity (Show a graphical representation of the ascend speed) - TCODE .40, .35, "nicht verwendet" ;183 not used - TCODE .40, .35, "nicht verwendet" ;184 not used - TCODE .40, .35, "nicht verwendet" ;185 not used + TCODE .40, .35, "Show pSCR ppO2 " ;183 Show pSCR ppO2 (Show the ppO2 for pSCR divers) + TCODE .40, .35, "pSCR O2 Drop[%]" ;184 pSCR O2 Drop[%] (pSCR O2 drop in percent) + TCODE .40, .35, "pSCR lung ratio" ;185 pSCR lung ratio (pSCR counterlung ratio) ; End of function descriptor II ; TCODE .13, .2, "Custom Funktionen II" ;186 Custom Functions II @@ -408,7 +408,7 @@ TCODE .7, .48, "Luft " ;264 Air TCODE .120, .135, "Luft " ;265 Air - TCODE .0, .0, "" ;266 unused + TCODE .0, .0, "pSCR Info" ;266 pSCR Info (Must be 9Chars!) TCODE .0, .216, "Max." ;267 Max. TCODE .0, .0, "" ;268 unused TCODE .0, .0, "" ;269 unused
--- a/code_part1/OSTC_code_asm_part1/math.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/math.asm Sat Feb 04 18:23:36 2012 +0100 @@ -44,6 +44,26 @@ bra div16 return +sub32: ;xC:4=xC:4-sub_c:4 (Warning: sub_c+3 trashes sub_a+0!) + movf sub_c+0, W + subwf xC+0, F + + movf sub_c+1, W + BTFSS STATUS, C + incfsz sub_c+1, W + subwf xC+1, F + + movf sub_c+2, W + BTFSS STATUS, C + incfsz sub_c+2, W + subwf xC+2, F + + movf sub_c+3, W + BTFSS STATUS, C + incfsz sub_c+3, W + subwf xC+3, F + return + sub16: ; sub_c = sub_a - sub_b (with signed values) bcf neg_flag movf sub_b+0, W ; Get Value to be subtracted
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Sat Feb 04 18:23:36 2012 +0100 @@ -184,11 +184,11 @@ CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; CF58 TTS for extra time at current depth [min] CF_DEFAULT CF_INT15, d'0', d'0', d'7000' ; CF59 Cave conso warning [l] CF_DEFAULT CF_BOOL, 0, 0, 0 ; CF60 Show Graphical ascend speed indicator - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED + CF_DEFAULT CF_BOOL, 0, 0, 0 ; CF61 Show pSCR ppO2 - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED + CF_DEFAULT CF_PERCENT, .4, .0, .100 ; CF62 pSCR O2 Drop + CF_DEFAULT CF_INT8, .10, .0, .100 ; CF63 pSCR counterlung ratio +; CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED cf_default_table2: ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Sat Feb 04 18:23:36 2012 +0100 @@ -3465,6 +3465,98 @@ return ;============================================================================= +; Display pSCR ppO2 +; (Pressure[mbar]*char_I_O2_ratio)-(100-char_I_O2_ratio)*CF61*CF62*10 +PLED_show_pSCR_ppO2: + WIN_FONT FT_SMALL + WIN_LEFT .160-.63 ; 9 chars aligned right. + WIN_TOP .170 + call PLED_divemask_color ; Set Color for Divemode mask + lfsr FSR2,letter + OUTPUTTEXTH .266 ; "pSCR Info" + call word_processor; pCCR + + movff char_I_O2_ratio,WREG + sublw .100 ; 100-char_I_O2_ratio -> WREG + mullw .10 ; (100-char_I_O2_ratio)*10 -> PROD:2 + movff PRODL,xA+0 + movff PRODH,xA+1 + GETCUSTOM8 d'62' ; O2 Drop + movff WREG,xB+0 + clrf xB+1 + call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61 + movff xC+0,xA+0 + movff xC+1,xA+1 + GETCUSTOM8 d'63' ; Lung ratio + movff WREG,xB+0 + clrf xB+1 + call mult16x16 ;xA*xB=xC -> (100-char_I_O2_ratio)*10*CF61*CF62 + + movlw .10 + movwf xB+0 + clrf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + ; store xC:2 in lo:hi + movff xC+0,lo + movff xC+1,hi + + SAFE_2BYTE_COPY amb_pressure, xA + movff char_I_O2_ratio,xB+0 + clrf xB+1 + call mult16x16 ;xA*xB=xC -> xC:4 = Pressure[mbar]*char_I_O2_ratio + + movlw .10 + movwf xB+0 + clrf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + ; store xC:2 in sub_a + movff xC+0,sub_a+0 + movff xC+1,sub_a+1 + ; reload result from lo:hi + movff lo,sub_b+0 + movff hi,sub_b+1 + + call subU16 ;sub_c = sub_a - sub_b (with UNSIGNED values) + + WIN_FONT FT_SMALL + WIN_LEFT .95 + WIN_TOP .192 + lfsr FSR2,letter + STRCPY_PRINT TXT_PPO2_5 ; ppO2: + + movff sub_c+0,xC+0 + movff sub_c+1,xC+1 + clrf xC+2 + clrf xC+3 ; For color coding + PLED_color_code warn_ppo2 ; Color-code output (ppO2 stored in xC) + WIN_LEFT .130 + WIN_TOP .192 + lfsr FSR2,letter + movff xC+0,lo + movff xC+1,hi + bsf ignore_digit4 + output_16dp d'1' + bcf ignore_digit4 + STRCAT_PRINT " " + call PLED_standard_color ; Back to white. +; Show O2 drop and counter lung ration in second row + WIN_LEFT .98 + WIN_TOP .216 + lfsr FSR2,letter + GETCUSTOM8 d'62' ; O2 Drop in percent + movwf lo + bsf leftbind + output_8 + STRCAT "% 1/" + GETCUSTOM8 d'63' ; Counter lung ratio in 1/X + movwf lo + output_8 + bcf leftbind + STRCAT_PRINT " " ; Trailing space needed when changing the O2 drop + return + +;============================================================================= ; Display cave consomation prediction (and warning). ; PLED_show_cave_bailout:
--- a/code_part1/OSTC_code_asm_part1/russian_text.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/russian_text.asm Sat Feb 04 18:23:36 2012 +0100 @@ -315,9 +315,9 @@ TCODE .40, .35, "Будущ. TTS[мин]" ;180 Future TTS[min] (@5 variant: compute TTS for extra time at current depth) TCODE .40, .35, "Пещер. Пред.[л]" ;181 Cave Warning[l] (Consomation warning for cave divers) TCODE .40, .35, "График скорости" ;182 (Show a graphical representation of the ascend speed) - TCODE .40, .35, "Не используется" ;183 not used - TCODE .40, .35, "Не используется" ;184 not used - TCODE .40, .35, "Не используется" ;185 not used + TCODE .40, .35, "Show pSCR ppO2 " ;183 Show pSCR ppO2 (Show the ppO2 for pSCR divers) + TCODE .40, .35, "pSCR O2 Drop[%]" ;184 pSCR O2 Drop[%] (pSCR O2 drop in percent) + TCODE .40, .35, "pSCR lung ratio" ;185 pSCR lung ratio (pSCR counterlung ratio) ; End of function descriptor II ; TCODE .20, .2, "Доп. Параметры II" ;186 Custom Functions II @@ -411,7 +411,7 @@ TCODE .7, .48, "Возд." ;264 Air TCODE .120, .135, "Возд." ;265 Air - TCODE .0, .0, "" ;266 unused + TCODE .0, .0, "pSCR Info" ;266 pSCR Info (Must be 9Chars!) TCODE .0, .216, "Макс." ;267 Max. TCODE .0, .0, "" ;268 unused TCODE .0, .0, "" ;269 unused
--- a/code_part1/OSTC_code_asm_part1/spanish_text.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm Sat Feb 04 18:23:36 2012 +0100 @@ -311,9 +311,9 @@ TCODE .40, .35, "Futuro TTS[min]" ;180 Future TTS[min] (Compute TTS for extra time at current depth) TCODE .40, .35, "Cave Warning[l]" ;181 Cave Warning[l] (Consomation warning for cave divers) TCODE .40, .35, "Graph. Velocity" ;182 Graph. Velocity (Show a graphical representation of the ascend speed) - TCODE .40, .35, "sin uso " ;183 not used - TCODE .40, .35, "sin uso " ;184 not used - TCODE .40, .35, "sin uso " ;185 not used + TCODE .40, .35, "Show pSCR ppO2 " ;183 Show pSCR ppO2 (Show the ppO2 for pSCR divers) + TCODE .40, .35, "pSCR O2 Drop[%]" ;184 pSCR O2 Drop[%] (pSCR O2 drop in percent) + TCODE .40, .35, "pSCR lung ratio" ;185 pSCR lung ratio (pSCR counterlung ratio) ; End of function descriptor II ; TCODE .13, .2, "Func.Personaliz. II" ;186 Custom Functions II @@ -407,7 +407,7 @@ TCODE .7, .48, "Aire " ;264 Air TCODE .120, .135, "Aire " ;265 Air - TCODE .0, .0, "" ;266 unused + TCODE .0, .0, "pSCR Info" ;266 pSCR Info (Must be 9Chars!) TCODE .0, .216, "Max." ;267 Max. TCODE .0, .0, "" ;268 unused TCODE .0, .0, "" ;269 unused
--- a/code_part1/OSTC_code_asm_part1/turkish_text.asm Thu Feb 02 19:43:45 2012 +0100 +++ b/code_part1/OSTC_code_asm_part1/turkish_text.asm Sat Feb 04 18:23:36 2012 +0100 @@ -313,10 +313,9 @@ TCODE .40, .35, "TTS+extra [min]" ;180 Future TTS[min] (@5 variant: compute TTS for extra time at current depth) TCODE .40, .35, "Magara Uyari[l]" ;181 Cave Warning[l] (Consomation warning for cave divers) TCODE .40, .35, "Hiz Goster " ;182 Graph. Velocity (Show a graphical representation of the ascend speed) - TCODE .40, .35, "Kullanim Disi " ;183 not used - TCODE .40, .35, "Kullanim Disi " ;184 not used - TCODE .40, .35, "Kullanim Disi " ;185 not used - + TCODE .40, .35, "Show pSCR ppO2 " ;183 Show pSCR ppO2 (Show the ppO2 for pSCR divers) + TCODE .40, .35, "pSCR O2 Drop[%]" ;184 pSCR O2 Drop[%] (pSCR O2 drop in percent) + TCODE .40, .35, "pSCR lung ratio" ;185 pSCR lung ratio (pSCR counterlung ratio) ; End of function descriptor II @@ -412,7 +411,7 @@ TCODE .7, .48, "Hava " ;264 Air TCODE .120, .135, "Hava " ;265 Air - TCODE .0, .0, "" ;266 unused + TCODE .0, .0, "pSCR Info" ;266 pSCR Info (Must be 9Chars!) TCODE .0, .216, "Max" ;267 Max. TCODE .0, .0, "" ;268 unused TCODE .0, .0, "" ;269 unused