diff code_part1/OSTC_code_asm_part1/divemode.asm @ 834:f8afe90796d6

3.14 beta Release CHANGE: Calculate velocity over a 6sec period
author heinrichsweikamp
date Sun, 01 May 2016 16:09:39 +0200
parents 2151c4135fad
children ab68f28514e0
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Mon Jan 11 12:34:42 2016 +0100
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Sun May 01 16:09:39 2016 +0200
@@ -951,11 +951,19 @@
 	bra		do_not_display_velocity			; display velocity only in divemode
 
 calc_velocity2:
-    SAFE_2BYTE_COPY amb_pressure, sub_a
-	movff	last_pressure+0,sub_b+0
-	movff	last_pressure+1,sub_b+1
-	movff	sub_a+0,last_pressure+0	; store old value for velocity
-	movff	sub_a+1,last_pressure+1
+	; Update ring buffer
+	movff	last_pressure+2,last_pressure+4
+	movff	last_pressure+3,last_pressure+5
+	movff	last_pressure+0,last_pressure+2
+	movff	last_pressure+1,last_pressure+3
+	SAFE_2BYTE_COPY amb_pressure, last_pressure
+
+
+	; use 6sec interval for velocity
+	movff	last_pressure+4,sub_b+0
+	movff	last_pressure+5,sub_b+1
+    	movff	last_pressure+0,sub_a+0
+	movff	last_pressure+1,sub_a+1
 
 	call	sub16						; sub_c = amb_pressure - last_pressure