diff src/divemode.asm @ 178:39f6c07ce2f6

BUGFIX: Average depth computation
author heinrichsweikamp
date Tue, 07 Oct 2014 13:45:21 +0200
parents 3fdafedc24af
children efe70488a04b
line wrap: on
line diff
--- a/src/divemode.asm	Tue Oct 07 08:42:38 2014 +0200
+++ b/src/divemode.asm	Tue Oct 07 13:45:21 2014 +0200
@@ -64,6 +64,8 @@
 	bra		diveloop_loop3
 
 ; tasks any new second...
+    bcf     onesecupdate					; one seconds update, clear flag here in case it's set again in ISR before all tasks are done.
+
 	btfsc	FLAG_apnoe_mode					; Only in apnoe mode
 	bra		diveloop_loop1b					; One Second Tasks in Apnoe mode
 
@@ -108,8 +110,6 @@
     call    compute_ppo2                    ; compute mv_sensorX and ppo2_sensorX arrays
     call    check_sensors                   ; Check O2 sensor thresholds for fallback
 
-	bcf		onesecupdate					; one seconds update done
-
 diveloop_loop3:
 	rcall	test_switches_divemode			; Check switches in divemode
 
@@ -791,7 +791,6 @@
 	call	div32x16 	; xC:4 / xB:2 = xC+3:xC+2 with xC+1:xC+0 as remainder
 	movff	xC+0,avr_rel_pressure_total+0
 	movff	xC+1,avr_rel_pressure_total+1
-
 	return
 
 reset_average1: