diff src/divemode.asm @ 526:0d1cda9f2d43

BUGFIX: Skip MOD Test for CCR in Sensor modes (OSTC cR and OSTC3 only) CHANGE: Swap positions of ppO2(O2) and ppO2(Dil) in customview 10 on screen. "left = lean" and "right = rich" BUGFIX: A wrong configured gas was suggested as "Better gas" on the configured depth even if this resulted in a ppO2 high or low condition
author heinrichsweikamp
date Sat, 05 Aug 2017 16:50:28 +0200
parents 06e9370c6d75
children 015b7fdd90a7
line wrap: on
line diff
--- a/src/divemode.asm	Sat Aug 05 15:04:08 2017 +0200
+++ b/src/divemode.asm	Sat Aug 05 16:50:28 2017 +0200
@@ -1272,7 +1272,7 @@
 	movlw	better_gas_window_neg
 	subwf	lo,W                    ; Change depth-better_gas_window_neg
 	cpfslt	xC+0					; current depth<Change depth-better_gas_window_neg?
-	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
+    bra     check_gas_common4       ; Ok, now check the better gas ppO2<opt_ppO2_max
     return
 
 check_gas_common3:
@@ -1314,29 +1314,29 @@
 	btfsc   xC+1,7
 	return                      ; Done.
 
-;    ; Check for low ppo2
-;    movff	xC+0,sub_b+0
-;	movff	xC+1,sub_b+1
-;    movff   opt_ppO2_min,WREG
-;	mullw	d'100'				; opt_ppO2_min*100
-;	movff	PRODL,sub_a+0
-;	movff	PRODH,sub_a+1
-;	call	subU16
-;	btfss	neg_flag
-;    return                      ; Done (Too low).
+    ; Check for low ppo2
+	movff	xC+0,sub_b+0
+	movff	xC+1,sub_b+1
+	movff   opt_ppO2_min,WREG
+	mullw	d'100'		    ; opt_ppO2_min*100
+	movff	PRODL,sub_a+0
+	movff	PRODH,sub_a+1
+	call	subU16		    ; sub_c = sub_a - sub_b
+	btfss	neg_flag
+	return                      ; Done (Too low).
 
 ;check if we are within our warning thresholds!
-	movff	xC+0,sub_b+0
-	movff	xC+1,sub_b+1
+	movff	xC+0,sub_a+0
+	movff	xC+1,sub_a+1
 	movff	opt_ppO2_max_deco,WREG	; PPO2 Max for MOD calculation and color coding in divemode
-    addlw   .1                  ; e.g. >1.60
-	mullw	d'100'				; opt_ppO2_max*100
-	movff	PRODL,sub_a+0
-	movff	PRODH,sub_a+1
-	call	subU16
-	btfss	neg_flag
+	addlw   .1                  ; e.g. >1.60
+	mullw	d'100'		    ; opt_ppO2_max*100
+	movff	PRODL,sub_b+0
+	movff	PRODH,sub_b+1
+	call	subU16		    ; sub_c = sub_a - sub_b
+	btfsc	neg_flag
 	bsf		better_gas_available	;=1: A better gas is available and a gas change is advised in divemode
-    return                      ; Done.
+	return                      ; Done.
 
 check_dil_common:                   ; With Dil 0-4 in WREG
     btfsc   better_gas_available	; Better Diluent already found?
@@ -1685,7 +1685,6 @@
     ; Warnings only in deco modes
     btfss   FLAG_ccr_mode                       ; Don't check in CCR mode
 	rcall	check_ppO2							; check ppO2 and displays warning, if required
-	; mH: PSCR handling missing here (Not critical but should be done...)
 	
     btfsc   is_bailout                          ; But check in Bailout case...
 	rcall	check_ppO2							; check ppO2 and displays warning, if required