changeset 239:3ed240d60341

High altitude (Plane/Fly) mode added
author heinrichsweikamp
date Mon, 21 Mar 2011 13:31:38 +0100
parents 9581e48a914f
children d995e220ddac
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 code_part1/OSTC_code_asm_part1/start.asm
diffstat 5 files changed, 45 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Sun Mar 20 17:55:21 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Mon Mar 21 13:31:38 2011 +0100
@@ -1,6 +1,7 @@
 New in 1.84 beta:
 BETA Version - Do NOT use for diving!
 BUGFIX: NoFly time should not be reseted after dive simulation.
+NEW: High altitude (Plane/Fly) mode added
 
 New in 1.83 beta:
 BETA Version - Do NOT use for diving!
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Mar 20 17:55:21 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Mon Mar 21 13:31:38 2011 +0100
@@ -34,7 +34,7 @@
 ;#DEFINE	GERMAN							; Use german_text.asm
 ;#DEFINE	SPANISH							; Use spanish_text.asm
 
-#DEFINE	__DEBUG	; 
+;#DEFINE	__DEBUG	; 
 
 #DEFINE	logbook_profile_version	0x20        ; Do not touch!
 #DEFINE	T0CON_debounce	b'00000000'         ; Timer0 Switch Debounce
@@ -452,7 +452,7 @@
 #DEFINE	FLAG_active_descent		flag8,3	;=1: A Descent in Apnoe mode is active
 #DEFINE	display_see_deco		flag8,4	;=1: Display decoplan in Divemode
 #DEFINE	display_set_gas			flag8,5	;=1: Display Gaslist menu in Divemode
-;free flag8,6	;=1: 
+#DEFINE	high_altitude_mode		flag8,6	;=1: Unit was manually turned on with ambient pressure <880mBar
 #DEFINE	rs232_recieve_overflow	flag8,7	;=1: An RS232 timeout overflow occoured
 
 #DEFINE	nofly_active			flag9,0	;=1: Do not fly!
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Sun Mar 20 17:55:21 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Mon Mar 21 13:31:38 2011 +0100
@@ -1409,24 +1409,25 @@
 	return
 
 set_dive_modes:
+	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
-
 	movff	rel_pressure+0,sub_b+0
 	movff	rel_pressure+1,sub_b+1
-		
-	call	sub16						; sub_c = sub_a - sub_b
+	call	sub16					; sub_c = sub_a - sub_b
 	
 	btfss	neg_flag	
-	bra		set_dive_modes2				; too shallow (rel_pressure<dive_threshold)
+	bra		set_dive_modes2			; too shallow (rel_pressure<dive_threshold)
 
-	btfsc	realdive					; Dive longer than one minute?
-	clrf 	timeout_counter
+	btfsc	realdive				; Dive longer than one minute?
+	clrf 	timeout_counter			; Yes, reset timout counter
 
-	bsf		divemode
+	bsf		divemode				; (Re-)Set divemode flag
 	bsf		divemode2				; displayed divetime is running
 	return
 
@@ -1435,6 +1436,22 @@
 	bcf		divemode					; no -> this was no real dive
 	return
 
+set_dive_modes3:
+	movlw	HIGH	d'1075'			; hard-wired 1075mBar threshold
+	movwf	sub_a+1
+	movlw	LOW		d'1075'			; hard-wired 1075mBar threshold
+	movwf	sub_a+0
+	movff	rel_pressure+0,sub_b+0
+	movff	rel_pressure+1,sub_b+1
+	call	sub16					; sub_c = sub_a - sub_b
+	
+	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
+
 set_powersafe:
 	btfsc	low_battery_state		; battery warning alread active?
 	bra		set_powersafe2			; Yes, but is it still required?
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sun Mar 20 17:55:21 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Mon Mar 21 13:31:38 2011 +0100
@@ -1758,7 +1758,12 @@
 	WIN_LEFT	.1
 	WIN_FONT 	FT_SMALL
 	WIN_INVERT	.0					; Init new Wordprocessor
-	call	PLED_standard_color
+
+	btfss	high_altitude_mode		; In high altitude mode?
+	call	PLED_standard_color		; No
+	btfsc	high_altitude_mode		; In high altitude mode?
+	call	PLED_warnings_color		; Yes, display ambient pressure in red
+
 
 	lfsr	FSR2,letter
 	movff	amb_pressure+0,lo
@@ -1767,6 +1772,7 @@
 	output_16
 	bcf		leftbind
 	STRCAT_PRINT  "mbar "
+	call	PLED_standard_color		; Reset color
 	return
 
 update_batt_voltage_divemode:
--- a/code_part1/OSTC_code_asm_part1/start.asm	Sun Mar 20 17:55:21 2011 +0100
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Mon Mar 21 13:31:38 2011 +0100
@@ -167,6 +167,17 @@
 	bcf     flag1,0
 	movff	flag1,win_flags			; store in Bank0 register
 	clrf	flag1					; Clear flag1 (again)
+
+	; Select high altitude (Fly) mode?
+	movff	last_surfpressure_30min+0,sub_b+0
+	movff	last_surfpressure_30min+1,sub_b+1
+	movlw	HIGH	d'880'
+	movwf	sub_a+1
+	movlw	LOW		d'880'			; Hard-wired 880mBar
+	movwf	sub_a+0
+	call	sub16					; sub_c = sub_a - sub_b
+	btfss	neg_flag				; Result negative (Ambient>880mBar)?
+	bsf		high_altitude_mode		; No, Set Flag!
 	
 	; Should we disable sleep (hardware emulator)
 	movlw	.0