changeset 221:448478ceccea

new sorted_gaslist_active flag register
author heinrichsweikamp
date Tue, 01 Mar 2011 11:48:11 +0100
parents 3cf6649e89ac
children 638f8e17bd51
files code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/divemode_menu.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm
diffstat 4 files changed, 70 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Tue Mar 01 10:07:58 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Tue Mar 01 11:48:11 2011 +0100
@@ -325,8 +325,9 @@
 logbook_temp5           res 1   ; Temp used in logbook display&Divemode&Gassetup
 logbook_temp6           res 1   ; Temp used in logbook display&Divemode&Gassetup
 
-convert_value_temp      res 3    ; used in menu_battery_state_convert_date
+convert_value_temp      res 3   ; used in menu_battery_state_convert_date
 time_correction_value   res 1   ; Adds to Seconds on midnight
+sorted_gaslist_active	res 1	; Holds flags for active gases for the sorted list
 
 ;=============================================================================
 ; C-code Routines
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Mar 01 10:07:58 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Mar 01 11:48:11 2011 +0100
@@ -357,31 +357,30 @@
 	movff	EEDATA, char_I_deco_N2_ratio1; = N2!
 
 ; Now, set change depth. Inactive gases have depth=0!
-	read_int_eeprom		d'118'		; read gas_change_depth Gas1
-	movff	EEDATA,char_I_deco_gas_change5
-	read_int_eeprom		d'119'		; read gas_change_depth Gas2
-	movff	EEDATA,char_I_deco_gas_change4
-	read_int_eeprom		d'120'		; read gas_change_depth Gas3
-	movff	EEDATA,char_I_deco_gas_change3
-	read_int_eeprom		d'121'		; read gas_change_depth Gas4
-	movff	EEDATA,char_I_deco_gas_change2
-	read_int_eeprom		d'122'		; read gas_change_depth Gas5
-	movff	EEDATA,char_I_deco_gas_change1
-; If gas is inactive, overwrite char_I_deco_gas_changex with zero
-	read_int_eeprom		d'27'			; read flag register
-	clrf	WREG						; Clear WREG
+	read_int_eeprom		d'118'				; read gas_change_depth Gas1
+	btfss	sorted_gaslist_active,0			; Apply depth?
+	clrf	EEDATA							; No, clear!
+	movff	EEDATA,char_I_deco_gas_change5	; Yes!
+
+	read_int_eeprom		d'119'				; read gas_change_depth Gas2
+	btfss	sorted_gaslist_active,1			; Apply depth?
+	clrf	EEDATA							; No, clear!
+	movff	EEDATA,char_I_deco_gas_change4	; Yes!
 
-	btfss	EEDATA,0
-	movff	WREG,char_I_deco_gas_change1; Gas1
-	btfss	EEDATA,1
-	movff	WREG,char_I_deco_gas_change2; Gas2
-	btfss	EEDATA,2
-	movff	WREG,char_I_deco_gas_change3; Gas3
-	btfss	EEDATA,3
-	movff	WREG,char_I_deco_gas_change4; Gas4
-	btfss	EEDATA,4
-	movff	WREG,char_I_deco_gas_change5; Gas5
-	
+	read_int_eeprom		d'120'				; read gas_change_depth Gas3
+	btfss	sorted_gaslist_active,2			; Apply depth?
+	clrf	EEDATA							; No, clear!
+	movff	EEDATA,char_I_deco_gas_change3	; Yes!
+
+	read_int_eeprom		d'121'				; read gas_change_depth Gas4
+	btfss	sorted_gaslist_active,3			; Apply depth?
+	clrf	EEDATA							; No, clear!
+	movff	EEDATA,char_I_deco_gas_change2	; Yes!
+
+	read_int_eeprom		d'122'				; read gas_change_depth Gas5
+	btfss	sorted_gaslist_active,4			; Apply depth?
+	clrf	EEDATA							; No, clear!
+	movff	EEDATA,char_I_deco_gas_change1	; Yes!
 
 ; Debugger
 ;	call	enable_rs232	
@@ -410,7 +409,7 @@
 ;	movff	char_I_deco_gas_change4,TXREG
 ;	call	rs232_wait_tx				; wait for UART
 ;	movff	char_I_deco_gas_change3,TXREG
-;	call	rs232_wait_tx				; wait for UART
+;	call	rs232_wait_tx				; wait for UART	
 ;	movff	char_I_deco_gas_change2,TXREG
 ;	call	rs232_wait_tx				; wait for UART
 ;	movff	char_I_deco_gas_change,TXREG
@@ -1664,4 +1663,25 @@
 	subfwb	EEDATA,F					; minus O2
 	movff	EEDATA, char_I_N2_ratio		; = N2!
 
+; Configure sorted_gaslist_active flag register
+	clrf	sorted_gaslist_active	; Clear all flags
+	read_int_eeprom		d'118'		; read gas_change_depth Gas1
+	tstfsz	EEDATA					; =0m?
+	bsf		sorted_gaslist_active,0	; No, Set Flag for Gas1
+
+	read_int_eeprom		d'119'		; read gas_change_depth Gas2
+	tstfsz	EEDATA					; =0m?
+	bsf		sorted_gaslist_active,1	; No, Set Flag for Gas2
+
+	read_int_eeprom		d'120'		; read gas_change_depth Gas3
+	tstfsz	EEDATA					; =0m?
+	bsf		sorted_gaslist_active,2	; No, Set Flag for Gas3
+
+	read_int_eeprom		d'121'		; read gas_change_depth Gas4
+	tstfsz	EEDATA					; =0m?
+	bsf		sorted_gaslist_active,3	; No, Set Flag for Gas4
+
+	read_int_eeprom		d'122'		; read gas_change_depth Gas5
+	tstfsz	EEDATA					; =0m?
+	bsf		sorted_gaslist_active,4	; No, Set Flag for Gas5
 	return
--- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Tue Mar 01 10:07:58 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Tue Mar 01 11:48:11 2011 +0100
@@ -252,45 +252,35 @@
 	bra		timeout_divemenu2			; quit underwater menu!
 
 divemenu_de_activate2_g1:
-	read_int_eeprom		d'27'			; read flag register
-	btg		EEDATA,.0					; Toggle flag
-	write_int_eeprom	d'27'			; write flag register
+	btg		sorted_gaslist_active,0		; Toggle flag
 	movlw	d'2'
 	movwf	menupos						; reset cursor
 	call	PLED_de_activelist			; show (de)active gaslist
 	return
 
 divemenu_de_activate2_g2:
-	read_int_eeprom		d'27'			; read flag register
-	btg		EEDATA,.1					; Toggle flag
-	write_int_eeprom	d'27'			; write flag register
+	btg		sorted_gaslist_active,1		; Toggle flag
 	movlw	d'3'
 	movwf	menupos						; reset cursor
 	call	PLED_de_activelist			; show (de)active gaslist
 	return
 
 divemenu_de_activate2_g3:
-	read_int_eeprom		d'27'			; read flag register
-	btg		EEDATA,.2					; Toggle flag
-	write_int_eeprom	d'27'			; write flag register
+	btg		sorted_gaslist_active,2		; Toggle flag
 	movlw	d'4'
 	movwf	menupos						; reset cursor
 	call	PLED_de_activelist			; show (de)active gaslist
 	return
 
 divemenu_de_activate2_g4:
-	read_int_eeprom		d'27'			; read flag register
-	btg		EEDATA,.3					; Toggle flag
-	write_int_eeprom	d'27'			; write flag register
+	btg		sorted_gaslist_active,3		; Toggle flag
 	movlw	d'5'
 	movwf	menupos						; reset cursor
 	call	PLED_de_activelist			; show (de)active gaslist
 	return
 
 divemenu_de_activate2_g5:
-	read_int_eeprom		d'27'			; read flag register
-	btg		EEDATA,.4					; Toggle flag
-	write_int_eeprom	d'27'			; write flag register
+	btg		sorted_gaslist_active,4		; Toggle flag
 	movlw	d'6'
 	movwf	menupos						; reset cursor
 	call	PLED_de_activelist			; show (de)active gaslist
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Mar 01 10:07:58 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Mar 01 11:48:11 2011 +0100
@@ -2498,7 +2498,7 @@
 	WIN_FONT	FT_SMALL
 	bsf		leftbind
 	
-	movlw	d'2'
+	movlw	d'92'
 	movwf	wait_temp			; here: stores eeprom address for gas list
 	movlw	d'0'
 	movwf	waitms_temp			; here: stores row for gas list
@@ -2513,10 +2513,7 @@
 	WIN_LEFT	.100
 	movff	waitms_temp,win_top ; Set Row
 	
-	STRCPY  "G"
-	movff	hi,lo			; copy gas number
-	output_8				; display gas number
-    PUTC    ':'
+  	lfsr	FSR2,letter
 	movff	wait_temp, EEADR; Gas #hi: %O2 - Set address in internal EEPROM
 	call	read_eeprom		; get byte (stored in EEDATA)
 	movff	EEDATA,lo		; copy to lo
@@ -2526,12 +2523,20 @@
 	call	read_eeprom		; get byte (stored in EEDATA)
 	movff	EEDATA,lo		; copy to lo
 	output_8				; outputs into Postinc2!
-
-	decf	EEADR,F			; Gas #hi: %O2 - Set address in internal EEPROM
+    PUTC    '@'
+
+	movlw	d'117'
+	addwf	hi,W
+	movwf	EEADR			; Point to Change depth
+
 	call	read_eeprom		; get byte (stored in EEDATA)
-	PLED_color_code		warn_gas_in_gaslist		; Color-code output	(%O2 in "EEDATA")
+	movff	EEDATA,lo		; copy to lo
+	output_8				; outputs into Postinc2!
+	
+;	call	PLED_standard_color	
+
 ; Check if gas needs to be greyed-out (inactive)	
-	read_int_eeprom		d'27'	; read flag register
+	movff	sorted_gaslist_active,EEDATA	; Get flag register
 	movff	hi,lo			; copy gas number
 PLED_de_activelist_loop1:
 	rrcf	EEDATA			; roll flags into carry
@@ -2541,7 +2546,10 @@
 	movlw	color_grey
 	btfss	STATUS,C		; test carry
 	call	PLED_set_color	; grey out inactive gases!
-	
+
+	dcfsnz	hi,W			; First in List?
+	call	PLED_standard_color
+
 	call	word_processor	
 	call	PLED_standard_color