changeset 374:6ee9c849ad92 64kByte Logbook

GF profile. GF and Decotype in Logbok
author Heinrichsweikamp
date Sun, 12 Jun 2011 08:52:41 +0200
parents 8781d1cf96d8
children 84a1762de6ab
files 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 code_part1/OSTC_code_asm_part1/menu_reset.asm
diffstat 4 files changed, 68 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Fri Jun 10 17:47:52 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Jun 12 08:52:41 2011 +0200
@@ -267,7 +267,7 @@
 
 divisor_temperature     res 1   ; divisors for profile storage
 divisor_deco            res 1
-divisor_tank            res 1
+divisor_gf	            res 1
 divisor_ppo2            res 1
 divisor_deco_debug      res 1
 divisor_cns	            res 1
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Fri Jun 10 17:47:52 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Sun Jun 12 08:52:41 2011 +0200
@@ -612,9 +612,9 @@
 	movlw	d'2'				; Information length	
 	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
 check_extended2:
-	decfsz	divisor_tank,W		; Check divisor
+	decfsz	divisor_gf,W		; Check divisor
 	bra		check_extended3		
-	movlw	d'2'				; Information length	
+	movlw	d'1'				; Information length	
 	addwf	ProfileFlagByte,F	; add to ProfileFlagByte
 check_extended3:
 	decfsz	divisor_ppo2,W		; Check divisor
@@ -706,9 +706,9 @@
 	bra		store_extended2	
 	rcall	store_dive_decodata
 store_extended2:
-	decfsz	divisor_tank,F		; Check divisor
+	decfsz	divisor_gf,F		; Check divisor
 	bra		store_extended3	
-	rcall	store_dive_tankdata
+	rcall	store_dive_gf
 store_extended3:
 	decfsz	divisor_ppo2,F		; Check divisor
 	bra		store_extended4	
@@ -728,8 +728,8 @@
 	clrf	divisor_temperature		; And clear register again, so it will never reach zero...
 	btfsc	divisor_deco,7			; Test highest Bit (Register must have been zero before the "decfsz" command!)
 	clrf	divisor_deco			; And clear register again, so it will never reach zero...
-	btfsc	divisor_tank,7			; Test highest Bit (Register must have been zero before the "decfsz" command!)
-	clrf	divisor_tank			; And clear register again, so it will never reach zero...
+	btfsc	divisor_gf,7			; Test highest Bit (Register must have been zero before the "decfsz" command!)
+	clrf	divisor_gf				; And clear register again, so it will never reach zero...
 	btfsc	divisor_ppo2,7			; Test highest Bit (Register must have been zero before the "decfsz" command!)
 	clrf	divisor_ppo2			; And clear register again, so it will never reach zero...
 	btfsc	divisor_deco_debug,7	; Test highest Bit (Register must have been zero before the "decfsz" command!)
@@ -793,13 +793,14 @@
 	movwf	divisor_ppo2			; Reload divisor from CF
 	return
 
-store_dive_tankdata:
-	movlw	d'0'				; Dummy Tank1
-	call	write_external_eeprom
-	movlw	d'0'				; Dummy Tank2
+store_dive_gf:
+	movff	char_O_relative_gradient_GF,WREG; gradient factor relative (GF model)
+	movff	char_I_deco_model,lo
+	decfsz	lo,F							; jump over next line if char_I_deco_model == 1
+	movff	char_O_gradient_factor,WREG		; gradient factor absolute (Non-GF model)
 	call	write_external_eeprom
 	GETCUSTOM8	d'23'
-	movwf	divisor_tank			; Reload divisor from CF
+	movwf	divisor_gf			; Reload divisor from CF
 	return
 
 store_dive_decodata:
@@ -1345,13 +1346,21 @@
 	movff	total_divetime_seconds+1,WREG	; Total dive time (Regardless of CF01)
 	call	write_external_eeprom
 
-	GETCUSTOM8	d'32'						; GF_lo
-	call	write_external_eeprom
-	GETCUSTOM8	d'33'						; GF_hi
-	call	write_external_eeprom
+
+
+	GETCUSTOM8	d'32'						; GF_lo -> WREG
+	movff	char_I_deco_model,lo
+	decfsz	lo,F							; jump over next line if char_I_deco_model == 1
+	movlw	d'90'							; overwrite for non-gf modes
+	call	write_external_eeprom			; write WREG into external memory
+	GETCUSTOM8	d'33'						; GF_hi -> WREG
+	movff	char_I_deco_model,lo
+	decfsz	lo,F							; jump over next line if char_I_deco_model == 1
+	movlw	d'90'							; overwrite for non-gf modes
+	call	write_external_eeprom			; write WREG into external memory
 	read_int_eeprom d'34'					; Read deco modell
 	movf	EEDATA,W
-	call	write_external_eeprom
+	call	write_external_eeprom			; write WREG into external memory
 
 	clrf	WREG
 	call	write_external_eeprom			; Spare3
@@ -1774,7 +1783,7 @@
 	GETCUSTOM8	d'22'
 	movwf	divisor_deco				
 	GETCUSTOM8	d'23'
-	movwf	divisor_tank
+	movwf	divisor_gf
 	GETCUSTOM8	d'24'
 	movwf	divisor_ppo2
 	GETCUSTOM8	d'25'
--- a/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Fri Jun 10 17:47:52 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_logbook.asm	Sun Jun 12 08:52:41 2011 +0200
@@ -521,7 +521,7 @@
 	bcf			divisor_deco,7
 	movff		divisor_deco,logbook_temp2	; Store as temp, too
 	call		I2CREAD2					; Read divisor
-	movff		SSPBUF,divisor_tank			; Store divisor
+	movff		SSPBUF,divisor_gf			; Store divisor
 	call		I2CREAD2					; Read divisor
 	movff		SSPBUF,divisor_ppo2			; Store divisor
 	call		I2CREAD2					; Read divisor
@@ -874,6 +874,8 @@
 	btfss	logbook_format_0x21
 	bra		skip_new_format_0x21_info		; Do not show remaining info from dive
 
+; Show all new 0x21 data
+; Show average depth
 	WIN_TOP		.50
 	call		I2CREAD2					; Read average depth 
 	movff		SSPBUF,lo
@@ -883,8 +885,41 @@
 	output_16dp	d'3'			; Average depth 
 	STRCAT_PRINT "m"
 
-;	WIN_TOP		.0
-;	WIN_LEFT	.75
+; Show GF settings
+	incf_eeprom_address	d'2'				; Skip total dive time
+	WIN_TOP		.0
+	WIN_LEFT	.75
+	call		I2CREAD2					; Read GF_lo
+	movff		SSPBUF,hi
+	call		I2CREAD2					; Read GF_hi
+	movff		SSPBUF,lo
+	STRCPY      "GF:"
+	output_8								; GF_hi
+	PUTC		'/'
+	movff		lo,hi						; copy GF_lo
+	output_8								; GF_lo
+	call		word_processor
+
+; Show deco model
+	WIN_TOP		.25
+	call		I2CREAD2					; Read deco modell
+	movff		SSPBUF,lo
+	lfsr		FSR2,letter
+	incf		lo,F						; +1
+	dcfsnz		lo,F						; ZH-L16 OC?
+	movlw		d'101'						; Textnumber
+	dcfsnz		lo,F						; Gauge?
+	movlw		d'102'						; Textnumber
+	dcfsnz		lo,F						; ZH-L16 CC?
+	movlw		d'104'						; Textnumber
+	dcfsnz		lo,F						; Apnoe?
+	movlw		d'138'						; Textnumber
+	dcfsnz		lo,F						; L16-GF OC?
+	movlw		d'152'						; Textnumber
+	dcfsnz		lo,F						; L16-GF CC?
+	movlw		d'236'						; Textnumber
+	call		displaytext0_low			; Outputs to POSTINC2
+	call		word_processor
 
 skip_new_format_0x21_info:
 	bcf			menubit2
@@ -1208,7 +1243,7 @@
 	incf_eeprom_address	d'10'				; Skip another 10 byte from the header for 0x21 format
 	return
 
-logbook_convert_64k:
+logbook_convert_64k:						; Converts <1.91 logbook (32kB) to 64kB variant
 	call	PLED_boot
 	call	PLED_ClearScreen		; Clear screen
 	movlw	color_red
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Fri Jun 10 17:47:52 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sun Jun 12 08:52:41 2011 +0200
@@ -135,11 +135,11 @@
 	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
 	CF_DEFAULT    CF_INT8,	    d'6',   d'0',   d'15'   ; sampling_divisor_deco		/6
-	CF_DEFAULT    CF_INT8,	    d'0',   d'0',   d'15'   ; sampling_divisor_tank		never
+	CF_DEFAULT    CF_INT8,	    d'6',   d'0',   d'15'   ; sampling_divisor_gf		/6
 	CF_DEFAULT    CF_INT8,	    d'0',   d'0',   d'15'   ; sampling_divisor_ppo2		never
 
 	CF_DEFAULT    CF_INT8,	    d'0',   d'0',   d'15'   ; sampling_divisor_deco2	never
-	CF_DEFAULT    CF_INT8,	    d'0',   d'0',   d'15'   ; sampling_divisor_nyu2		never
+	CF_DEFAULT    CF_INT8,	    d'12',  d'0',   d'15'   ; sampling_divisor_cns		/12
 	CF_DEFAULT    CF_PERCENT,	d'20',  d'5',   d'75'   ; cns_display_high			20%
 	CF_DEFAULT    CF_INT15,	    d'0',   d'0',   0 		; logbook_offset			No Offset, but 15Bit value
 	CF_DEFAULT    CF_INT8,	    d'3',   d'2',   d'6'	; last_deco_depth			3m