diff src/adc_lightsensor.asm @ 466:7f4c3b2e6bb7

battery gauge handling
author heinrichsweikamp
date Sat, 19 Nov 2016 18:37:47 +0100
parents 025a0ce21f8b
children 408329337b8b
line wrap: on
line diff
--- a/src/adc_lightsensor.asm	Fri Nov 18 10:49:32 2016 +0100
+++ b/src/adc_lightsensor.asm	Sat Nov 19 18:37:47 2016 +0100
@@ -32,7 +32,15 @@
 
     call    lt2942_get_accumulated_charge
     call    lt2942_get_voltage
+    
+    tstfsz  batt_voltage+1		; <256mV?
+    bra	    get_battery_voltage_noretry	; No
 
+    ; Retry
+    call    lt2942_get_accumulated_charge
+    call    lt2942_get_voltage
+    
+get_battery_voltage_noretry:
     btfsc   divemode
     return                          ; Not in divemode
 
@@ -544,7 +552,7 @@
 ;    movlw	.64	; lower limit
 ;    cpfsgt	ADRESH
 ;    bra		sw2_pressed
-    movlw	.140	; upper limit
+    movlw	.135	; upper limit
     cpfsgt	ADRESH
     bra		get_analog_sw1
 sw2_pressed:    
@@ -557,7 +565,7 @@
 ;    movlw	.64	; lower limit
 ;    cpfsgt	ADRESH
 ;    bra		sw1_pressed
-    movlw	.140	; upper limit
+    movlw	.135	; upper limit
     cpfsgt	ADRESH
     bra		get_analog_sw_done
 sw1_pressed: