Mercurial > public > hwos_code
diff src/isr.asm @ 646:5b7fe7777425
3.16 release
author | heinrichs weikamp |
---|---|
date | Thu, 14 Oct 2021 12:03:24 +0200 |
parents | 8c1f1f334275 |
children | 357341239438 |
line wrap: on
line diff
--- a/src/isr.asm Thu Jan 14 16:24:07 2021 +0100 +++ b/src/isr.asm Thu Oct 14 12:03:24 2021 +0200 @@ -323,6 +323,15 @@ movlw .248 ; reload timer 7, high byte (8x256 ticks -> 62.5 ms) movwf TMR7H ; ... (keep low byte running ) + banksel isr_backup ; back to ISR default bank + decfsz isr_tmr7_helper,F ; decreased every 62,5ms + bra isr_tmr7_0 + movlw .4 ; 62,5ms * 4 = 1/4 second + movwf isr_tmr7_helper + bsf trigger_quarter_second ; set flag (In access RAM) + + +isr_tmr7_0: btfss update_surface_pressure ; shall update the surface pressure? bra isr_tmr7_1 ; NO - skip bcf update_surface_pressure ; YES - clear request flag @@ -390,9 +399,6 @@ ENDIF ; _external_sensor isr_sensor_state2: - btfss sensor_state_counter,0 ; every 1/4 second - bsf trigger_quarter_second ; set flag - btfss speed_is_normal ; CPU running on normal speed? rcall isr_set_speed_to_normal ; NO - set CPU speed to normal @@ -429,15 +435,17 @@ call calculate_compensation ; calculate temperature compensated pressure (27 us) ; build average for pressure - bcf STATUS,C ; clear carry bit - rrcf pressure_abs_avg+1 ; divide by 2 + ;bcf STATUS,C ; clear carry bit - not needed since we don't use the +2 register later + rrcf pressure_abs_avg+2 ; divide by 2 + rrcf pressure_abs_avg+1 ; ... rrcf pressure_abs_avg+0 ; ... - bcf STATUS,C ; clear carry bit - rrcf pressure_abs_avg+1 ; divide by 2, again + ;bcf STATUS,C ; clear carry bit - not needed since we don't use the +2 register later + rrcf pressure_abs_avg+2 ; divide by 2, again + rrcf pressure_abs_avg+1 ; ... rrcf pressure_abs_avg+0 ; ... ; export averaged pressure - MOVII pressure_abs_avg,pressure_abs ; export result + MOVII pressure_abs_avg,pressure_abs ; export result (Which is 16 bit for all depths < 262m) ; build average for temperature bcf STATUS,C ; clear carry bit by default @@ -541,11 +549,13 @@ bra sensor_int_state_exit ; done sensor_int_state1_plus_restart: - CLRI pressure_abs_avg ; clear average register for pressure + clrf pressure_abs_avg+0 ; clear pressure average register + clrf pressure_abs_avg+1 + clrf pressure_abs_avg+2 CLRI temperature_avg ; clear average register for temperature sensor_int_state1: - call get_temperature_value ; state 1: get temperature... + call get_temperature_value ; state 1: get temperature... call get_pressure_start ; ...and start pressure integration bra sensor_int_state_exit @@ -647,6 +657,7 @@ rcall isr_update_uptime ; increment overall OSTC uptime rcall isr_update_timeout ; process the timeout timer + movff opt_brightness_surface,brightness ; copy brightness - will be overwritten with opt_brightness_dive if in dive mdoe btfsc divemode ; in dive mode? rcall isr_divemode_1sec ; YES - do the every second dive mode tasks @@ -804,6 +815,7 @@ ; Every Second Tasks while in Dive Mode ; isr_divemode_1sec: + movff opt_brightness_divemode,brightness ; copy brightness for dive mode decfsz sampling_timer,F ; decrement sampling timer, became zero? bra isr_divemode_1sec_1 ; NO bsf trigger_sample_divedata ; YES - set trigger flag for sampling dive data @@ -856,6 +868,7 @@ return ; - done isr_divemode_1sec_4: ; at surface + movff opt_brightness_surface,brightness ; copy brightness btfss FLAG_apnoe_mode ; in apnoe mode? return ; NO - done bsf apnoe_at_surface ; YES - memorize been at the surface @@ -891,7 +904,7 @@ isr_switch_right: bcf INTCON,INT0IE ; disable external interrupt 0 - btfsc button_hold_down_allowed,A ; ignore for mechanical push buttons + btfsc button_hold_down_allowed ; ignore for mechanical push buttons bra isr_switch_right2 btfsc T4CON,TMR4ON ; Timer4 running? bra timer4_restart ; Yes, restart @@ -906,7 +919,7 @@ isr_switch_left: bcf INTCON3,INT1IE ; disable external interrupt 1 - btfsc button_hold_down_allowed,A ; ignore for mechanical push buttons + btfsc button_hold_down_allowed ; ignore for mechanical push buttons bra isr_switch_left2 btfsc T4CON,TMR4ON ; Timer4 running? bra timer4_restart ; Yes, restart @@ -919,7 +932,7 @@ ;bra isr_switch_common ; continue with common part isr_switch_common: - btfss button_hold_down_allowed,A ; ignore for mechanical push buttons + btfss button_hold_down_allowed ; ignore for mechanical push buttons bsf T4CON,TMR4ON ; Start timer 4 btfsc tmr5_preemtion_allowed ; timer 5 preemption allowed?