changeset 253:3a4096f32526

show CNS in logbook for all dives made with V1.84beta and later
author heinrichsweikamp
date Sun, 03 Apr 2011 11:46:06 +0200
parents 8b252ff2eded
children 8f20e8948b97
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/menu_logbook.asm
diffstat 4 files changed, 27 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Wed Mar 30 02:23:47 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Sun Apr 03 11:46:06 2011 +0200
@@ -2,7 +2,7 @@
 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: Gaslist, Salinity, Gradient Factors and Average depth displayed in Logbook
+NEW: Gaslist, Salinity, CNS and Average depth displayed in Logbook
 NEW: Internal logbook shows Gas changes
 NEW: Release in French, Spain, English and German (Use correct HEX file!)
 
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Wed Mar 30 02:23:47 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Apr 03 11:46:06 2011 +0200
@@ -519,5 +519,6 @@
 #DEFINE	menu3_active			flag15,4	;=1: menu entry three in divemode menu is active
 #DEFINE no_deco_customviews		flag15,5	;=1: Selected mode is Apnoe or Gauge
 #DEFINE	maxdepth_greater_100m	flag15,6	;=1: Max Depth greater>100m
-;unused			flag15,7	;=1: 
+#DEFINE	show_cns_in_logbook		flag15,7	;=1: Show CNS value in logbook (>= V1.84)
 
+
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Wed Mar 30 02:23:47 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Sun Apr 03 11:46:06 2011 +0200
@@ -1233,13 +1233,9 @@
 	read_int_eeprom	d'26'			; Read Salinity from EEPROM
 	movf	EEDATA,W
 	call	write_external_eeprom	; Store Salinity to Dive
-	
-	GETCUSTOM8	d'33'				; GF_hi
-	movwf	temp1
-	swapf	temp1,F					; GF_hi -> Bit7-4
-	GETCUSTOM8	d'32'				; GF_lo
-	addwf	temp1,W					; Add GF_lo -> Bit 3-0
-	call	write_external_eeprom	; Stores GF_hi and GF_lo
+
+	movff	char_O_CNS_fraction,WREG	; copy into bank1
+	call	write_external_eeprom		; Stores CNS%
 
 	movlw	0xFB						; Header stop
 	call	write_external_eeprom
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Wed Mar 30 02:23:47 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Sun Apr 03 11:46:06 2011 +0200
@@ -767,18 +767,29 @@
 	output_8
 	call		word_processor				; Display Gas information
 
+
+	bcf			show_cns_in_logbook			; clear flag
 	WIN_TOP		.25
 	STRCPY      "V"
 	call		I2CREAD2					; Firmware x
 	movff		SSPBUF,lo
+	movff		SSPBUF,hi
 	output_8
 	PUTC		'.'
 	call		I2CREAD2					; Firmware y
 	movff		SSPBUF,lo
+	movlw		.83							; Check firmware y > 83
+	cpfslt		lo							; <83?
+	bsf			show_cns_in_logbook			; No, set flag
+	movlw		.2							; Check firmware x > 1
+	cpfslt		hi							; <2?
+	bsf			show_cns_in_logbook			; No, set flag
 	output_8
 	call		word_processor				; Display Gas information
 	bcf			leftbind					; Clear flag
 
+
+
 	WIN_TOP		.50
 	lfsr		FSR2,letter	
 	call		I2CREAD2					; Battery lo
@@ -838,25 +849,19 @@
 	output_16dp	d'3'
 	STRCAT_PRINT "kg/l"
 
-	call		I2CREAD2					; Skip GF_HI (Upper nibble), GF_LO (Lower nibble)
-	movff		SSPBUF,lo
-	movlw		b'11110000'					; mask GF hi
-	andwf		lo,F
-	WIN_TOP		.25
-	STRCPY      "GF_hi:"
-	output_8
-	call		word_processor				; Display Gas information
+	call		I2CREAD2					; Read CNS%
+
+	btfss	show_cns_in_logbook				; Show CNS?
+	bra		logbook_skip_cns				; No
 
 	movff		SSPBUF,lo
-	movlw		b'00001111'					; mask GF lo
-	andwf		lo,F
-	WIN_TOP		.50
-	STRCPY      "GF_lo:"
+	WIN_TOP		.25
+	STRCPY      "CNS:"
 	output_8
-	call		word_processor				; Display Gas information
+	STRCAT_PRINT "%"						; Display CNS %
 
-	WIN_TOP		.0
-	WIN_LEFT	.65
+logbook_skip_cns:
+	WIN_TOP		.50
 	movff	average_divesecs+0,xB+0
 	clrf	xB+1								; Number of x-pixels displayed
 	movff	average_depth_hold_total+0,xC+0
@@ -870,7 +875,7 @@
 	output_16dp	d'3'					; Average depth (Re-calculated from the drawn profile - not 100% exact!)
 	STRCAT_PRINT "m"
 
-;	WIN_TOP		.25
+;	WIN_TOP		.0
 ;	WIN_LEFT	.65
 ;	lfsr	FSR2,letter
 ;	movff	average_divesecs+0,lo