diff src/adc_lightsensor.asm @ 44:18fe4e668baa

BUGFIX: Percent display with 1,5V batteries
author heinrichsweikamp
date Wed, 28 Aug 2013 15:44:11 +0200
parents 0e1723f2761e
children f3062a611eef
line wrap: on
line diff
--- a/src/adc_lightsensor.asm	Fri Aug 16 09:30:27 2013 +0200
+++ b/src/adc_lightsensor.asm	Wed Aug 28 15:44:11 2013 +0200
@@ -150,6 +150,10 @@
     movlw   .10
     movwf   lo
 get_battery_voltage3d:
+	movlw	.100
+	cpfslt	lo
+	movwf	lo
+	; lo will be between 100 (Full) and 0 (empty)
     movf    batt_percent,W
     cpfsgt  lo                      ; keep batt_percent on the lowest value found
     movff   lo,batt_percent         ; store value
@@ -175,7 +179,7 @@
     rrcf    sub_c+1
     rrcf    sub_c+0             ; /4
     movff   sub_c+0,lo
-    bra     get_battery_voltage3    ; Check limits and return
+    bra     get_battery_voltage3d    ; Check limits and return
 
 	global	get_ambient_level
 get_ambient_level:              ; starts ADC and waits until finished