changeset 583:d14f72af4c07

Battery statistics reset when battery is fully charged
author heinrichsweikamp
date Mon, 07 May 2012 20:03:41 +0200
parents da400547220d
children 15e132a699c6
files code_part1/OSTC_code_asm_part1/adc_rtc.asm code_part1/OSTC_code_asm_part1/changelog.txt code_part1/OSTC_code_asm_part1/surfmode.asm
diffstat 3 files changed, 46 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Sun Apr 29 09:35:04 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/adc_rtc.asm	Mon May 07 20:03:41 2012 +0200
@@ -237,11 +237,11 @@
 	movwf	mins
 	movlw	.12
 	movwf	hours
-	movlw	.5
+	movlw	.7
 	movwf	day
 	movlw	.5
 	movwf	month
-	movlw	.11
+	movlw	.12
 	movwf	year
 	bsf		PIE1, TMR1IE
 	return
--- a/code_part1/OSTC_code_asm_part1/changelog.txt	Sun Apr 29 09:35:04 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/changelog.txt	Mon May 07 20:03:41 2012 +0200
@@ -4,6 +4,7 @@
 BUGFIX: Missed deco stops issue
 BUGFIX: Timeout for 2nd page of Gas Setup
 BUGFIX: GasVolume checks for a gas-switch before the first stop
+NEW: Battery statistics reset when battery is fully charged
 
 New in 2.21:
 BUGFIX: GF warning in logbook memory
--- a/code_part1/OSTC_code_asm_part1/surfmode.asm	Sun Apr 29 09:35:04 2012 +0200
+++ b/code_part1/OSTC_code_asm_part1/surfmode.asm	Mon May 07 20:03:41 2012 +0200
@@ -316,7 +316,7 @@
 	; Yes, store all data for complete cycle
 	bcf		charge_started				; Clear flag
 	bcf		charge_done					; Clear flag
-	; Store incomplete/total cycles
+	; Store incomplete cycles
 	read_int_eeprom 	d'50'		; Read byte (stored in EEDATA)
 	movff	EEDATA,temp1				; Low byte
 	read_int_eeprom 	d'51'		; Read byte (stored in EEDATA)
@@ -353,6 +353,47 @@
 	movff	year,EEDATA
 	write_int_eeprom	d'49'
 
+	; Reset lowest battery seen
+	movlw	LOW			d'4200'		; reset to 4.2V
+	movwf	EEDATA
+	write_int_eeprom	d'40'
+	movlw	HIGH		d'4200'		; reset to 4.2V
+	movwf	EEDATA
+	write_int_eeprom	d'41'
+	movff	month,EEDATA
+	write_int_eeprom	d'42'
+	movff	day,EEDATA
+	write_int_eeprom	d'43'
+	movff	year,EEDATA
+	write_int_eeprom	d'44'
+	; Reset temperature
+    SAFE_2BYTE_COPY temperature,lo
+	movff	lo,EEDATA
+	write_int_eeprom	d'45'
+	movff	hi,EEDATA
+	write_int_eeprom	d'46'
+	; Reset temperature extremas
+    SAFE_2BYTE_COPY temperature,lo
+	movff	lo,EEDATA	; Reset mimimum extrema
+	write_int_eeprom	d'54'
+	movff	hi,EEDATA
+	write_int_eeprom	d'55'
+	movff	month,EEDATA
+	write_int_eeprom	d'56'
+	movff	day,EEDATA
+	write_int_eeprom	d'57'
+	movff	year,EEDATA
+	write_int_eeprom	d'58'
+	movff	lo,EEDATA	; Reset maximum extrema
+	write_int_eeprom	d'59'
+	movff   hi,EEDATA
+	write_int_eeprom	d'60'
+	movff	month,EEDATA
+	write_int_eeprom	d'61'
+	movff	day,EEDATA
+	write_int_eeprom	d'62'
+	movff	year,EEDATA
+	write_int_eeprom	d'63'
 	return
 
 test_charger2:
@@ -360,7 +401,7 @@
 	return								; No, quit!
 
 	bcf		charge_started				; Clear flag
-	; Store incomplete/total cycles
+	; Store incomplete cycles
 	read_int_eeprom 	d'50'			; Read byte (stored in EEDATA)
 	movff	EEDATA,temp1				; Low byte
 	read_int_eeprom 	d'51'			; Read byte (stored in EEDATA)