comparison src/adc_lightsensor.asm @ 466:7f4c3b2e6bb7

battery gauge handling
author heinrichsweikamp
date Sat, 19 Nov 2016 18:37:47 +0100
parents 025a0ce21f8b
children 408329337b8b
comparison
equal deleted inserted replaced
465:025a0ce21f8b 466:7f4c3b2e6bb7
30 btfss battery_gauge_available 30 btfss battery_gauge_available
31 bra get_battery_voltage1 ; Normal ostc3 hardware 31 bra get_battery_voltage1 ; Normal ostc3 hardware
32 32
33 call lt2942_get_accumulated_charge 33 call lt2942_get_accumulated_charge
34 call lt2942_get_voltage 34 call lt2942_get_voltage
35 35
36 tstfsz batt_voltage+1 ; <256mV?
37 bra get_battery_voltage_noretry ; No
38
39 ; Retry
40 call lt2942_get_accumulated_charge
41 call lt2942_get_voltage
42
43 get_battery_voltage_noretry:
36 btfsc divemode 44 btfsc divemode
37 return ; Not in divemode 45 return ; Not in divemode
38 46
39 bcf cv_active 47 bcf cv_active
40 bcf cc_active 48 bcf cc_active
542 movff ADRESH,analog_sw2 550 movff ADRESH,analog_sw2
543 bcf analog_sw2_pressed 551 bcf analog_sw2_pressed
544 ; movlw .64 ; lower limit 552 ; movlw .64 ; lower limit
545 ; cpfsgt ADRESH 553 ; cpfsgt ADRESH
546 ; bra sw2_pressed 554 ; bra sw2_pressed
547 movlw .140 ; upper limit 555 movlw .135 ; upper limit
548 cpfsgt ADRESH 556 cpfsgt ADRESH
549 bra get_analog_sw1 557 bra get_analog_sw1
550 sw2_pressed: 558 sw2_pressed:
551 bsf analog_sw2_pressed 559 bsf analog_sw2_pressed
552 get_analog_sw1: 560 get_analog_sw1:
555 movff ADRESH,analog_sw1 563 movff ADRESH,analog_sw1
556 bcf analog_sw1_pressed 564 bcf analog_sw1_pressed
557 ; movlw .64 ; lower limit 565 ; movlw .64 ; lower limit
558 ; cpfsgt ADRESH 566 ; cpfsgt ADRESH
559 ; bra sw1_pressed 567 ; bra sw1_pressed
560 movlw .140 ; upper limit 568 movlw .135 ; upper limit
561 cpfsgt ADRESH 569 cpfsgt ADRESH
562 bra get_analog_sw_done 570 bra get_analog_sw_done
563 sw1_pressed: 571 sw1_pressed:
564 bsf analog_sw1_pressed 572 bsf analog_sw1_pressed
565 get_analog_sw_done: 573 get_analog_sw_done: