changeset 627:8d2dc109ecfc

NEW: Gaslist highlights "better gas" in divemode
author heinrichsweikamp
date Sat, 11 Aug 2012 16:55:14 +0200
parents bab5a9fc1b10
children b4849ef90654
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, 34 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Sat Aug 11 15:30:30 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Sat Aug 11 16:55:14 2012 +0200
@@ -1,3 +1,8 @@
+New in 2.51:
+BETA Version - Do NOT use for diving!
+NEW: Saves last selected custom view for surface mode and dive mode
+NEW: Gaslist highlights "better gas" in divemode
+
 New in 2.50 Stable:
 INFO: This update will reset all Custom Functions and gases to defaults
 BUGFIX: Divetime display in Gauge mode
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Sat Aug 11 15:30:30 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Sat Aug 11 16:55:14 2012 +0200
@@ -358,6 +358,7 @@
 total_divetime_seconds	res 2	; counts dive seconds regardless of CF01 (18h max.)
 
 safety_stop_countdown	res 1	; counts seconds of safety stop
+better_gas_number		res 1	; number (1-5) of the "better gas" in divemode, =0: no better gas available
 
 ASSERT_BANK1    MACRO   tag
     Ifdef   __DEBUG
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Sat Aug 11 15:30:30 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Sat Aug 11 16:55:14 2012 +0200
@@ -1064,7 +1064,7 @@
 ;=============================================================================
 ; Compare all enabled gas in list, to see if a better one is available.
 ;
-; Output: better_gas_available
+; Output: better_gas_available, better_gas_number
 ;
 check_gas_change:					; Checks if a better gas should be selected (by user)
 	bcf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
@@ -1090,6 +1090,8 @@
 	movf	xC+0,W					; load depth in m into WREG
 	cpfsgt	EEDATA					; gas_change_depth < current depth?
 	bra		check_gas_change2		; No, check next gas
+	movlw	.1
+	movwf	better_gas_number		; number (1-5) of the "better gas" in divemode, =0: no better gas available
 	movlw	better_gas_window
 	subwf	EEDATA,W				; Change depth-better_gas_window
 	cpfslt	xC+0					; current depth<Change depth-better_gas_window?
@@ -1110,6 +1112,8 @@
 	movf	xC+0,W					; load depth in m into WREG
 	cpfsgt	EEDATA					; gas_change_depth < current depth?
 	bra		check_gas_change3		; No, check next gas
+	movlw	.2
+	movwf	better_gas_number		; number (1-5) of the "better gas" in divemode, =0: no better gas available
 	movlw	better_gas_window
 	subwf	EEDATA,W				; Change depth-better_gas_window
 	cpfslt	xC+0					; current depth<Change depth-better_gas_window?
@@ -1130,6 +1134,8 @@
 	movf	xC+0,W					; load depth in m into WREG
 	cpfsgt	EEDATA					; gas_change_depth < current depth?
 	bra		check_gas_change4		; No, check next gas
+	movlw	.3
+	movwf	better_gas_number		; number (1-5) of the "better gas" in divemode, =0: no better gas available
 	movlw	better_gas_window
 	subwf	EEDATA,W				; Change depth-better_gas_window
 	cpfslt	xC+0					; current depth<Change depth-better_gas_window?
@@ -1150,6 +1156,8 @@
 	movf	xC+0,W					; load depth in m into WREG
 	cpfsgt	EEDATA					; gas_change_depth < current depth?
 	bra		check_gas_change5		; No, check next gas
+	movlw	.4
+	movwf	better_gas_number		; number (1-5) of the "better gas" in divemode, =0: no better gas available
 	movlw	better_gas_window
 	subwf	EEDATA,W				; Change depth-better_gas_window
 	cpfslt	xC+0					; current depth<Change depth-better_gas_window?
@@ -1170,12 +1178,17 @@
 	movf	xC+0,W					; load depth in m into WREG
 	cpfsgt	EEDATA					; gas_change_depth < current depth?
 	bra		check_gas_change6		; No, check next gas
+	movlw	.5
+	movwf	better_gas_number		; number (1-5) of the "better gas" in divemode, =0: no better gas available
 	movlw	better_gas_window
 	subwf	EEDATA,W				; Change depth-better_gas_window
 	cpfslt	xC+0					; current depth<Change depth-better_gas_window?
 	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
 
 check_gas_change6:
+	btfss	better_gas_available	; Is a better gas available
+	clrf	better_gas_number		; No, clear better gas register
+
 	btfsc	is_bailout				;=1: CC mode, but bailout active!
 	bra		check_gas_change7		; In bailout, blink better gas (if required)
 
@@ -1902,6 +1915,7 @@
 	bcf		menu3_active
 	clrf	divesecs
 	clrf	samplesecs
+	clrf	better_gas_number			; number (1-5) of the "better gas" in divemode, =0: no better gas available
 	clrf	apnoe_timeout_counter		; timeout in minutes
 	clrf 	timeout_counter				; takes care of the timeout (Low byte)
 	clrf 	timeout_counter2			; takes care of the timeout (High byte)
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sat Aug 11 15:30:30 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sat Aug 11 16:55:14 2012 +0200
@@ -2907,7 +2907,6 @@
 	addwf	waitms_temp,F		; Increase row
 	WIN_LEFT	.100
 	movff	waitms_temp,win_top ; Set Row
-	
 	STRCPY  TXT_GAS1
 	movff	hi,lo			; copy gas number
 	output_8				; display gas number
@@ -2925,9 +2924,21 @@
 	decf	EEADR,F			; Gas #hi: %O2 - Set address in internal EEPROM
 	call	read_eeprom		; get byte (stored in EEDATA)
 	PLED_color_code		warn_gas_in_gaslist		; Color-code output	(%O2 in "EEDATA")
+
+; Check if the "better gas" should be highlighted
+
+	WIN_INVERT	.0					; Init new Wordprocessor	
+	movf	better_gas_number,W	; better gas 1-5?
+	cpfseq	hi					; compare with gas#
+	bra		PLED_gas_list_loop2	; No equal, skip
+	
+	movlw	color_yellow			; Blink in yellow
+    call	PLED_set_color
+	WIN_INVERT	.1					; Init new Wordprocessor	
+	
+PLED_gas_list_loop2:
 ; Check if gas needs to be greyed-out (inactive)
 	movff	gaslist_active, EEDATA		; Work with sorted list
-;	read_int_eeprom		d'27'	; read flag register
 	movff	hi,lo			; copy gas number
 PLED_gas_list_loop1:
 	rrcf	EEDATA			; roll flags into carry