changeset 219:b6dd54b3567c

NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
author heinrichsweikamp
date Tue, 01 Mar 2011 10:01:17 +0100
parents f4b79292e31f
children 3cf6649e89ac
files code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/divemode_menu.asm code_part1/OSTC_code_asm_part1/english_text.asm code_part1/OSTC_code_asm_part1/french_text.asm code_part1/OSTC_code_asm_part1/german_text.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm code_part1/OSTC_code_asm_part1/spanish_text.asm
diffstat 8 files changed, 170 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Sat Feb 26 17:53:43 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Tue Mar 01 10:01:17 2011 +0100
@@ -1,3 +1,8 @@
+New in 1.83 beta:
+BETA Version - Do NOT use for diving!
+BUGFIX: gas switch
+NEW: De/Activate gases underwater (Gaslist -> Gas6.. -> Actve?)
+
 New in 1.82 beta:
 BETA Version - Do NOT use for diving!
 CHANGE: Speed optimization in Logbook
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Sat Feb 26 17:53:43 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Tue Mar 01 10:01:17 2011 +0100
@@ -491,7 +491,7 @@
 
 #DEFINE	internal_eeprom_write2	flag13,0	;=1: start routine to access internal EEPROM BANK 1 via the UART
 #DEFINE	button_delay_done		flag13,1	;=1: Button was pressed for more then 500ms, start counting
-; free                          flag13,2	;=1: unused
+#DEFINE	display_set_active		flag13,2	;=1: De/Activate gases underwater menu is visible
 #DEFINE	deco_mode_changed		flag13,3	;=1: The Decomode was changes, show decomode description!
 #DEFINE	pled_velocity_display	flag13,4	;=1: Velocity is displayed 
 #DEFINE depth_greater_100m		flag13,5	;=1: Depth is greater then 100m
--- a/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Sat Feb 26 17:53:43 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode_menu.asm	Tue Mar 01 10:01:17 2011 +0100
@@ -107,6 +107,10 @@
 	movlw	d'7'						; Yes, Number of entries for this menu+1 = 7
 	btfsc	display_set_setpoint		; In SetPoint Menu?
 	movlw	d'5'						; Number of entries for this menu+1 = 5
+	btfsc	display_set_active			; De/Activate gases underwater menu is visible?
+	movlw	d'7'						; Number of entries for this menu+1 = 7
+	btfsc	display_set_xgas			; Are we in the Gas6 menu?
+	movlw	d'7'						; Number of entries for this menu+1 = 7
 	cpfseq	menupos						; =limit?
 	bra		test_switches_divemode_menu1; No!
 	movlw	d'1'						; Yes, reset to position 1!
@@ -115,16 +119,18 @@
 test_switches_divemode_menu1:
 ; Finally, check if menuposition 3 should be skipped (No customview with function displayed)
 
-	btfsc	display_set_gas				; Are we in the "Gaslist" or "SetPoint" menu?
+	btfsc	display_set_gas					; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
 	bra		test_switches_divemode_menu1a	; Skip test for sub menus
-	btfsc	display_set_xgas				; Are we in the "Gaslist" or "SetPoint" menu?
+	btfsc	display_set_xgas				; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
+	bra		test_switches_divemode_menu1a	; Skip test for sub menus
+	btfsc	display_set_active				; Are we in the "Gaslist", "SetPoint" or De/Activate gases menu?
 	bra		test_switches_divemode_menu1a	; Skip test for sub menus
 
 	movlw	d'3'
-	cpfseq	menupos						; At position 3?
-	bra		test_switches_divemode_menu1a; No
-	btfss	menu3_active				; Menu position 3 has functionality?
-	incf	menupos,F					; No, +1, skip to menuos=4
+	cpfseq	menupos							; At position 3?
+	bra		test_switches_divemode_menu1a	; No
+	btfss	menu3_active					; Menu position 3 has functionality?
+	incf	menupos,F						; No, +1, skip to menuos=4
 
 test_switches_divemode_menu1a:
 	call	PLED_divemenu_cursor		; update cursor
@@ -146,6 +152,9 @@
 	btfsc	display_set_xgas			; Are we in the "Set Gas" menu?
 	bra		divemenu_set_xgas2			; Yes, so configure gas or set menu and exit menu
 
+	btfsc	display_set_active			; Are we in the "De/Activate gases menu?" menu?
+	bra		divemenu_de_activate2		; Yes, so toggle active flag
+
 	btfsc	display_set_simulator		; Are we in the Divemode Simulator menu?
 	goto	divemode_menu_simulator2	; Yes, so adjust depth or set and exit
 
@@ -212,6 +221,81 @@
 
 	bra		timeout_divemenu2			; quit menu!
 
+divemenu_de_activate:
+	bsf		display_set_active			; Set display flag
+	bcf		display_set_xgas			; Clear Flag
+	call	PLED_clear_divemode_menu	; Clear Menu
+
+	call	PLED_de_activelist			; show (de)active gaslist
+
+	movlw	d'1'
+	movwf	menupos						; reset cursor
+	call	PLED_divemenu_cursor		; update cursor
+	return
+
+divemenu_de_activate2:					; Toggle active flag
+	dcfsnz	menupos,F
+	bra		divemenu_de_activate2_exit	; Exit, Quit, Abort
+	dcfsnz	menupos,F
+	bra		divemenu_de_activate2_g1	; Toggle Gas1
+	dcfsnz	menupos,F
+	bra		divemenu_de_activate2_g2	; Toggle Gas2
+	dcfsnz	menupos,F
+	bra		divemenu_de_activate2_g3	; Toggle Gas3
+	dcfsnz	menupos,F
+	bra		divemenu_de_activate2_g4	; Toggle Gas4
+	dcfsnz	menupos,F
+	bra		divemenu_de_activate2_g5	; Toggle Gas5
+	return	; should never be here
+
+divemenu_de_activate2_exit:
+	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
+	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
+	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
+	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
+	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
+	movlw	d'6'
+	movwf	menupos						; reset cursor
+	call	PLED_de_activelist			; show (de)active gaslist
+	return
+
 divemode_set_xgas:						; Set the extra gas...
 	bsf		display_set_xgas			; Set Flag
 	bcf		display_set_gas				; Clear Flag
@@ -362,7 +446,9 @@
 	bra		divemenu_set_xgas2_heplus	; Adjust He+
 	dcfsnz	menupos,F
 	bra		divemenu_set_xgas2_heminus	; Adjust He-
-	return
+	dcfsnz	menupos,F
+	bra		divemenu_de_activate		; Goto (De)active gases underwater list
+	return	; should never be here
 
 divemenu_set_xgas2_heminus:
 	read_int_eeprom		d'25'			; He value
@@ -611,6 +697,7 @@
 	bcf		display_set_xgas
 	bcf		display_set_setpoint
 	bcf		display_set_simulator
+	bcf		display_set_active
 	bcf		switch_left				; and debounce switches
 	bcf		switch_right
 	return
--- a/code_part1/OSTC_code_asm_part1/english_text.asm	Sat Feb 26 17:53:43 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/english_text.asm	Tue Mar 01 10:01:17 2011 +0100
@@ -383,4 +383,5 @@
     TCODE    .0,    .0,      "MOD:"                      ; 297 MOD:                 (max operating depth of a gas).
     TCODE    .0,    .0,      "END:"                      ; 298 END:                 (equivalent nitrogen depth of a gas).
     TCODE    .0,    .0,      "EAD:"                      ; 299 EAD:                 (equivalent air depth of a gas).
+	TCODE	 .100,	.125,	 "Active?"					 ; 300 Active? 				(Enable/Disable Gas underwater)
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/french_text.asm	Sat Feb 26 17:53:43 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/french_text.asm	Tue Mar 01 10:01:17 2011 +0100
@@ -384,4 +384,5 @@
     TCODE    .0,    .0,      "PMU:"                      ; 297 MOD:                 (max operating depth of a gas).
     TCODE    .0,    .0,      "PEN:"                      ; 298 END:                 (equivalent nitrogen depth of a gas).
     TCODE    .0,    .0,      "PEA:"                      ; 299 EAD:                 (equivalent air depth of a gas).
+	TCODE	 .100,	.125,	 "Active?"					 ; 300 Active? 				(Enable/Disable Gas underwater)
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/german_text.asm	Sat Feb 26 17:53:43 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/german_text.asm	Tue Mar 01 10:01:17 2011 +0100
@@ -383,4 +383,5 @@
     TCODE    .0,    .0,      "MOD:"                      ; 297 MOD:                 (max operating depth of a gas).
     TCODE    .0,    .0,      "END:"                      ; 298 END:                 (equivalent nitrogen depth of a gas).
     TCODE    .0,    .0,      "EAD:"                      ; 299 EAD:                 (equivalent air depth of a gas).
+	TCODE	 .100,	.125,	 "Active?"					 ; 300 Active? 				(Enable/Disable Gas underwater)
 ;=============================================================================
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sat Feb 26 17:53:43 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Tue Mar 01 10:01:17 2011 +0100
@@ -2304,6 +2304,7 @@
 	DISPLAYTEXT	.124			; O2 -
 	DISPLAYTEXT	.125			; He +
 	DISPLAYTEXT	.126			; He -
+	DISPLAYTEXTH	d'300'		; Active? (Enable/Disable Gas underwater)
 	return
 
 PLED_divemode_simulator_mask:
@@ -2488,6 +2489,69 @@
         rcall   PLED_decoplan_clear_bottom  ; Clear from next line
         return
 ;-----------------------------------------------------------------------------
+
+PLED_de_activelist:			; show (de)active gaslist
+	call	PLED_standard_color	
+    DISPLAYTEXT	.254			; Close
+
+	WIN_LEFT	.100
+	WIN_FONT	FT_SMALL
+	bsf		leftbind
+	
+	movlw	d'2'
+	movwf	wait_temp			; here: stores eeprom address for gas list
+	movlw	d'0'
+	movwf	waitms_temp			; here: stores row for gas list
+	clrf	hi					; here: Gas counter
+
+PLED_de_activelist_loop:
+	incf	hi,F				; Increase Gas
+	movlw	d'4'
+	addwf	wait_temp,F			; Increase eeprom address for gas list
+	movlw	d'25'
+	addwf	waitms_temp,F		; Increase row
+	WIN_LEFT	.100
+	movff	waitms_temp,win_top ; Set Row
+	
+	STRCPY  "G"
+	movff	hi,lo			; copy gas number
+	output_8				; display gas number
+    PUTC    ':'
+	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
+	output_8				; outputs into Postinc2!
+    PUTC    '/'
+	incf	EEADR,F			; Gas #hi: %He - Set address in internal EEPROM
+	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
+	call	read_eeprom		; get byte (stored in EEDATA)
+	PLED_color_code		warn_gas_in_gaslist		; Color-code output	(%O2 in "EEDATA")
+; Check if gas needs to be greyed-out (inactive)	
+	read_int_eeprom		d'27'	; read flag register
+	movff	hi,lo			; copy gas number
+PLED_de_activelist_loop1:
+	rrcf	EEDATA			; roll flags into carry
+	decfsz	lo,F			; max. 5 times...
+	bra		PLED_de_activelist_loop1
+
+	movlw	color_grey
+	btfss	STATUS,C		; test carry
+	call	PLED_set_color	; grey out inactive gases!
+	
+	call	word_processor	
+	call	PLED_standard_color	
+
+	movlw	d'5'			; list all five gases
+	cpfseq	hi				; All gases shown?
+	bra		PLED_de_activelist_loop	; No
+
+	return					;  return 
+
+
 PLED_gas_list:
 	ostc_debug	'm'		; Sends debug-information to screen if debugmode active
 
@@ -2546,8 +2610,7 @@
 	cpfseq	hi				; All gases shown?
 	bra		PLED_gas_list_loop	; No
 
-	DISPLAYTEXT	d'122'		; Gas 6..
-
+	DISPLAYTEXT		d'122'		; Gas 6..
 	return					;  return (OC mode)
 
 PLED_splist_start:	
@@ -2619,8 +2682,8 @@
 	movlw	d'100'
 	dcfsnz	temp1,F
 	movlw	d'125'
+
 	movff	WREG,win_top
-
     STRCPY_PRINT "\xB7"				; Cursor
 	return
 
--- a/code_part1/OSTC_code_asm_part1/spanish_text.asm	Sat Feb 26 17:53:43 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/spanish_text.asm	Tue Mar 01 10:01:17 2011 +0100
@@ -383,4 +383,5 @@
     TCODE    .0,    .0,      "MOD:"                      ; 297 MOD:                 (max operating depth of a gas).
     TCODE    .0,    .0,      "END:"                      ; 298 END:                 (equivalent nitrogen depth of a gas).
     TCODE    .0,    .0,      "EAD:"                      ; 299 EAD:                 (equivalent air depth of a gas).
+	TCODE	 .100,	.125,	 "Active?"					 ; 300 Active? 				(Enable/Disable Gas underwater)
 ;=============================================================================