diff code_part1/OSTC_code_asm_part1/sleepmode.asm @ 395:0e0cf4701c17

Merge with 64kByte Logbook
author JeanDo
date Thu, 23 Jun 2011 01:37:59 +0200
parents 88660a400338
children ab962c4b19d6
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/sleepmode.asm	Fri Jun 10 01:14:38 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/sleepmode.asm	Thu Jun 23 01:37:59 2011 +0200
@@ -74,6 +74,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
@@ -131,12 +133,12 @@
 
 	rcall	pressuretest_sleep_fast	; Gets pressure without averaging (faster!)
 
-    ; compare current ambient pressure with threshold CF6==1160mbar.
+        ; compare current ambient pressure with threshold CF6==1160mbar.
 	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
-	call	sub16					; Is (1160mbar - amb_pressure) < 0 ?
+        SAFE_2BYTE_COPY amb_pressure_avg, sub_b
+	call	sub16					; Is (1160mbar - averaged(amb_pressure)) < 0 ?
 	bsf		sleepmode
 	btfsc	neg_flag				; Wake up from Sleep?
 	bcf		sleepmode				; amb_pressure>pressure_offset_divemode: wake up!
@@ -182,6 +184,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