comparison src/divemode.asm @ 89:c34516c99ca8

BUGFIX: No average depth for end-of-dive portion (<1m) BUGFIX: Show "CC Diluents" in logbook instead of OC Gas List
author heinrichsweikamp
date Tue, 15 Apr 2014 12:16:28 +0200
parents 3bbbfab9818f
children 53a99a2dc6a1
comparison
equal deleted inserted replaced
88:2a992aba61ef 89:c34516c99ca8
665 665
666 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder 666 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
667 movff xC+0,avr_rel_pressure+0 667 movff xC+0,avr_rel_pressure+0
668 movff xC+1,avr_rel_pressure+1 668 movff xC+1,avr_rel_pressure+1
669 669
670 btfss divemode2 ; displayed divetime is running?
671 return ; No (e.g. too shallow)
672
670 ; 3. Compute Total Average Depth on base of total_divetime_seconds:2 673 ; 3. Compute Total Average Depth on base of total_divetime_seconds:2
671 movff total_divetime_seconds+0,xB+0 674 movff total_divetime_seconds+0,xB+0
672 movff total_divetime_seconds+1,xB+1 ; Copy 675 movff total_divetime_seconds+1,xB+1 ; Copy
673 movff average_depth_hold_total+0,xC+0 676 movff average_depth_hold_total+0,xC+0
674 movff average_depth_hold_total+1,xC+1 677 movff average_depth_hold_total+1,xC+1
675 movff average_depth_hold_total+2,xC+2 678 movff average_depth_hold_total+2,xC+2
676 movff average_depth_hold_total+3,xC+3 679 movff average_depth_hold_total+3,xC+3
677 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder 680 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
678 movff xC+0,avr_rel_pressure_total+0 681 movff xC+0,avr_rel_pressure_total+0
679 movff xC+1,avr_rel_pressure_total+1 682 movff xC+1,avr_rel_pressure_total+1
680
681 ; ; Compute Total Average Depth on base of divemins:2 and divesecs
682 ; movff divemins+0,xA+0
683 ; movff divemins+1,xA+1
684 ; movlw d'60'
685 ; movwf xB+0
686 ; clrf xB+1
687 ; call mult16x16 ; xC:4=xA:2*xB:2
688 ; movf divesecs,W
689 ; addwf xC+0,F
690 ; movlw d'0'
691 ; addwfc xC+1,F ; xC:2 holds total dive seconds
692 ; movlw d'3' ; 2+1
693 ; btfss divesecs,0 ; divesecs even?
694 ; movlw d'2' ; Yes, do not add +1
695 ; addwf xC+0,F
696 ; movlw d'0'
697 ; addwfc xC+1,F
698 ; ; Ignore xC+2 and xC+3. Total Average will only work up to divetime=1092:16
699 ; movff xC+0,xB+0
700 ; movff xC+1,xB+1 ; Copy
701 ; movff average_depth_hold_total+0,xC+0
702 ; movff average_depth_hold_total+1,xC+1
703 ; movff average_depth_hold_total+2,xC+2
704 ; movff average_depth_hold_total+3,xC+3
705 ;
706 ; call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
707 ; movff xC+0,avr_rel_pressure_total+0
708 ; movff xC+1,avr_rel_pressure_total+1
709 683
710 return 684 return
711 685
712 reset_average1: 686 reset_average1:
713 clrf average_depth_hold+0 687 clrf average_depth_hold+0