diff src/adc_lightsensor.asm @ 218:8fbd8c5ac51f

1.71beta start
author heinrichsweikamp
date Fri, 19 Dec 2014 17:56:40 +0100
parents f5d909e03f52
children effd7259f5a5
line wrap: on
line diff
--- a/src/adc_lightsensor.asm	Wed Dec 17 14:46:45 2014 +0100
+++ b/src/adc_lightsensor.asm	Fri Dec 19 17:56:40 2014 +0100
@@ -32,6 +32,10 @@
 
     call    lt2942_get_accumulated_charge
     call    lt2942_get_voltage
+
+    btfsc   divemode
+    return                          ; Not in divemode
+
     bcf     cv_active
     bcf     cc_active
     bcf     LEDr
@@ -49,12 +53,15 @@
     btfsc   CHRG_IN
     return
 ;cv_active:
+    decfsz  safety_stop_countdown,F
+    return
     bsf     cc_active
     bsf     cv_active
     bsf     LEDr                    ; Indicate charging
     call    lt2942_charge_done      ; Reset accumulating registers to 0xFFFF
     WAITMS  d'10'
     bcf     LEDr                    ; Indicate charging
+    bsf     safety_stop_countdown,0 ; =1
     return
 
 charge_cc_active:
@@ -62,6 +69,8 @@
     bsf     LEDr                    ; Indicate charging
     bcf     CHRG_OUT
     bsf     TRISJ,2                 ; Chrg-Out high impedance
+    movlw   .5
+    movwf   safety_stop_countdown
     return
 
 get_battery_voltage1: