diff code_part1/OSTC_code_asm_part1/divemode.asm @ 655:8c01edcf57fc

Allow any diluent to be "First gas" in CCR modes
author heinrichsweikamp
date Tue, 23 Oct 2012 10:03:47 +0200
parents e6ac142e82b0
children 5063fb9f07db
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Oct 16 18:20:32 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/divemode.asm	Tue Oct 23 10:03:47 2012 +0200
@@ -2058,17 +2058,16 @@
 	return
 
 set_first_gas_ccr:                      ; Set Diluent
-    movlw   .1
-    movwf   active_diluent              ; Always start with Diluent 1 (EEPROM 96/97)
-	read_int_eeprom 	d'97'			; Read He
-	movff	EEDATA,char_I_He_ratio		; And copy into hold register
-	read_int_eeprom 	d'96'			; Read O2
-	movff	EEDATA, char_I_O2_ratio		; O2 ratio
+    call    get_first_diluent           ; Read first diluent into lo(O2) and hi(He)
+	movff	hi,char_I_He_ratio          ; And copy into hold register
+	movff	lo, char_I_O2_ratio         ; O2 ratio
 	movff	char_I_He_ratio, wait_temp	; copy into bank1 register
 	bsf		STATUS,C					; Borrow bit
 	movlw	d'100'						; 100%
 	subfwb	wait_temp,W					; minus He
 	bsf		STATUS,C					; Borrow bit
-	subfwb	EEDATA,W					; minus O2
+	subfwb	lo,W        				; minus O2
 	movff	WREG, char_I_N2_ratio		; = N2!
+    read_int_eeprom d'106'              ; Read First Diluent (1-5)
+    movff   EEDATA,active_diluent
     return
\ No newline at end of file