changeset 572:80a1d2d5a9ee

timeout display when deco stops are violated
author heinrichsweikamp
date Fri, 20 Apr 2012 21:32:03 +0200
parents 7f5419d4157d
children 77c8ff191cd7
files code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm
diffstat 2 files changed, 54 insertions(+), 11 deletions(-) [+]
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
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sat Apr 14 12:25:30 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Fri Apr 20 21:32:03 2012 +0200
@@ -569,14 +569,30 @@
 
 ;=============================================================================
 
+PLED_divemode_timeout2:
+	WIN_TOP		.54
+	WIN_LEFT	.112
+	WIN_FONT 	FT_SMALL
+	WIN_INVERT	.1
+	call    PLED_warnings_color
+	STRCPY  0x94					; "End of dive" icon
+	movff	timeout_counter, lo
+	movff	timeout_counter2, hi
+	call	convert_time				; converts hi:lo in minutes to hours (hi) and minutes (lo)
+	movf	hi,W
+	movff	lo,hi
+	movwf	lo							; exchange lo and hi
+	output_99x
+	PUTC    ':'
+	movff	hi,lo
+	output_99x
+	STRCAT_PRINT " "
+	bsf		timeout_display				; Set Flag
+	call	PLED_standard_color
+	WIN_INVERT	.0
+	return
+
 PLED_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
-
 	WIN_TOP		.54
 	WIN_LEFT	.112
 	WIN_FONT 	FT_SMALL
@@ -586,7 +602,7 @@
 	movff	lo,sub_a+0
 	movff	hi,sub_a+1
 	movff	timeout_counter, sub_b+0
-	movff	timeout_counter2, sub_b+1
+	movff	timeout_counter2, sub_b+1	; Divemode timeout
 	call	sub16						;  sub_c = sub_a - sub_b
 	movff	sub_c+0,lo
 	movff	sub_c+1,hi
@@ -603,6 +619,9 @@
 	return
 
 PLED_divemode_timeout_clear:
+	btfsc		dekostop_active				; Is a deco stop displayed?
+	call		PLED_display_deko_mask		; Yes, redraw mask
+
 	WIN_TOP		.54
 	WIN_LEFT	.112
 	movlw		d'6'