# HG changeset patch
# User heinrichsweikamp
# Date 1317570736 -7200
# Node ID 6ad9af3a577134469284614ceefa61d36bd34af2
# Parent  32e1174fb89ebee33d07b6177e049a4d088a8539
Fix reset gas from 2.0stable

diff -r 32e1174fb89e -r 6ad9af3a5771 code_part1/OSTC_code_asm_part1/definitions.asm
--- a/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Sep 25 10:30:53 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/definitions.asm	Sun Oct 02 17:52:16 2011 +0200
@@ -24,7 +24,7 @@
 #DEFINE	softwareversion_x		d'2'		; Software version  XX.YY
 #DEFINE	softwareversion_y		d'1'		; Software version  XX.YY
 
-#DEFINE softwareversion_beta 	1 			; (and 0 for release) 
+#DEFINE softwareversion_beta 	0 			; (and 0 for release) 
 
 #DEFINE	max_custom_number		d'58'		; Number of last used custom function
 
diff -r 32e1174fb89e -r 6ad9af3a5771 code_part1/OSTC_code_asm_part1/menu_reset.asm
--- a/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sun Sep 25 10:30:53 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/menu_reset.asm	Sun Oct 02 17:52:16 2011 +0200
@@ -324,23 +324,7 @@
 	bcf			nofly_active                	; Clear flag
 
 ; reset gases
-	clrf	EEADRH					; EEPROM BANK 0 !
-
-	movlw	d'3'					; address of first gas-1
-	movwf	EEADR
-	clrf	hi						; He part (default for all gases: 0%)
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #1
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #2
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #3
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #4
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #5
-	movlw	d'21'					; O2 part (21%)
-	rcall	reset_gas               ; saves default and current value for gas #6
+	rcall	reset_gases
 
 reset_all_cf:
 	movlw	d'1'
@@ -434,14 +418,44 @@
 ;call	reset_external_eeprom	; delete profile memory
 	goto	restart					; all reset, quit to surfmode
 
+reset_gases:
+	clrf	EEADRH					; EEPROM BANK 0 !
+
+	movlw	d'3'					; address of first gas-1
+	movwf	EEADR
+	clrf	hi						; He part (default for all gases: 0%)
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #1
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #1
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #2
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #2
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #3
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #3
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #4
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #4
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #5
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves default value for gas #5
+	movlw	d'21'					; O2 part (21%)
+	rcall	reset_gas               ; saves current value for gas #6
+	return
+
 ; Write WREG:lo twice, w/o any type clearing, pre-incrementing EEADR
 reset_gas:
     movwf   lo
 	incf	EEADR,F
-	movff	lo, EEDATA				; Lowbyte Default value
+	movff	lo, EEDATA				; O2 Default value
 	call	write_eeprom
 	incf	EEADR,F
-	movff	hi, EEDATA				; Highbyte default value
+	movff	hi, EEDATA				; He default value
 	call    write_eeprom
 	return
 
diff -r 32e1174fb89e -r 6ad9af3a5771 code_part1/OSTC_code_asm_part1/start.asm
--- a/code_part1/OSTC_code_asm_part1/start.asm	Sun Sep 25 10:30:53 2011 +0200
+++ b/code_part1/OSTC_code_asm_part1/start.asm	Sun Oct 02 17:52:16 2011 +0200
@@ -142,6 +142,9 @@
 	write_int_eeprom	d'193'
 	write_int_eeprom	d'194'		; Reset Default and Current Value to zero
 	clrf	EEADRH
+
+; reset gases (Bug in 2.0 stable)
+	call	reset_gases
 ;	goto	reset_all_cf			; resets all custom functions bank0 and bank1 and jumps to "restart"
 			
 restart: