diff code_part1/OSTC_code_asm_part1/start.asm @ 341:2144f19fa1eb

BUGFIX protect against ISR changing pressure/temperature while reading it.
author JeanDo
date Fri, 20 May 2011 00:48:30 +0200
parents 6544f79e298c
children 797e2ac42d24
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/start.asm	Fri May 20 00:39:05 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Fri May 20 00:48:30 2011 +0200
@@ -67,12 +67,11 @@
 	call	pressuretest_sleep_fast	; Gets pressure without averaging (faster!)
 	bcf		sleepmode				; Normal mode again
 
-	movff	amb_pressure+0,last_surfpressure+0
-	movff	amb_pressure+1,last_surfpressure+1
-	movff	amb_pressure+0,last_surfpressure_15min+0
-	movff	amb_pressure+1,last_surfpressure_15min+1
-	movff	amb_pressure+0,last_surfpressure_30min+0
-	movff	amb_pressure+1,last_surfpressure_30min+1	; Rests all airpressure registers
+    SAFE_2BYTE_COPY amb_pressure, last_surfpressure
+	movff	last_surfpressure+0,last_surfpressure_15min+0
+	movff	last_surfpressure+1,last_surfpressure_15min+1
+	movff	last_surfpressure+0,last_surfpressure_30min+0
+	movff	last_surfpressure+1,last_surfpressure_30min+1	; Rests all airpressure registers
 
 ; Extra power-up reset (JeanDo)
 	ifdef	TESTING
@@ -91,10 +90,9 @@
 	movff	WREG,char_I_saturation_multiplier
 	GETCUSTOM8	d'12'					    ; Desaturation multiplier %
 	movff	WREG,char_I_desaturation_multiplier
-	movff	amb_pressure+0,int_I_pres_respiration+0 ; copy for deco routine
-	movff	amb_pressure+1,int_I_pres_respiration+1		
-	movff	amb_pressure+0,int_I_pres_surface+0     ; copy for desat routine
-	movff	amb_pressure+1,int_I_pres_surface+1		
+    SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy for deco routine
+	movff	int_I_pres_respiration+0,int_I_pres_surface+0     ; copy for desat routine
+	movff	int_I_pres_respiration+1,int_I_pres_surface+1		
 
 	call	deco_clear_tissue			    ;
 	call	deco_calc_desaturation_time     ; calculate desaturation time