changeset 357:562f1bc79f3c 64kByte Logbook

Bugfix: Wake-up into divemode with 1.91alpha
author Heinrichsweikamp
date Tue, 07 Jun 2011 13:06:14 +0200
parents 544a96faa9f3
children 88660a400338
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/isr.asm code_part1/OSTC_code_asm_part1/sleepmode.asm
diffstat 5 files changed, 26 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Mon Jun 06 18:50:26 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Tue Jun 07 13:06:14 2011 +0200
@@ -3,6 +3,9 @@
 BUGFIX: Ignore depths>130m in PC simulation
 CHANGE: CF02 now allows delay of more then 240seconds
 NEW: "Quit Sim" in divemode simulator menu for exiting the simulation
+NEW: 64kByte Logbook (Doubled capacity compared to 1.90)
+BUGFIX: Average depth in Logbook (For dives made with >=1.91)
+
 
 New in 1.90 Stable:
 Stable release
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Mon Jun 06 18:50:26 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Tue Jun 07 13:06:14 2011 +0200
@@ -34,7 +34,7 @@
 ;#DEFINE	GERMAN							; Use german_text.asm
 ;#DEFINE	SPANISH							; Use spanish_text.asm
 
-#DEFINE	__DEBUG	; 
+;#DEFINE	__DEBUG	; 
 
 #DEFINE	logbook_profile_version	0x21        ; Do not touch!
 #DEFINE	T0CON_debounce	b'00000000'         ; Timer0 Switch Debounce
@@ -333,6 +333,7 @@
 time_correction_value   res 1   ; Adds to Seconds on midnight
 gaslist_active          res 1	; Holds flags for active gases
 desaturation_time_buffer res 2	; buffer for desat time
+total_divetime_seconds	res 2	; counts dive seconds regardless of CF01 (18h max.)
 
 ;=============================================================================
 ; C-code Routines
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Mon Jun 06 18:50:26 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Jun 07 13:06:14 2011 +0200
@@ -1337,11 +1337,12 @@
 	call	write_external_eeprom
 	movff	avr_rel_pressure_total+1,WREG	; Average Depth
 	call	write_external_eeprom
-	
-	clrf	WREG
-	call	write_external_eeprom			; Spare8
-	clrf	WREG
-	call	write_external_eeprom			; Spare7
+
+	movff	total_divetime_seconds+0,WREG	; Total dive time (Regardless of CF01)
+	call	write_external_eeprom
+	movff	total_divetime_seconds+1,WREG	; Total dive time (Regardless of CF01)
+	call	write_external_eeprom
+
 	clrf	WREG
 	call	write_external_eeprom			; Spare6
 	clrf	WREG
@@ -1718,6 +1719,8 @@
 	clrf	apnoe_secs
 	clrf	divemins+0
 	clrf	divemins+1
+	clrf 	total_divetime_seconds+0
+	clrf 	total_divetime_seconds+1
 	clrf	menupos3
 	bcf		menu3_active
 	clrf	divesecs
--- a/code_part1/OSTC_code_asm_part1/isr.asm	Mon Jun 06 18:50:26 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/isr.asm	Tue Jun 07 13:06:14 2011 +0200
@@ -343,12 +343,17 @@
 ; Increase re-setable average depth divetime counter
 		incf		average_divesecs+0,F	; increase stopwatch registers	
 		btfsc		STATUS,Z
-		incf		average_divesecs+1,F	; increase stopwatch registers	
-
+		incf		average_divesecs+1,F	; increase stopwatch registers
+; Increase total divetime (Regardless of CF01)
+		incf		total_divetime_seconds+0,F	; increase stopwatch registers	
+		btfsc		STATUS,Z
+		incf		total_divetime_seconds+1,F	; increase stopwatch registers
+	
 		btfss		divemode2				; displayed divetime is running?
 		bra			RTCisr2					; No (e.g. too shallow)
 
-		incf		divesecs,F				; increase divetime registers
+; increase divetime registers (Displayed dive time)
+		incf		divesecs,F				
 		movlw		d'59'
 		cpfsgt		divesecs
 		bra			RTCisr1a
--- a/code_part1/OSTC_code_asm_part1/sleepmode.asm	Mon Jun 06 18:50:26 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm	Tue Jun 07 13:06:14 2011 +0200
@@ -72,6 +72,8 @@
 
 	rcall	pressuretest_sleep_fast	; Gets pressure without averaging (faster!)
 
+    SAFE_2BYTE_COPY amb_pressure_avg, amb_pressure	; copy for compatibility
+
 	call	check_temp_extrema		; Check for temperature extremas
 
 	call	deco_calc_CNS_decrease_15min		; compute CNS decay in sleep only
@@ -132,7 +134,7 @@
 	GETCUSTOM15	d'6'				; loads pressure threshold into lo,hi
 	movff	lo,sub_a+0				; power on if ambient pressure is greater threshold
 	movff	hi,sub_a+1	
-    SAFE_2BYTE_COPY amb_pressure, sub_b
+    SAFE_2BYTE_COPY amb_pressure_avg, sub_b
 	call	sub16					; sub_c = sub_a - sub_b
 	bsf		sleepmode
 	btfsc	neg_flag				; Wake up from Sleep?
@@ -179,6 +181,8 @@
 	nop
 	sleep								; Wait at least 35ms (every 16.5ms Timer1 wakeup)
 	call		get_pressure_value		; State2: Get pressure (51us)
+	clrf		amb_pressure_avg+0
+	clrf		amb_pressure_avg+1			; clear for sleep routine
 	call		calculate_compensation		; calculate temperature compensated pressure (233us)
 	return