diff src/adc_lightsensor.asm @ 615:b87f23fae743

work on new battery menu
author heinrichsweikamp
date Sat, 02 Feb 2019 17:39:44 +0100
parents d866684249bd
children c40025d8e750 be8787f2034d
line wrap: on
line diff
--- a/src/adc_lightsensor.asm	Wed Jan 30 21:46:42 2019 +0100
+++ b/src/adc_lightsensor.asm	Sat Feb 02 17:39:44 2019 +0100
@@ -38,13 +38,15 @@
 
 	call	lt2942_get_accumulated_charge
 	call	lt2942_get_voltage
-
+        call    lt2942_get_temperature
+	
 	tstfsz	batt_voltage+1					; < 256 mV ?
 	bra		get_battery_voltage_noretry		; NO
 
 	; Retry
 	call	lt2942_get_accumulated_charge
 	call	lt2942_get_voltage
+	call    lt2942_get_temperature
 
 get_battery_voltage_noretry:
 	btfsc	divemode
@@ -65,7 +67,7 @@
 	WAITMS	d'1'
 
 	btfsc	CHRG_IN
-	return
+	return		    ; Not charging, done.
 charge_cv_active:
 	decfsz	get_bat_volt_counter,F
 	return
@@ -98,7 +100,11 @@
 	return
 
 get_battery_voltage1:
-	bsf		adc_running						; =1: The ADC is in use
+	; Additional disable in software
+    	bsf	charge_disable
+	bcf	TRISE,2
+        bsf     adc_running         ; =1: The ADC is in use
+
 	movlw	b'00100000'						; 2.048V Vref+ -> 1LSB = 500µV
 	movwf	ADCON1
 	movlw	b'00011001'						; power on ADC, select AN6