changeset 408:3e0192f6c241

NEW: End-of-Dive countdown displayed after surfacing
author heinrichsweikamp
date Thu, 07 Jul 2011 21:22:05 +0200
parents 47b1135cbff3
children b358a394e6aa
files code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm
diffstat 4 files changed, 58 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Thu Jul 07 20:17:01 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Thu Jul 07 21:22:05 2011 +0200
@@ -3,6 +3,7 @@
 BUGFIX: blinking fixed setpoint if actual setpoint lower then physically possible
 BUGFIX: SetPoint recording for logbook
 BUGFIX: Divetime seconds synced with stopwatch start
+NEW: End-of-Dive countdown displayed after surfacing
 
 
 New in 1.92 beta:
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Thu Jul 07 20:17:01 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Thu Jul 07 21:22:05 2011 +0200
@@ -85,8 +85,8 @@
 
 ;=============================================================================
 
-;#include "../OSTC_code_c_part2/shared_definitions.h"
-#include "shared_definitions.h"
+#include "../OSTC_code_c_part2/shared_definitions.h"
+;#include "shared_definitions.h"
 
 ;=============================================================================
 ; Reserve space for C-code data space. Eg.when calling log.
@@ -427,7 +427,7 @@
 #DEFINE	second_FD			flag4,7	; 2nd 0xFD in EEPROM found
 #DEFINE	second_FA			flag4,7	; 2nd 0xFA in EEPROM found
 
-;#DEfINE	unused flag5,0	; unused
+#DEfINE	timeout_display		flag5,0	; =1: The divemode timeout is displayed
 #DEFINE	eeprom_blockwrite	flag5,1	; EEPROM blockwrite active
 #DEFINE Flag_4      		flag5,2	; unused
 #DEFINE	low_battery_state	flag5,3	;=1 if battery low
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Thu Jul 07 20:17:01 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Thu Jul 07 21:22:05 2011 +0200
@@ -1558,8 +1558,6 @@
 	btfsc	high_altitude_mode		; In high altitude (Fly) mode?
 	bra		set_dive_modes3			; Yes
 
-;	bcf		divemode2				; Stop time
-
 	GETCUSTOM8	.0					; loads dive_threshold in WREG
 	movwf	sub_a+0					; dive_treshold is in cm
 	clrf	sub_a+1
@@ -1572,14 +1570,24 @@
 	btfsc	realdive				; Dive longer than one minute?
 	clrf 	timeout_counter			; Yes, reset timout counter
 
+set_dive_modes_common:
 	bsf		divemode				; (Re-)Set divemode flag
 	bsf		divemode2				; displayed divetime is running
+	btfsc	timeout_display			; Was the timeout displayed?
+	call	PLED_divemode_timeout_clear	; Yes, Clear (once)
 	return
 
 set_dive_modes2:
 	bcf		divemode2				; Stop time
 	btfss	realdive				; dive longer then one minute?
 	bcf		divemode				; no -> this was no real dive
+
+	btfss	divemode				; Are we still diving?
+	return							; No, return
+
+; Yes, show divemode timeout
+	btfss	dekostop_active			; Is a deco stop displayed?
+	call	PLED_divemode_timeout	; No, show the divemode timeout here...
 	return
 
 set_dive_modes3:
@@ -1593,10 +1601,8 @@
 	btfss	neg_flag	
 	bra		set_dive_modes2			; too shallow (rel_pressure<dive_threshold)
 	
-	bsf		divemode				; (Re-)Set divemode flag
-	bsf		divemode2				; displayed divetime is running
-	return
-
+	bra		set_dive_modes_common
+	
 set_powersafe:
 	btfsc	low_battery_state		; battery warning alread active?
 	bra		set_powersafe2			; Yes, but is it still required?
@@ -1744,6 +1750,7 @@
 	cpfsgt	EEDATA
 	call	PLED_brightness_full
 
+	bcf		timeout_display
 	clrf	menupos3
 	bcf		menu3_active
 	clrf	divesecs
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Thu Jul 07 20:17:01 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Thu Jul 07 21:22:05 2011 +0200
@@ -569,6 +569,47 @@
 
 ;=============================================================================
 
+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
+	call	PLED_standard_color
+	STRCPY  0x94						; "End of dive" icon
+	GETCUSTOM15	d'2'					; diveloop_timeout
+	movff	lo,sub_a+0
+	movff	hi,sub_a+1
+	movff	timeout_counter, sub_b+0
+	movff	timeout_counter2, sub_b+1
+	call	sub16						;  sub_c = sub_a - sub_b
+	movff	sub_c+0,lo
+	movff	sub_c+1,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
+	return
+
+PLED_divemode_timeout_clear:
+	WIN_TOP		.54
+	WIN_LEFT	.112
+	movlw		d'6'
+	movwf		temp1
+	bcf			timeout_display				; Clear flag
+	bra			PLED_display_clear_common_y1
+
 PLED_display_velocity:
 	ostc_debug	'v'		; Sends debug-information to screen if debugmode active
 	WIN_TOP		.90