changeset 416:3abf9d7dafae

diabling uart module when no USB is attached
author heinrichsweikamp
date Mon, 18 Jul 2011 09:44:25 +0200
parents d022c62a1df5
children c72461857a74
files code_part1/OSTC_code_asm_part1/divemode.asm code_part1/OSTC_code_asm_part1/menu_logbook.asm code_part1/OSTC_code_asm_part1/surfmode.asm
diffstat 3 files changed, 12 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Sun Jul 17 17:23:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Mon Jul 18 09:44:25 2011 +0200
@@ -383,40 +383,6 @@
 	btfss	gaslist_active,4    			; Apply depth?
 	clrf	EEDATA							; No, clear!
 	movff	EEDATA,char_I_deco_gas_change+4	; Yes!
-
-; Debugger
-;	call	enable_rs232	
-;	movff	char_I_deco_He_ratio+4,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_N2_ratio+4,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_He_ratio+3,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_N2_ratio+3,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_He_ratio+2,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_N2_ratio+2,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_He_ratio+1,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_N2_ratio+1,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_He_ratio,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_N2_ratio,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_gas_change5,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	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	
-;	movff	char_I_deco_gas_change2,TXREG
-;	call	rs232_wait_tx				; wait for UART
-;	movff	char_I_deco_gas_change,TXREG
-;	call	rs232_wait_tx				; wait for UART
-
 	return
 
 ;-----------------------------------------------------------------------------
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Sun Jul 17 17:23:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Mon Jul 18 09:44:25 2011 +0200
@@ -29,7 +29,6 @@
 
 menu_logbook:
 	bcf			return_from_profileview				; clear some flags
-;call	enable_rs232
 menu_logbook1:
 	bcf			logbook_header_drawn
 	call		PLED_ClearScreen				; Clear screen
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Sun Jul 17 17:23:25 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Mon Jul 18 09:44:25 2011 +0200
@@ -31,7 +31,6 @@
 	call	PLED_brightness_full			;max. brightness
 	
 	call 	I2CReset
-	call	enable_rs232
 	call	PLED_boot
 	call	PLED_serial						; Show OSTC serial and firmware version
 	call	PLED_clock						; display time
@@ -328,7 +327,12 @@
 
 	bsf		TRISC,1						; CHRG_OUT high impedance
 
-	; Charger inactive or ready
+	; -> Charger inactive or ready
+
+	; Disable when no USB power is attached
+	btfsc	RCSTA,7						; RS232 already disabled
+	call	disable_rs232				; No, disable UART module
+
 	btfss	charge_done					; charge done?
 	bra		test_charger2				; No, add incomplete cycle!
 	
@@ -396,6 +400,9 @@
 	return	
 
 show_cv_active:							; CV mode
+	; Enable only when USB power attached
+	btfss	RCSTA,7						; RS232 already enabled?
+	call	enable_rs232				; No, start UART module
 	bsf		LED_red
 	WAITMS	d'100'
 	bcf		LED_red
@@ -405,6 +412,9 @@
 	return
 
 show_cc_active:							; CC mode
+	; Enable only when USB power attached
+	btfss	RCSTA,7						; RS232 already enabled?
+	call	enable_rs232				; No, start UART module
 	bsf		LED_red
 	bsf		charge_started				; Charger started in CC mode
 	bcf		charge_done					; Charge cycle not finished