comparison src/divemode.asm @ 178:39f6c07ce2f6

BUGFIX: Average depth computation
author heinrichsweikamp
date Tue, 07 Oct 2014 13:45:21 +0200
parents 3fdafedc24af
children efe70488a04b
comparison
equal deleted inserted replaced
177:67db1f6d3787 178:39f6c07ce2f6
62 diveloop_loop: ; The diveloop starts here 62 diveloop_loop: ; The diveloop starts here
63 btfss onesecupdate 63 btfss onesecupdate
64 bra diveloop_loop3 64 bra diveloop_loop3
65 65
66 ; tasks any new second... 66 ; tasks any new second...
67 bcf onesecupdate ; one seconds update, clear flag here in case it's set again in ISR before all tasks are done.
68
67 btfsc FLAG_apnoe_mode ; Only in apnoe mode 69 btfsc FLAG_apnoe_mode ; Only in apnoe mode
68 bra diveloop_loop1b ; One Second Tasks in Apnoe mode 70 bra diveloop_loop1b ; One Second Tasks in Apnoe mode
69 71
70 call TFT_divemins ; Display (new) divetime! 72 call TFT_divemins ; Display (new) divetime!
71 call customview_second ; Do every-second tasks for the custom view area 73 call customview_second ; Do every-second tasks for the custom view area
105 ; btfsc FLAG_ccr_mode ; In CCR mode 107 ; btfsc FLAG_ccr_mode ; In CCR mode
106 ; call TFT_active_gas_divemode ; Update Setpoint every second 108 ; call TFT_active_gas_divemode ; Update Setpoint every second
107 109
108 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays 110 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays
109 call check_sensors ; Check O2 sensor thresholds for fallback 111 call check_sensors ; Check O2 sensor thresholds for fallback
110
111 bcf onesecupdate ; one seconds update done
112 112
113 diveloop_loop3: 113 diveloop_loop3:
114 rcall test_switches_divemode ; Check switches in divemode 114 rcall test_switches_divemode ; Check switches in divemode
115 115
116 global diveloop_loop4 116 global diveloop_loop4
789 movff average_depth_hold_total+2,xC+2 789 movff average_depth_hold_total+2,xC+2
790 movff average_depth_hold_total+3,xC+3 790 movff average_depth_hold_total+3,xC+3
791 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder 791 call div32x16 ; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
792 movff xC+0,avr_rel_pressure_total+0 792 movff xC+0,avr_rel_pressure_total+0
793 movff xC+1,avr_rel_pressure_total+1 793 movff xC+1,avr_rel_pressure_total+1
794
795 return 794 return
796 795
797 reset_average1: 796 reset_average1:
798 clrf average_depth_hold+0 797 clrf average_depth_hold+0
799 clrf average_depth_hold+1 798 clrf average_depth_hold+1