# HG changeset patch # User JeanDo # Date 1318196279 -7200 # Node ID 7779bfa891716eaca662914f6ed396e116648694 # Parent 472bccc39aeb80ca5a830f8410aa7ea957e12c07 Cave bailout prediction. diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/changelog.txt --- a/code_part1/OSTC_code_asm_part1/changelog.txt Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/changelog.txt Sun Oct 09 23:37:59 2011 +0200 @@ -1,3 +1,8 @@ +New in 2.02 beta: +NEW: Cave divers consomation display and alarm (CF59). +NEW: 32MhZ mode: computes twice faster. +BUGFIX: Hang when deco table is full (more than 32 stops). + New in 2.01 beta: BUGFIX: No decodata in logbook for apnea dives diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/customview.asm --- a/code_part1/OSTC_code_asm_part1/customview.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/customview.asm Sun Oct 09 23:37:59 2011 +0200 @@ -77,6 +77,8 @@ bra customview_1sec_ead_end ; Show END and EAD in divemode dcfsnz WREG,F bra customview_1sec_@5 ; Show TTS for extra time. + dcfsnz WREG,F + bra customview_1sec_cave_bailout; Show Cave conso prediction. ; Menupos3=0, do nothing return @@ -117,6 +119,9 @@ customview_1sec_@5: goto PLED_show_@5 +customview_1sec_cave_bailout: + goto PLED_show_cave_bailout + ;============================================================================= ; Do every-minute tasks for the custom view area @@ -138,6 +143,8 @@ bra customview_minute_ead_end ; Show END and EAD in divemode dcfsnz WREG,F bra customview_minute_@5 ; Show TTS for extra time. + dcfsnz WREG,F + bra customview_minute_cave_bailout; Show Cave consomation prediction. ; Menupos3=0, do nothing return @@ -148,6 +155,7 @@ customview_minute_lead_tiss: goto PLED_show_leading_tissue_2 ; Update the leading tissue +customview_minute_cave_bailout: ; Do nothing extra customview_minute_@5: ; Do nothing extra customview_minute_ead_end: ; Do nothing extra customview_minute_marker: ; Do nothing extra @@ -167,31 +175,34 @@ bra customview_toggle_exit ; Yes, ignore custom view in divemode completely incf menupos3,F ; Number of customview to show - movlw d'8' ; Max number + movlw d'9' ; Max number cpfsgt menupos3 ; Max reached? bra customview_mask ; No, show clrf menupos3 ; Reset to zero (Zero=no custom view) customview_mask: call PLED_clear_customview_divemode + bcf tts_extra_time ; By default, CLEAR computation of @5 request. + movff menupos3,WREG ; Menupos3 holds number of customview function dcfsnz WREG,F - bra customview_init_stopwatch ; Show the Stopwatch + bra customview_init_stopwatch ; 1: Show the Stopwatch dcfsnz WREG,F - bra customview_init_marker ; Show the Marker-Menu + bra customview_init_marker ; 2: Show the Marker-Menu dcfsnz WREG,F - bra customview_init_clock ; Show the clock + bra customview_init_clock ; 3: Show the clock dcfsnz WREG,F - bra customview_init_lead_tissue ; Show the leading tissue + bra customview_init_lead_tissue ; 4: Show the leading tissue dcfsnz WREG,F - bra customview_init_average ; Show Total average depth + bra customview_init_average ; 5: Show Total average depth dcfsnz WREG,F - bra customview_init_graphs ; Show the graphs + bra customview_init_graphs ; 6: Show the graphs dcfsnz WREG,F - bra customview_init_ead_end ; Show END and EAD in divemode + bra customview_init_ead_end ; 7: Show END and EAD in divemode dcfsnz WREG,F - bra customview_init_@5 ; Show TTS for extra time. - bcf tts_extra_time ; Else, CLEAR computation of @5 request. + bra customview_init_@5 ; 8: Show TTS for extra time. + dcfsnz WREG,F + bra customview_init_cave_bailout ; 9: Show Cave consomation prediction. customview_init_nocustomview: bra customview_toggle_exit @@ -271,6 +282,15 @@ bra customview_toggle_exit +customview_init_cave_bailout: + GETCUSTOM15 d'59' ; Conso level warning set ? + movf lo,W + iorwf hi,W + bz customview_toggle ; No: jump to next Customview ! + + call PLED_show_cave_bailout + bra customview_toggle_exit + customview_init_graphs: ; Show tissue graph GETCUSTOM8 d'52' ; Show Tissue Graph? (=1 in WREG) decfsz WREG,F ; WREG=1? diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/english_text.asm --- a/code_part1/OSTC_code_asm_part1/english_text.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/english_text.asm Sun Oct 09 23:37:59 2011 +0200 @@ -309,8 +309,8 @@ TCODE .40, .35, "Gas switch[min]" ;177 Gas switch[min] (Additional delay in decoplan for gas switches). TCODE .40, .35, "BottomGas[/min]" ;178 BottomGas[/min] (Bottom gas usage, for volume estimation). TCODE .40, .35, "AscentGas[/min]" ;179 AscentGas[/min] (Ascent+Deco gas usage) - TCODE .40, .35, "Future TTS[min]" ;180 Future TTS[min] (@5 variant: compute TTS for extra time at current depth) - TCODE .40, .35, "not used " ;181 not used + 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, "not used " ;182 not used TCODE .40, .35, "not used " ;183 not used TCODE .40, .35, "not used " ;184 not used @@ -453,13 +453,16 @@ TCODE .45, .100, "Bootloader" ;302 Bootloader TCODE .40, .130, "Please wait!" ;303 Please wait! TCODE .50, .130, "Aborted!" ;304 Aborted -;@5 variant +; @5 variant TCODE .0, .0, "Future TTS" ;305 Future TTS (=10 chars. Title for @5 customview). ; - TCODE .100, .125, "Quit Sim" ;306 Quit Sim (=8char max. Quit Simulator mode) -;Dive interval + TCODE .100, .125, "Quit Sim" ;306 Quit Sim (=8char max. Quit Simulator mode) +; Dive interval TCODE .20, .35, "Interval:" ;307 Interval: - TCODE .0, .0, "Now " ;308 Now (7 chars min) + TCODE .0, .0, "Now " ;308 Now (7 chars min) TCODE .108, .112, "Average" ;309 Average - TCODE .94, .54, "Stopwatch" ;310 Stopwatch (BIG Stopwatch in Gauge mode) +; + TCODE .94, .54, "Stopwatch" ;310 Stopwatch (BIG Stopwatch in Gauge mode) +; Cave consomation + TCODE .0, .0, "Cave Bail." ;311 Cave Bail. (=10 chars.) ;============================================================================= diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/french_text.asm --- a/code_part1/OSTC_code_asm_part1/french_text.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/french_text.asm Sun Oct 09 23:37:59 2011 +0200 @@ -309,8 +309,8 @@ TCODE .40, .35, "Chang. gaz[min]" ;177 Gas switch[min] (Additional delay in decoplan for gas switches). TCODE .40, .35, "ConsoFond[/min]" ;178 BottomGas[/min] (Bottom gas usage, for volume estimation). TCODE .40, .35, "ConsoDeco[/min]" ;179 AscentGas[/min] (Ascent+Deco gas usage) - TCODE .40, .35, "DTR Réchap[min]" ;180 Future TTS[min] (@5 variant: compute TTS for extra time at current depth) - TCODE .40, .35, "not used " ;181 not used + 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, "not used " ;182 not used TCODE .40, .35, "not used " ;183 not used TCODE .40, .35, "not used " ;184 not used @@ -453,13 +453,15 @@ TCODE .45, .100, "Bootloader" ;302 Bootloader TCODE .40, .130, "Attendez SVP!" ;303 Please wait! TCODE .50, .130, "Annulée!" ;304 Aborted -;@5 variant +; @5 variant TCODE .0, .0, " Futur DTR" ;305 Future TTS (=10 chars. Title for @5 customview). ; TCODE .100, .125, "Stop Sim" ;306 Quit Sim (=8char max. Quit Simulator mode) -;Dive interval +; Dive interval TCODE .20, .35, "Intervale:" ;307 Interval: - TCODE .0, .0, "Non " ;308 Now (7 chars min) + TCODE .0, .0, "Non " ;308 Now (7 chars min) TCODE .108, .112, "Moyenne" ;309 Average - TCODE .116, .54, "Chrono" ;310 Stopwatch (BIG Stopwatch in Gauge mode) + TCODE .116, .54, "Chrono" ;310 Stopwatch (BIG Stopwatch in Gauge mode) +; Cave consomation + TCODE .0, .0, "Bail. Sout" ;311 Cave Bail. (=10 chars.) ;============================================================================= diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/german_text.asm --- a/code_part1/OSTC_code_asm_part1/german_text.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/german_text.asm Sun Oct 09 23:37:59 2011 +0200 @@ -309,8 +309,8 @@ TCODE .40, .35, "Gaswechsel[min]" ;177 Gas switch[min] (Additional delay in decoplan for gas switches). TCODE .40, .35, "BottomGas[/min]" ;178 BottomGas[/min] (Bottom gas usage, for volume estimation). TCODE .40, .35, "Sonst.Gas[/min]" ;179 AscentGas[/min] (Ascent+Deco gas usage) - TCODE .40, .35, "TTS @ Zeit[min]" ;180 Future TTS[min] (@5 variant: compute TTS for extra time at current depth) - TCODE .40, .35, "nicht verwendet" ;181 not used + 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, "nicht verwendet" ;182 not used TCODE .40, .35, "nicht verwendet" ;183 not used TCODE .40, .35, "nicht verwendet" ;184 not used @@ -456,10 +456,12 @@ ;@5 variant TCODE .0, .0, "TTS @+Min." ;305 Future TTS (=10 chars. Title for @5 customview). ; - TCODE .100, .125, "Ende Sim" ;306 Quit Sim (=8char max. Quit Simulator mode) + TCODE .100, .125, "Ende Sim" ;306 Quit Sim (=8char max. Quit Simulator mode) ;Dive interval TCODE .20, .35, "Interval:" ;307 Interval: - TCODE .0, .0, "Jetzt " ;308 Now (7 chars min) + TCODE .0, .0, "Jetzt " ;308 Now (7 chars min) TCODE .109, .113, "D-Tiefe" ;309 Average - TCODE .109, .54, "Stopuhr" ;310 Stopwatch (BIG Stopwatch in Gauge mode) + TCODE .109, .54, "Stopuhr" ;310 Stopwatch (BIG Stopwatch in Gauge mode) +; Cave consomation + TCODE .0, .0, "Cave Bail." ;311 Cave Bail. (=10 chars.) ;============================================================================= diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/math.asm --- a/code_part1/OSTC_code_asm_part1/math.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/math.asm Sun Oct 09 23:37:59 2011 +0200 @@ -88,6 +88,8 @@ return +;============================================================================= + mult16x16: ;xA*xB=xC clrf xC+2 ; Clear the High-Order Bits clrf xC+3 @@ -119,6 +121,7 @@ addwfc xC+3, f return +;============================================================================= div16x16: ;xA/xB=xC with xA as remainder ;uses divB as temp variable @@ -177,6 +180,8 @@ bra div16x16_2 ; Next bit. +;============================================================================= + div32x16: ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder ; Setup movlw .32 ; setup shift counter @@ -206,12 +211,12 @@ movf xB+1,W subwf sub_b+1,W ; check if a>d btfss STATUS,Z - goto div32x16_3 + bra div32x16_3 movf xB+0,W subwf sub_b+0,W ; if msb equal then check lsb div32x16_3 btfss STATUS,C ; carry set if d>a - goto div32x16_4 + bra div32x16_4 movf xB+0,W ; d-a into d subwf sub_b+0,F btfss STATUS,C @@ -225,7 +230,7 @@ rlcf xC+2,F rlcf xC+3,F decfsz divB,F ; loop until all bits checked - goto div32x16_2 + bra div32x16_2 return ;============================================================================= diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/menu_reset.asm --- a/code_part1/OSTC_code_asm_part1/menu_reset.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm Sun Oct 09 23:37:59 2011 +0200 @@ -170,7 +170,7 @@ CF_DEFAULT CF_INT8, d'15', d'7', d'20' ; color_warn_celocity_mmin warn at xx m/min CF_DEFAULT CF_SEC+CF_NEG,d'0', -d'120' ,d'120' ; time_correction_value_default Adds to Seconds on Midnight - CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF#49 Show Altimeter in surface mode + CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF49 Show Altimeter in surface mode CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF50 Show Log-Marker CF_DEFAULT CF_BOOL, d'1', 0, 0 ; CF51 Show Stopwatch @@ -178,11 +178,11 @@ CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF53 Show Laeding Tissue in Divemode CF_DEFAULT CF_BOOL, d'0', 0, 0 ; CF54 Display shallowest stop first CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; GF55 Gas switch additional delay - CF_DEFAULT CF_DECI, d'200', d'5', 0 ; CF56 Bottom gas usage (l/min or bar/min) + CF_DEFAULT CF_DECI, d'200', d'5', d'250' ; CF56 Bottom gas usage (l/min or bar/min) - CF_DEFAULT CF_DECI, d'200', d'5', 0 ; CF57 Ascent/deco gas usage (l/min or bar/min) + CF_DEFAULT CF_DECI, d'200', d'5', d'250' ; CF57 Ascent/deco gas usage (l/min or bar/min) CF_DEFAULT CF_INT8, d'0', d'0', d'10' ; CF58 TTS for extra time at current depth [min] - CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED + CF_DEFAULT CF_INT15, d'0', d'0', d'7000' ; CF59 Cave conso warning [l] CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED CF_DEFAULT CF_INT15, 0, 0, 0 ; UNUSED diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/pled_outputs.asm --- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm Sun Oct 09 23:37:59 2011 +0200 @@ -3348,6 +3348,94 @@ return ;============================================================================= +; Display cave consomation prediction (and warning). +; +PLED_show_cave_bailout: + WIN_FONT FT_SMALL + WIN_LEFT .160-.70 ; 10 chars aligned right. + WIN_TOP .170 + call PLED_divemask_color ; Set Color for Divemode mask + lfsr FSR2,letter + + OUTPUTTEXTH .311 ; "Cave Bail." + call word_processor + +; WIN_TOP .240 - 24 ; DO NOT display liter units, as this +; WIN_LEFT .160 - 7 ; can be Bars also... +; STRCPY_PRINT "l" + + WIN_FONT FT_MEDIUM + WIN_LEFT .90 + WIN_TOP .201 ; 170 + 24 + 14/2 + 32 + 14/2 = 240. + call PLED_standard_color + lfsr FSR2,letter + + ;---- Compute divetime in seconds + movff divemins+0,xA+0 + movff divemins+1,xA+1 + movlw d'60' + movwf xB+0 + clrf xB+1 + call mult16x16 ; xC:4=xA:2*xB:2 + movf divesecs,W + addwf xC+0,W + movwf xA+0 + movlw d'0' + addwfc xC+1,W + movwf xA+1 ; xA:2 holds total dive seconds + + ;---- Multiply by SAC, and divide by 600 (SAC in 0.1 liters per minutes) + GETCUSTOM8 d'56' ; Get bottom SAC + movwf xB+0 + clrf xB+1 + call mult16x16 ; xC:4=xA:2*xB:2 + + movlw LOW(.600) + movwf xB+0 + movlw HIGH(.600) + movwf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + ;---- Multiply by average pressure [absolute, in bar] + movff xC+0,xA+0 ; Get result (in xC+0, noy xC+2 !) into xA + movff xC+1,xA+1 + + movf avr_rel_pressure_total+0,W ; Add surface pressure to get absolute pressure + addwf last_surfpressure_30min+0,W + movwf xB+0 + movf avr_rel_pressure_total+1,W + addwfc last_surfpressure_30min+1,W + movwf xB+1 ; --> Into xB + + call mult16x16 ; xC:4=xA:2*xB:2 + + movlw LOW(.1000) ; Pressure was in milibar, so divide by 1000. + movwf xB+0 + movlw HIGH(.1000) + movwf xB+1 + call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder + + ;---- Go RED when limit is exceeded + movff xC+0,sub_a+0 + movff xC+1,sub_a+1 + GETCUSTOM15 d'59' ; Get Cave bailout alarm threshold + movff lo, sub_b+0 + movff hi, sub_b+1 + call sub16 ; Computes prediction - limit + btfss neg_flag ; Negativ ? + call PLED_warnings_color ; NO: go RED. + + ;---- Then display... + movff xC+0,lo + movff xC+1,hi + + bcf leftbind + output_16 + call word_processor + WIN_FONT FT_SMALL + return + +;============================================================================= PLED_show_leading_tissue: call PLED_divemask_color ; Set Color for Divemode mask diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/russian_text.asm --- a/code_part1/OSTC_code_asm_part1/russian_text.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/russian_text.asm Sun Oct 09 23:37:59 2011 +0200 @@ -456,12 +456,14 @@ TCODE .45, .100, "Çàãðóç÷èê" ;302 Bootloader TCODE .19, .130, "Ïîæàëóéñòà æäèòå!" ;303 Please wait! TCODE .50, .130, "Ïðåðâàíî!" ;304 Aborted -;@5 variant +; @5 variant TCODE .0, .0, "Áóäóù. TTS" ;305 Future TTS (=10 chars. Title for @5 customview). - TCODE .100, .125, "Âûõîä" ;306 Quit Sim (=8char max. Quit Simulator mode) -;Dive interval + TCODE .100, .125, "Âûõîä" ;306 Quit Sim (=8char max. Quit Simulator mode) +; Dive interval TCODE .20, .35, "Èíòåðâàë:" ;307 Interval: - TCODE .0, .0, "Ñåé÷àñ " ;308 Now (7 chars min) + TCODE .0, .0, "Ñåé÷àñ " ;308 Now (7 chars min) TCODE .108, .112, "Ñ®åäíÿÿ" ;309 Average - TCODE .115, .54, "Òàéìå®" ;310 Stopwatch (BIG Stopwatch in Gauge mode) + TCODE .115, .54, "Òàéìå®" ;310 Stopwatch (BIG Stopwatch in Gauge mode) +; Cave consomation + TCODE .0, .0, "Cave Bail." ;311 Cave Bail. (=10 chars.) ;============================================================================= \ No newline at end of file diff -r 472bccc39aeb -r 7779bfa89171 code_part1/OSTC_code_asm_part1/spanish_text.asm --- a/code_part1/OSTC_code_asm_part1/spanish_text.asm Sun Oct 09 22:18:25 2011 +0200 +++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm Sun Oct 09 23:37:59 2011 +0200 @@ -308,8 +308,8 @@ TCODE .40, .35, "Conmu. gas[min]" ;177 Gas switch[min] (Additional delay in decoplan for gas switches). TCODE .40, .35, "Gas Fondo[/min]" ;178 BottomGas[/min] (Bottom gas usage, for volume estimation). TCODE .40, .35, "GasAscens[/min]" ;179 AscentGas[/min] (Ascent+Deco gas usage) - TCODE .40, .35, "Futuro TTS[min]" ;180 Future TTS[min] (@5 variant: compute TTS for extra time at current depth) - TCODE .40, .35, "sin uno " ;181 not used + 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, "sin uso " ;182 not used TCODE .40, .35, "sin uso " ;183 not used TCODE .40, .35, "sin uso " ;184 not used @@ -455,10 +455,12 @@ ;@5 variant TCODE .0, .0, "Futuro TTS" ;305 Future TTS (=10 chars. Title for @5 customview). ; - TCODE .100, .125, "SalirSim" ;306 Quit Sim (=8char max. Quit Simulator mode) + TCODE .100, .125, "SalirSim" ;306 Quit Sim (=8char max. Quit Simulator mode) ;Dive interval TCODE .20, .35, "Interval:" ;307 Interval: - TCODE .0, .0, "Now " ;308 Now (7 chars min) + TCODE .0, .0, "Now " ;308 Now (7 chars min) TCODE .100, .113, "Promedio" ;309 Average - TCODE .116, .54, "Crono." ;310 Stopwatch (BIG Stopwatch in Gauge mode) + TCODE .116, .54, "Crono." ;310 Stopwatch (BIG Stopwatch in Gauge mode) +; Cave consomation + TCODE .0, .0, "Cave Bail." ;311 Cave Bail. (=10 chars.) ;=============================================================================