diff code_part1/OSTC_code_asm_part1/divemode.asm @ 572:80a1d2d5a9ee

timeout display when deco stops are violated
author heinrichsweikamp
date Fri, 20 Apr 2012 21:32:03 +0200
parents 9e20de11fb78
children e3ffc6d62a63
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Sat Apr 14 12:25:30 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Fri Apr 20 21:32:03 2012 +0200
@@ -1400,7 +1400,19 @@
 	incf	timeout_counter,F
 	movlw	d'0'
 	addwfc	timeout_counter2,F			; timeout is 15bits
-	GETCUSTOM15	d'2'					; diveloop_timeout
+
+	GETCUSTOM15	d'2'					; diveloop_timeout -> lo:hi	
+
+	btfss	dekostop_active			; Is a deco stop displayed?
+	bra		timeout_divemode1		; No, use normal CF02 timeout
+
+	; Yes, use 10minutes counter	
+	movlw	LOW		.600
+	movwf	lo
+	movlw	HIGH	.600
+	movwf	hi
+
+timeout_divemode1:
 	movff	lo,sub_a+0
 	movff	hi,sub_a+1
 	movff	timeout_counter, sub_b+0
@@ -1523,7 +1535,9 @@
 	bra		set_dive_modes2			; too shallow (rel_pressure<dive_threshold)
 
 	btfsc	realdive				; Dive longer than one minute?
-	clrf 	timeout_counter			; Yes, reset timout counter
+	clrf 	timeout_counter			; Yes, reset timout counter (Low Byte)
+	btfsc	realdive				; Dive longer than one minute?
+	clrf 	timeout_counter2		; Yes, reset timout counter (High Byte)
 
 set_dive_modes_common:
 	bsf		divemode				; (Re-)Set divemode flag
@@ -1539,10 +1553,20 @@
 
 	btfss	divemode				; Are we still diving?
 	return							; No, return
+; Yes, show divemode timeout
 
-; Yes, show divemode timeout
+	btfsc	menubit						; Divemode menu active?
+	return								; Yes, return
+	btfsc	FLAG_apnoe_mode				; In Apnoe mode?
+	return								; Yes, return
+	btfsc	gauge_mode					; In Gauge mode?
+	return								; Yes, return
+
+
 	btfss	dekostop_active			; Is a deco stop displayed?
 	call	PLED_divemode_timeout	; No, show the divemode timeout here...
+	btfsc	dekostop_active			; Is a deco stop displayed?
+	call	PLED_divemode_timeout2	; Yes, show red warning divemode counter
 	return
 
 set_dive_modes3:					; High-altitude mode