Mercurial > public > hwos_code
comparison src/menu_tree.asm @ 472:4fdf6886004b
CHANGE: Show warnings either in Customview (If active) _or_ next to warning sign
NEW: Show battery type in information menu (T0:1.5V AA, T1:3.6V AA, T2:3.6V/0.8A LiIon, T3:Internal 18650, T4:Internal 16650)
author | heinrichsweikamp |
---|---|
date | Sun, 18 Dec 2016 18:20:39 +0100 |
parents | 81faca166e1b |
children | 2880aa1264f5 |
comparison
equal
deleted
inserted
replaced
471:9edb1359ce43 | 472:4fdf6886004b |
---|---|
728 | 728 |
729 | 729 |
730 global use_old_prior_209 | 730 global use_old_prior_209 |
731 use_old_prior_209: | 731 use_old_prior_209: |
732 clrf EEADRH | 732 clrf EEADRH |
733 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah | 733 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah |
734 tstfsz EEDATA ; Was 0x00? | |
735 return ; Yes, return | |
736 incfsz EEDATA,F ; Was 0xFF? | 734 incfsz EEDATA,F ; Was 0xFF? |
735 bra use_old_prior_209_2 ; Yes | |
737 return | 736 return |
738 | 737 use_old_prior_209_2: |
739 call lt2942_get_status ; Check for gauge IC | 738 call lt2942_get_status ; Check for gauge IC |
740 movlw .3 ; Assume a 18650 | 739 movlw .3 ; Assume a 18650 |
741 btfss battery_gauge_available ; cR/2 hardware? | 740 btfss battery_gauge_available ; cR/2 hardware? |
742 movlw .1 ; Assume a Saft | 741 movlw .1 ; Assume a Saft |
743 movwf EEDATA | 742 movwf EEDATA |
758 read_int_eeprom 0x0B | 757 read_int_eeprom 0x0B |
759 movff EEDATA,battery_gauge+4 | 758 movff EEDATA,battery_gauge+4 |
760 read_int_eeprom 0x0C | 759 read_int_eeprom 0x0C |
761 movff EEDATA,battery_gauge+5 | 760 movff EEDATA,battery_gauge+5 |
762 read_int_eeprom 0x0F | 761 read_int_eeprom 0x0F |
763 movff EEDATA,battery_type; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah | 762 movff EEDATA,battery_type; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah, =4: LiIon 3,7V/2.3Ah |
764 | 763 |
765 rcall setup_new_saft ; Any other value | 764 rcall setup_new_saft ; Any other value |
766 incf EEDATA,F | 765 incf EEDATA,F |
767 dcfsnz EEDATA,F | 766 dcfsnz EEDATA,F |
768 rcall setup_new_15v ;=0 | 767 rcall setup_new_15v ;=0 |
770 rcall setup_new_saft ;=1 | 769 rcall setup_new_saft ;=1 |
771 dcfsnz EEDATA,F | 770 dcfsnz EEDATA,F |
772 rcall setup_new_panasonic ;=2 | 771 rcall setup_new_panasonic ;=2 |
773 dcfsnz EEDATA,W | 772 dcfsnz EEDATA,W |
774 rcall setup_new_18650 ;=3 | 773 rcall setup_new_18650 ;=3 |
774 dcfsnz EEDATA,W | |
775 rcall setup_new_16650 ;=4 | |
775 | 776 |
776 bcf use_old_batt_flag ; clear flag | 777 bcf use_old_batt_flag ; clear flag |
777 goto surfloop ; Jump to Surfaceloop! | 778 goto surfloop ; Jump to Surfaceloop! |
778 | 779 |
780 setup_new_15v: | |
781 bsf charge_disable | |
782 bcf TRISE,2 | |
783 movlw .100 | |
784 movwf batt_percent ; To have 1,5V batteries right after firmware update | |
785 movlw .0 | |
786 movff WREG,battery_type | |
787 return | |
788 | |
779 setup_new_saft: | 789 setup_new_saft: |
780 banksel battery_capacity | 790 banksel battery_capacity |
781 movlw LOW internal_saft_capacity | 791 movlw LOW internal_saft_capacity |
782 movwf internal_battery_capacity+0 | 792 movwf internal_battery_capacity+0 |
783 movlw HIGH internal_saft_capacity | 793 movlw HIGH internal_saft_capacity |
795 bcf TRISE,2 | 805 bcf TRISE,2 |
796 movlw .1 | 806 movlw .1 |
797 movff WREG,battery_type | 807 movff WREG,battery_type |
798 return | 808 return |
799 | 809 |
810 setup_new_panasonic: | |
811 banksel battery_capacity | |
812 movlw LOW internal_panasonic_capacity | |
813 movwf internal_battery_capacity+0 | |
814 movlw HIGH internal_panasonic_capacity | |
815 movwf internal_battery_capacity+1 | |
816 movlw LOW panasonic_capacity | |
817 movwf battery_capacity+0 | |
818 movlw HIGH panasonic_capacity | |
819 movwf battery_capacity+1 | |
820 movlw LOW panasonic_offset | |
821 movwf battery_offset+0 | |
822 movlw HIGH panasonic_offset | |
823 movwf battery_offset+1 | |
824 banksel common | |
825 bcf charge_disable | |
826 bsf TRISE,2 | |
827 movlw .2 | |
828 movff WREG,battery_type | |
829 return | |
830 | |
800 setup_new_18650: | 831 setup_new_18650: |
801 banksel battery_capacity | 832 banksel battery_capacity |
802 clrf internal_battery_capacity+0 | 833 clrf internal_battery_capacity+0 |
803 clrf internal_battery_capacity+1 | 834 clrf internal_battery_capacity+1 |
804 movlw LOW ncr18650_capacity | 835 movlw LOW ncr18650_capacity |
813 bcf charge_disable | 844 bcf charge_disable |
814 bsf TRISE,2 | 845 bsf TRISE,2 |
815 movlw .3 | 846 movlw .3 |
816 movff WREG,battery_type | 847 movff WREG,battery_type |
817 return | 848 return |
818 | 849 |
819 setup_new_panasonic: | 850 setup_new_16650: |
820 banksel battery_capacity | 851 banksel battery_capacity |
821 movlw LOW internal_panasonic_capacity | 852 clrf internal_battery_capacity+0 |
822 movwf internal_battery_capacity+0 | 853 clrf internal_battery_capacity+1 |
823 movlw HIGH internal_panasonic_capacity | 854 movlw LOW ur16650_capacity |
824 movwf internal_battery_capacity+1 | |
825 movlw LOW panasonic_capacity | |
826 movwf battery_capacity+0 | 855 movwf battery_capacity+0 |
827 movlw HIGH panasonic_capacity | 856 movlw HIGH ur16650_capacity |
828 movwf battery_capacity+1 | 857 movwf battery_capacity+1 |
829 movlw LOW panasonic_offset | 858 movlw LOW ur16650_offset |
830 movwf battery_offset+0 | 859 movwf battery_offset+0 |
831 movlw HIGH panasonic_offset | 860 movlw HIGH ur16650_offset |
832 movwf battery_offset+1 | 861 movwf battery_offset+1 |
833 banksel common | 862 banksel common |
834 bcf charge_disable | 863 bcf charge_disable |
835 bsf TRISE,2 | 864 bsf TRISE,2 |
836 return | 865 movlw .4 |
837 | |
838 setup_new_15v: | |
839 bsf charge_disable | |
840 bcf TRISE,2 | |
841 movlw .100 | |
842 movwf batt_percent ; To have 1,5V batteries right after firmware update | |
843 movlw .0 | |
844 movff WREG,battery_type | 866 movff WREG,battery_type |
845 return | 867 return |
846 | 868 |
847 use_18650_battery: | 869 use_18650_battery: |
848 rcall setup_new_18650 | 870 rcall setup_new_18650 |
849 bra use_new_36V_2 | 871 bra use_new_36V_2 |
850 use_new_36V_batteries: | 872 use_new_36V_batteries: |
851 rcall setup_new_saft | 873 rcall setup_new_saft |