diff src/divemode.asm @ 643:7d8a4c60ec1a

3.15 release
author heinrichsweikamp
date Mon, 24 May 2021 18:40:53 +0200
parents 8c1f1f334275
children 070528a88715 357341239438
line wrap: on
line diff
--- a/src/divemode.asm	Thu Jan 14 16:24:07 2021 +0100
+++ b/src/divemode.asm	Mon May 24 18:40:53 2021 +0200
@@ -233,7 +233,29 @@
 ; Dive Mode Mail Loop
 ;
 diveloop_loop:
-	btfsc	trigger_full_second			; new 1/1 second?
+	btfss	trigger_quarter_second			; new 1/4 second?
+	bra		diveloop_loop_0				;       No - continue
+
+	;---- tasks any new 1/4 second -----
+	bcf		trigger_quarter_second		; YES - clear flag
+
+	movlw	.4					; 62,5ms * 4 = 1/4 second
+	movff	WREG,isr_tmr7_helper			; to make sure at least 1/4 will pass before trigger_quarter_second is re-set
+
+	btfss	press_sensor_type			; New sensor found?
+	bra 	diveloop_loop_0				;       No - continue
+
+	; Handle new pressure sensor every 1/4 second
+	btfsc	ms5837_state				; =0: result of temperature is in the ADC
+	bra	diveloop_loop_quarter_2
+	call	I2C_get_temp_val_MS5837			; (Will set ms5837_state)
+	bra	diveloop_loop_0				;  Done.
+diveloop_loop_quarter_2:
+	call	I2C_get_press_val_MS5837		; (Will clear ms5837_state)
+	;---- tasks any new 1/4 second done -----
+
+diveloop_loop_0:	
+        btfsc	trigger_full_second			; new 1/1 second?
 	bra		diveloop_loop_2				; YES - continue with tasks every 1/1 second
 	btfsc	trigger_half_second			; NO  - new 1/2 second?
 	bra		diveloop_loop_1				;       YES - continue with tasks every 1/2 second
@@ -465,7 +487,7 @@
 
 
 diveloop_loop_12:
-	bsf		FLAG_TFT_active_gas_divemode; redraw gas and setpoint (eventually needed to restore the "Bailout" text)
+    	bsf		FLAG_TFT_active_gas_divemode; redraw gas and setpoint (eventually needed to restore the "Bailout" text)
 
 	btfsc	request_next_custview		; shall show next custom view?
 	call	dive_customview_toggle		; YES - show next custom view