changeset 399:1677453fbbe3

Merge 397 with 398
author heinrichsweikamp
date Sun, 26 Jun 2011 12:27:28 +0200
parents ab962c4b19d6 (diff) 6f7965ec5f49 (current diff)
children 40b282821dcf
files code_part1/OSTC_code_asm_part1/definitions.asm code_part1/OSTC_code_asm_part1/pled_outputs.asm
diffstat 12 files changed, 93 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -75,7 +75,7 @@
 get_battery_voltage3:
     SAFE_2BYTE_COPY amb_pressure, sub_b
 
-	movlw	LOW		d'15001'			; must be lower then 15001mBar
+	movlw	LOW		d'15001'			; must be lower then 15001mbar
 	movwf	sub_a+0
 	movlw	HIGH	d'15001'
 	movwf	sub_a+1
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Sun Jun 26 12:27:28 2011 +0200
@@ -1,6 +1,6 @@
 New in 1.92 beta:
 BETA Version - Do NOT use for diving!
-
+BUGFIX: warning color for ppO2>3,3bar and ppO2<6,55bar fixed
 
 New in 1.91 beta:
 BETA Version - Do NOT use for diving!
@@ -203,10 +203,10 @@
 BUGFIX: History not updated in Simulator mode
 BUGFIX: Fixed-Setpoint (minimum) ppO2 limited to physically possible value
 NEW: Depth, CNS, GF, ppO2 and Velocity are Color-coded (OSTC Mk.2 Only)
-NEW: CF43: Depth [mBar] for color-code display (OSTC Mk.2 Only)
+NEW: CF43: Depth [mbar] for color-code display (OSTC Mk.2 Only)
 NEW: CF44: CNS [%] for color-code display (OSTC Mk.2 Only)
 NEW: CF45: GF [%] for color-code display (OSTC Mk.2 Only)
-NEW: CF46: ppO2 [cBar] for color-code display (OSTC Mk.2 Only)
+NEW: CF46: ppO2 [cbar] for color-code display (OSTC Mk.2 Only)
 NEW: CF47: Velocity [m/min] for color-code display (OSTC Mk.2 Only)
 CHANGE: Change of color layout (OSTC Mk.2 Only)
 
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -58,7 +58,7 @@
 #DEFINE	warn_depth		d'1'
 #DEFINE	warn_cns		d'2'
 #DEFINE	warn_gf			d'3'
-;#DEFINE warn_ppo2		d'4'
+#DEFINE	warn_ppo2		d'4'
 #DEFINE warn_velocity	d'5'
 #DEFINE warn_ceiling	d'6'
 #DEFINE	warn_gas_in_gaslist	d'7'
@@ -234,12 +234,12 @@
 OFF             res 2
 SENS            res 2
 
-amb_pressure_avg res 2          ; ambient pressure summing buffer[mBar]
-amb_pressure    res 2           ; ambient pressure [mBar]
-rel_pressure    res 2		    ; amb_pressure - surface pressure [mBar]
-max_pressure    res 2           ; Max. pressure for the dive [mBar]
-avr_rel_pressure res 2          ; Average rel. pressure (Average depth) for the dive [mBar], Resettable
-avr_rel_pressure_total res 2    ; Average rel. pressure (Average depth) for the dive [mBar], Non-Resettable
+amb_pressure_avg res 2          ; ambient pressure summing buffer[mbar]
+amb_pressure    res 2           ; ambient pressure [mbar]
+rel_pressure    res 2		    ; amb_pressure - surface pressure [mbar]
+max_pressure    res 2           ; Max. pressure for the dive [mbar]
+avr_rel_pressure res 2          ; Average rel. pressure (Average depth) for the dive [mbar], Resettable
+avr_rel_pressure_total res 2    ; Average rel. pressure (Average depth) for the dive [mbar], Non-Resettable
 last_pressure   res 2
 temperature_avg res 2           ; Temperature summing buffer.
 temperature     res 2           ; Final temperature. SIGNED.
@@ -290,7 +290,7 @@
 i2c_temp                res 1   ; I²C timeout counter
 i2c_temp2               res 1   ; 200
 
-sim_pressure            res 2   ; hold simulated pressure in mBar if in Simulator mode
+sim_pressure            res 2   ; hold simulated pressure in mbar if in Simulator mode
 
 profile_temp            res 2   ; temp variable for profile view
 profile_temp2           res 2   ; temp variable for profile view
@@ -460,7 +460,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
-#DEFINE	high_altitude_mode		flag8,6	;=1: Unit was manually turned on with ambient pressure <880mBar
+#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	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -90,7 +90,7 @@
 
 ; Tasks only for ppO2 mode
 diveloop_loop1c:
-	call	PLED_const_ppO2_value			; display const ppO2 setting in [Bar]
+	call	PLED_const_ppO2_value			; display const ppO2 setting in [bar]
 	call	calc_deko_divemode				; calculate decompression and display result (any two seconds)
 	btfsc	is_bailout						; Are we in Bailout mode?
 	call	check_ppO2_bail					; Yes, display ppO2 (If required)
@@ -118,7 +118,7 @@
 	bcf		update_divetime				; clear flag
 
 	btfsc	FLAG_const_ppO2_mode		; only in const_ppO2_mode
-	call	PLED_const_ppO2_value		; display const ppO2 setting in [Bar]
+	call	PLED_const_ppO2_value		; display const ppO2 setting in [bar]
 	btfsc	ppO2_show_value				; show ppO2?
 	call	check_ppO2					; check ppO2 and displays warning if required
 
@@ -415,7 +415,7 @@
 	return
 
 ;-----------------------------------------------------------------------------
-; calculate ppO2 in 0.01Bar (e.g. 150 = 1.50 Bar ppO2)
+; calculate ppO2 in 0.01bar (e.g. 150 = 1.50 bar ppO2)
 set_actual_ppo2:
     SAFE_2BYTE_COPY amb_pressure, xA    ; P_amb in milibar (1000 = 1.000 bar).
 	movlw		d'10'
@@ -743,7 +743,7 @@
 ; SetPoint change appended to information due to compatibility reasons
 	btfss	setpoint_changed		; Check flag	
 	bra		store_dive_data5
-	movff	char_I_const_ppO2,WREG	; SetPoint in cBar
+	movff	char_I_const_ppO2,WREG	; SetPoint in cbar
 	call	write_external_eeprom
 	bcf		setpoint_changed		; Clear this event
 
@@ -838,7 +838,7 @@
 	movlw	d'39'			;77 when called every second....
 	movwf	xB+0
 	clrf	xB+1
-	call	mult16x16					; differential pressure in mBar*77...
+	call	mult16x16					; differential pressure in mbar*77...
 	movff	xC+0,divA+0
 	movff	xC+1,divA+1
 	movlw	d'7'
@@ -888,7 +888,7 @@
 	call		mult16x16				; char_I_O2_ratio * p_amb/10
 
 ; Check very high ppO2 manually
-	tstfsz		xC+2					; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar?
+	tstfsz		xC+2					; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
 	bra			check_ppO2_bail2		; Yes, display Value!
 
 ; Check if ppO2 should be displayed
@@ -1181,7 +1181,7 @@
 
 	movff	apnoe_max_pressure+0,lo
 	movff	apnoe_max_pressure+1,hi
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 	movff	lo,apnoe_max_pressure+0
 	movff	hi,apnoe_max_pressure+1
 	
@@ -1194,7 +1194,7 @@
 end_dive1:
 	movff	max_pressure+0,lo
 	movff	max_pressure+1,hi
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 	movff	lo,max_pressure+0
 	movff	hi,max_pressure+1
 	
@@ -1574,9 +1574,9 @@
 	return
 
 set_dive_modes3:
-	movlw	HIGH	d'1075'			; hard-wired 1075mBar threshold
+	movlw	HIGH	d'1075'			; hard-wired 1075mbar threshold
 	movwf	sub_a+1
-	movlw	LOW		d'1075'			; hard-wired 1075mBar threshold
+	movlw	LOW		d'1075'			; hard-wired 1075mbar threshold
 	movwf	sub_a+0
     SAFE_2BYTE_COPY rel_pressure, sub_b
 	call	sub16					; sub_c = sub_a - sub_b
@@ -1624,7 +1624,7 @@
 	addwfc	average_depth_hold+1,F
 	movlw	d'0'
 	addwfc	average_depth_hold+2,F
-	addwfc	average_depth_hold+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar
+	addwfc	average_depth_hold+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
 
 	movf	b0_lo,w
 	addwf	average_depth_hold+0,F
@@ -1632,7 +1632,7 @@
 	addwfc	average_depth_hold+1,F
 	movlw	d'0'
 	addwfc	average_depth_hold+2,F
-	addwfc	average_depth_hold+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar
+	addwfc	average_depth_hold+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
 
 ; Do the same for the _total registers (Non-Resettable)
 	movf	b0_lo,w
@@ -1641,7 +1641,7 @@
 	addwfc	average_depth_hold_total+1,F
 	movlw	d'0'
 	addwfc	average_depth_hold_total+2,F
-	addwfc	average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar
+	addwfc	average_depth_hold_total+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
 
 	movf	b0_lo,w
 	addwf	average_depth_hold_total+0,F
@@ -1649,7 +1649,7 @@
 	addwfc	average_depth_hold_total+1,F
 	movlw	d'0'
 	addwfc	average_depth_hold_total+2,F
-	addwfc	average_depth_hold_total+3,F ; Will work up to 9999mBar*60*60*24=863913600mBar
+	addwfc	average_depth_hold_total+3,F ; Will work up to 9999mbar*60*60*24=863913600mbar
 
 	; 2. Compute Average Depth on base of average_divesecs:2
 	movff	average_divesecs+0,xB+0
--- a/code_part1/OSTC_code_asm_part1/isr.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/isr.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -25,7 +25,7 @@
 ; the timer1 module interrupts every 62.5ms (16x/second)
 ; temperature and pressure is averaged over 4 measurements
 ; flag pressure_refresh is set every 500ms 
-; and provides accurate pressure (+/-1mBar stable) and temperature (0.1C stable)
+; and provides accurate pressure (+/-1mbar stable) and temperature (0.1C stable)
 
 ;=============================================================================
 ; Copy a 16bit value from ISR modified registers to main registers.
@@ -289,7 +289,7 @@
 		bra			comp_air_pressure			; no
 
 comp_air_pressure0:	
-		movlw		LOW		d'1000'				; yes, so simulate 1Bar surface pressure
+		movlw		LOW		d'1000'				; yes, so simulate 1bar surface pressure
 		movwf		last_surfpressure+0
 		movlw		HIGH	d'1000'
 		movwf		last_surfpressure+1
--- a/code_part1/OSTC_code_asm_part1/menu_gassetup.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_gassetup.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -339,7 +339,7 @@
 	GETCUSTOM8 .18				        ; ppO2 warnvalue in WREG
 	mullw	d'10'
 	movff	PRODL,xA+0
-	movff	PRODH,xA+1		            ; ppO2 in [0.01Bar] * 10
+	movff	PRODH,xA+1		            ; ppO2 in [0.01bar] * 10
 	movf	divemins+0,W
 	addlw	0x06
 	movwf	EEADR
@@ -691,7 +691,7 @@
 
 	movff		xC+0,sub_a+0
 	movff		xC+1,sub_a+1
-	GETCUSTOM8	d'46'					; color-code ppO2 warning [cBar]
+	GETCUSTOM8	d'46'					; color-code ppO2 warning [cbar]
 	movwf		sub_b+0
 	clrf		sub_b+1
 	call		sub16					;  sub_c = sub_a - sub_b	
@@ -1051,7 +1051,7 @@
 	movwf	xB+0
 	clrf	xB+1
 	call	div16x16			;xA/xB=xC with xA as remainder 	
-	movff	xC+0,lo				; ((Depth+10m)*O2)/10 = [0.01Bar] ppO2
+	movff	xC+0,lo				; ((Depth+10m)*O2)/10 = [0.01bar] ppO2
 	movff	xC+1,hi
 	output_16dp	d'3'
 	OUTPUTTEXT 	d'150'		; bar: 
@@ -1061,7 +1061,7 @@
 	GETCUSTOM8 .18                      ; ppO2 warnvalue in WREG
 	mullw	d'10'
 	movff	PRODL,xA+0
-	movff	PRODH,xA+1                  ; ppO2 in [0.01Bar] * 10
+	movff	PRODH,xA+1                  ; ppO2 in [0.01bar] * 10
 	movf	divemins+0,W
 	addlw	0x06
 	movwf	EEADR
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -366,8 +366,8 @@
 	movwf		xC+2
 	clrf		xC+3
 
-	movff		lo,xB+0					; Max. Depth in mBar
-	movff		hi,xB+1					; Max. Depth in mBar
+	movff		lo,xB+0					; Max. Depth in mbar
+	movff		hi,xB+1					; Max. Depth in mbar
 	call		div32x16				; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
 
 	movff		xC+0,last_temperature+0	; 
--- a/code_part1/OSTC_code_asm_part1/menu_ppO2.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_ppO2.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -105,7 +105,7 @@
 	bsf		leftbind
 	output_16dp	d'3'
 	bcf		leftbind
-	STRCAT_PRINT "Bar "
+	STRCAT_PRINT "bar "
 
 	WIN_LEFT 	.20
 	WIN_TOP		.95
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -115,8 +115,8 @@
 	CF_DEFAULT    CF_SEC,	    d'5',   d'1',   d'30'   ; premenu_timeout	        5s
 
 	CF_DEFAULT    CF_INT8, 	    d'7',   d'3',   d'18'   ; minimum_velocity		    7min/min
-	CF_DEFAULT    CF_INT15,	    d'1160',d'950', 0    	; pressure_offset_divemode	1160mBar
-	CF_DEFAULT    CF_INT15,	    d'1080',d'1080', 0   	; max_surfpressure		    1080mBar
+	CF_DEFAULT    CF_INT15,	    d'1160',d'950', 0    	; pressure_offset_divemode	1160mbar
+	CF_DEFAULT    CF_INT15,	    d'1080',d'1080', 0   	; max_surfpressure		    1080mbar
 	CF_DEFAULT    CF_PERCENT,	d'20',  d'1',  d'99'   	; min_gradient_factor		20%
 	CF_DEFAULT    CF_PERCENT,	d'20',  d'1',  d'22'	; oxygen_threshold			22%
 
@@ -128,9 +128,9 @@
 
 	CF_DEFAULT    CF_PERCENT,	d'10',  d'0',  	d'100'  ; cns_display_surface		10%
 	CF_DEFAULT    CF_DECI,	    d'10',  d'0',  	d'10'	; deco_distance_for_sim		1m
-	CF_DEFAULT    CF_CENTI,     d'019', d'19', 	d'021'	; ppo2_warning_low			0.19 Bar
-	CF_DEFAULT    CF_CENTI,     d'160', d'0', 	d'160'  ; ppo2_warning_high			1.60 Bar
-	CF_DEFAULT    CF_CENTI,     d'150', d'0', 	d'150'	; ppo2_display_high			1.50 Bar
+	CF_DEFAULT    CF_CENTI,     d'019', d'19', 	d'021'	; ppo2_warning_low			0.19 bar
+	CF_DEFAULT    CF_CENTI,     d'160', d'0', 	d'160'  ; ppo2_warning_high			1.60 bar
+	CF_DEFAULT    CF_CENTI,     d'140', d'0', 	d'150'	; ppo2_display_high			1.40 bar
     
 	CF_DEFAULT    CF_INT8,	    d'10',  d'1',   d'120'  ; sampling_rate				10s
 	CF_DEFAULT    CF_INT8,	    d'6',   d'0',   d'15'   ; sampling_divisor_temp		/6
@@ -163,7 +163,7 @@
 	CF_DEFAULT    CF_BOOL,      d'1',   0,      0 		; Show mix type is surfmode
 
 	CF_DEFAULT    CF_BOOL,	    d'1',   0,      0       ; blink_gas_divemode 		=1 blink better gas
-	CF_DEFAULT    CF_INT15,     d'13000', 0,   d'13000' ; color_warn_depth_mBar		Warn depths
+	CF_DEFAULT    CF_INT15,     d'13000', 0,   d'13000' ; color_warn_depth_mbar		Warn depths
 	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'	; color_warn_cns_percent    Warn-%
 	CF_DEFAULT    CF_PERCENT,	d'101', d'50',  d'101'  ; color_warn_gf_percent		Warn-%
 	CF_DEFAULT    CF_CENTI,     d'161', d'100', d'161'  ; color_warn_ppo2_cbar		ppO2 warn
@@ -370,13 +370,13 @@
 
 	movlw	d'80'
 	movwf	EEDATA
-	write_int_eeprom	d'36'		; reset mix1 to ppO2=0.80Bar
+	write_int_eeprom	d'36'		; reset mix1 to ppO2=0.80bar
 	movlw	d'100'
 	movwf	EEDATA
-	write_int_eeprom	d'37'		; reset mix2 to ppO2=1.00Bar
+	write_int_eeprom	d'37'		; reset mix2 to ppO2=1.00bar
 	movlw	d'120'
 	movwf	EEDATA
-	write_int_eeprom	d'38'		; reset mix3 to ppO2=1.20Bar
+	write_int_eeprom	d'38'		; reset mix3 to ppO2=1.20bar
 
 	clrf	nofly_time+0			; Clear nofly time
 	clrf	nofly_time+1			; Clear nofly time
--- a/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/pled_outputs.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -88,13 +88,13 @@
 
 PLED_color_code1:				; Color-codes the output, if required
 	dcfsnz	WREG
-	bra		PLED_color_code_depth		; CF43 [mBar], 16Bit
+	bra		PLED_color_code_depth		; CF43 [mbar], 16Bit
 	dcfsnz	WREG
 	bra		PLED_color_code_cns			; CF44 [%]
 	dcfsnz	WREG
 	bra		PLED_color_code_gf			; CF45 [%]
 	dcfsnz	WREG
-	bra		PLED_color_code_ppo2		; CF46 [cBar]
+	bra		PLED_color_code_ppo2		; CF46 [cbar]
 	dcfsnz	WREG
 	bra		PLED_color_code_velocity	; CF47 [m/min]
 	dcfsnz	WREG
@@ -116,14 +116,15 @@
 	clrf		xB+1
 	call		mult16x16				; EEDATA * p_amb/10
 
-	tstfsz		xC+2                    ; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar?
-	bra			PLED_color_code_gaslist1; Yes, warn in warning color
-	btfsc		xC+1,7                  ; > 32767, ppO2>3,276Bar?
-	bra			PLED_color_code_gaslist1; Yes, warn in warning color
+	tstfsz		xC+2						; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
+	bra			PLED_color_code_gaslist1	; Yes, warn in warning color
+; Check if ppO2>3,30bar
+	btfsc		xC+1,7
+	bra			PLED_color_code_gaslist1	; Yes, warn in warning color
 
 	movff		xC+0,sub_a+0
 	movff		xC+1,sub_a+1
-	GETCUSTOM8	d'46'					; color-code ppO2 warning [cBar]
+	GETCUSTOM8	d'46'					; color-code ppO2 warning [cbar]
 	mullw		d'100'					; ppo2_warning_high*100
 	movff		PRODL,sub_b+0
 	movff		PRODH,sub_b+1
@@ -134,7 +135,7 @@
 	return
 
 PLED_color_code_gaslist1:
-	call	PLED_warnings_color
+	call		PLED_warnings_color
 	return
 
 PLED_color_code_ceiling:
@@ -145,7 +146,7 @@
 	bra		PLED_color_code_ceiling1	; No, Set to default color
 
     SAFE_2BYTE_COPY rel_pressure, lo
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 	movff	hi,xA+1
 	movff	lo,xA+0
 	movff	char_O_first_deco_depth,lo  ; Ceiling in m
@@ -169,10 +170,10 @@
 	movff	hi,hi_temp
 	movff	lo,lo_temp
     SAFE_2BYTE_COPY rel_pressure, lo
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 	movff	lo,sub_a+0
 	movff	hi,sub_a+1
-	GETCUSTOM15	d'43'				; Depth warn [mBar]
+	GETCUSTOM15	d'43'				; Depth warn [mbar]
 	movff	lo,sub_b+0
 	movff	hi,sub_b+1
 	call	sub16			;  sub_c = sub_a - sub_b
@@ -201,7 +202,7 @@
 	return
 
 PLED_color_code_gf:
-f	movff	char_O_gradient_factor,lo		; gradient factor
+	movff	char_O_gradient_factor,lo		; gradient factor
 	GETCUSTOM8	d'45'			; GF Warn [%]
 	subwf	lo,W
 	btfsc	STATUS,C
@@ -212,33 +213,29 @@
 	call	PLED_warnings_color
 	return
 
-;-----------------------------------------------------------------------------
-; Set color to red if ppO2 to high (and white if not).
-; Inputs: xC:3 = ppO2 (computed from divemode and O2_ratio).
-;
-PLED_color_code_ppo2:                   ; ppO2 in xC:3 (in 160*100 = 1.6000, ie. in 0.1 mbar)
-; Check very high ppO2 manually:
-    tstfsz  xC+2                        ; xC > 65535 ?
-	bra		PLED_color_code_ppo22	    ; Yes, warn in warning color
-	btfsc   xC+1,7					    ; xC > 32767, ie. ppO2>3,276Bar?
-	bra		PLED_color_code_ppo22	    ; Yes, warn in warning color
-
-; Normal checks: CF46
+PLED_color_code_ppo2:
+; Check if ppO2>6,55bar
+	tstfsz	xC+2					; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
+	bra		PLED_color_code_ppo22	; Yes, warn in warning color
+; Check if ppO2>3,30bar
+	btfsc	xC+1,7
+	bra		PLED_color_code_ppo22	; Yes, warn in warning color
+
 	movff	xC+0,sub_a+0
 	movff	xC+1,sub_a+1
-	GETCUSTOM8	d'46'                   ; color-code ppO2 warning, eg. 160 cBar = 1.60 bar.
+	GETCUSTOM8	d'46'			; color-code ppO2 warning [cbar]
 	mullw	d'100'
 	movff	PRODL,sub_b+0
 	movff	PRODH,sub_b+1
-	call	sub16                       ;  sub_c = sub_a - sub_b
+	call	sub16			  	;  sub_c = sub_a - sub_b
 	btfss	neg_flag
-	bra		PLED_color_code_ppo22       ; Set to warning color
-	goto	PLED_standard_color
-
+	bra		PLED_color_code_ppo22; Set to warning color
+	call	PLED_standard_color
+	return
 PLED_color_code_ppo22:
-	goto	PLED_warnings_color
-
-;-----------------------------------------------------------------------------
+	call	PLED_warnings_color
+	return
+
 PLED_color_code_velocity:
 	btfss	neg_flag			; Ignore for ascend!
 	bra		PLED_color_code_velocity1		; Skip check!
@@ -1027,12 +1024,11 @@
 	WIN_TOP		.119
 	WIN_LEFT	.0
 	WIN_FONT 	FT_SMALL
-    call    PLED_color_code_ppo2		; Color-code output (ppO2 stored in xC:3)
-
+	PLED_color_code		warn_ppo2		; Color-code output (ppO2 stored in xC)
     STRCPY  "ppO2:"
 
 ; Check very high ppO2 manually
-	tstfsz		xC+2					; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55Bar?
+	tstfsz		xC+2					; char_I_O2_ratio * p_amb/10 > 65536, ppO2>6,55bar?
 	bra			PLED_show_ppO2_3		; Yes, display fixed Value!
 
 	movff	xC+0,lo
@@ -1414,7 +1410,7 @@
 	output_16dp	d'3'		; outputs into Postinc2!
 	bcf		leftbind
 
-	STRCAT_PRINT  "Bar"
+	STRCAT_PRINT  "bar"
 	bra		PLED_active_gas_surfmode_exit
 
 PLED_active_gas_surfmode2:
@@ -1569,7 +1565,7 @@
 PLED_depth:
 	ostc_debug	'r'		; Sends debug-information to screen if debugmode active
     SAFE_2BYTE_COPY rel_pressure, lo
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 
 	movlw	.039
 	cpfslt	hi
@@ -1589,7 +1585,7 @@
 	movff	lo,sub_b+0
 	incf	sub_b+0,F
 	movlw	d'0'
-	addwfc	sub_b+1,F				; Add 1mBar offset
+	addwfc	sub_b+1,F				; Add 1mbar offset
 	call	sub16					; sub_c = sub_a - sub_b
 	btfss	neg_flag				; Depth lower then 10m?
 	rcall	depth_less_10mtr		; Yes, add extra space
@@ -1629,7 +1625,7 @@
 	PLED_color_code	warn_depth		; Color-code the output
 
     SAFE_2BYTE_COPY rel_pressure, lo
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 	
 	STRCPY  "."
 
@@ -2020,7 +2016,7 @@
 	ostc_debug	'p'		; Sends debug-information to screen if debugmode active
 	movff	max_pressure+0,lo
 	movff	max_pressure+1,hi
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 
 	movlw	.039
 	cpfslt	hi
@@ -2224,7 +2220,7 @@
 	lfsr	FSR2,letter
 	movff	avr_rel_pressure+0,lo
 	movff	avr_rel_pressure+1,hi
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 	bsf		ignore_digit5		; do not display 1cm depth
 	output_16dp	d'3'
 	bcf		leftbind
@@ -2273,7 +2269,7 @@
 	lfsr	FSR2,letter
 	movff	avr_rel_pressure+0,lo
 	movff	avr_rel_pressure+1,hi
-	call	adjust_depth_with_salinity		; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity		; computes salinity setting into lo:hi [mbar]
 	bsf		ignore_digit5					; do not display 1cm depth
 	output_16dp	d'3'
 	bcf		leftbind
@@ -2296,7 +2292,7 @@
 	lfsr	FSR2,letter
 	movff	avr_rel_pressure_total+0,lo
 	movff	avr_rel_pressure_total+1,hi
-	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mBar]
+	call	adjust_depth_with_salinity			; computes salinity setting into lo:hi [mbar]
 	bsf		ignore_digit5		; do not display 1cm depth
 	bcf		leftbind
 	output_16dp	d'3'
@@ -3115,7 +3111,7 @@
 	call		div16x16					;xA/xB=xC with xA as remainder 	
 
 	movff		xC+0,char_I_const_ppO2		; No, Overwrite with actual value
-	movff		xC+1,hi						; For test if ppO2>2,55Bar
+	movff		xC+1,hi						; For test if ppO2>2,55bar
 	
 	GETCUSTOM8	d'39'						; Adjust fixed SP?
 	dcfsnz		WREG,F
@@ -3133,10 +3129,9 @@
 
 	movff	lo,WREG					; copy to WREG
 	mullw	.100
-    clrf    xC+2
 	movff	PRODH,xC+1
 	movff	PRODL,xC+0				; For color code
-    call    PLED_color_code_ppo2 	; Color-code output (ppO2 stored in xC:3)
+	PLED_color_code		warn_ppo2	; Color-code output (ppO2 stored in xC)	
 
 	tstfsz	hi						; >2,55bar?
 	rcall	PLED_const_ppO2_too_hi	; Yes
@@ -3203,10 +3198,9 @@
 
 	movff       char_O_flush_ppO2,WREG  ; copy to WREG
 	mullw       .100
-    clrf        xC+2
 	movff       PRODH,xC+1
 	movff       PRODL,xC+0              ; For color code
-    call        PLED_color_code_ppo2	; Color-code output (ppO2 stored in xC:3)	
+	PLED_color_code		warn_ppo2		; Color-code output (ppO2 stored in xC)	
 
 	WIN_LEFT	.130
 	WIN_TOP		.168
@@ -3591,7 +3585,7 @@
 
 
 
-adjust_depth_with_salinity:			; computes salinity setting into lo:hi [mBar]
+adjust_depth_with_salinity:			; computes salinity setting into lo:hi [mbar]
 
 	btfsc	simulatormode_active	; Do apply salinity in Simulatormode
 	return
--- a/code_part1/OSTC_code_asm_part1/simulator.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/simulator.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -146,7 +146,7 @@
 	movlw	LOW		d'1000'
 	addwf	xC+0,F
 	movlw	HIGH	d'1000'
-	addwfc	xC+1,F							; add 1000mBar
+	addwfc	xC+1,F							; add 1000mbar
 
 	movff	xC+0,sim_pressure+0
 	movff	xC+1,sim_pressure+1
@@ -365,7 +365,7 @@
 	movlw	LOW		d'1000'
 	addwf	xC+0,F
 	movlw	HIGH	d'1000'
-	addwfc	xC+1,F                      ; add 1000mBar
+	addwfc	xC+1,F                      ; add 1000mbar
 
 	movff	xC+0,sim_pressure+0
 	movff	xC+1,sim_pressure+1
--- a/code_part1/OSTC_code_asm_part1/sleepmode.asm	Sat Jun 25 23:48:40 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm	Sun Jun 26 12:27:28 2011 +0200
@@ -86,7 +86,7 @@
     SAFE_2BYTE_COPY amb_pressure, last_surfpressure_15min		; save new airpressure
 
 	GETCUSTOM15	d'7'				; loads max_sufpressure into lo, hi
-	movff	lo,sub_a+0				; max. "allowed" airpressure in mBar
+	movff	lo,sub_a+0				; max. "allowed" airpressure in mbar
 	movff	hi,sub_a+1				
 	movff	last_surfpressure_15min+0,sub_b+0
 	movff	last_surfpressure_15min+1,sub_b+1
@@ -96,8 +96,8 @@
 
     ; not ok! Overwrite with max. "allowed" airpressure
 	GETCUSTOM15	d'7'				; loads max_sufpressure into lo, hi
-	movff	lo,last_surfpressure_15min+0	; max. "allowed" airpressure in mBar
-	movff	hi,last_surfpressure_15min+1	; max. "allowed" airpressure in mBar
+	movff	lo,last_surfpressure_15min+0	; max. "allowed" airpressure in mbar
+	movff	hi,last_surfpressure_15min+1	; max. "allowed" airpressure in mbar
 
 onemin_sleep2:
     SAFE_2BYTE_COPY amb_pressure, int_I_pres_respiration ; LOW copy pressure to deco routine