Mercurial > public > hwos_code
comparison src/menu_tree.asm @ 464:0491a84fd0b8
CHANGE: Easier to understand "New Battery" menu (OSTC model dependent)
author | heinrichsweikamp |
---|---|
date | Wed, 02 Nov 2016 15:46:22 +0100 |
parents | b4417044a042 |
children | 81faca166e1b |
comparison
equal
deleted
inserted
replaced
463:2c58631d5229 | 464:0491a84fd0b8 |
---|---|
651 | 651 |
652 | 652 |
653 ;============================================================================= | 653 ;============================================================================= |
654 | 654 |
655 global new_battery_menu | 655 global new_battery_menu |
656 extern surfloop | |
656 new_battery_menu: | 657 new_battery_menu: |
657 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately | 658 bsf enable_screen_dumps ; To prevent exiting into COMM mode immediately |
658 call TFT_boot ; Initialize TFT (includes clear screen) | 659 call TFT_boot ; Initialize TFT (includes clear screen) |
659 call TFT_Display_FadeIn ; Show splash | 660 call TFT_Display_FadeIn ; Show splash |
660 movlw .100 | 661 movlw .100 |
661 movwf batt_percent ; make sure to reset batt_percent | 662 movwf batt_percent ; make sure to reset batt_percent |
662 | 663 |
663 ; Default (In cases of timeout or USB): Use old battery | 664 ; Default (In cases of timeout or USB): Use old battery |
664 clrf EEADRH | 665 clrf EEADRH |
665 read_int_eeprom 0x07 | 666 read_int_eeprom 0x07 |
666 movff EEDATA,battery_gauge+0 | 667 movff EEDATA,battery_gauge+0 |
667 read_int_eeprom 0x08 | 668 read_int_eeprom 0x08 |
673 read_int_eeprom 0x0B | 674 read_int_eeprom 0x0B |
674 movff EEDATA,battery_gauge+4 | 675 movff EEDATA,battery_gauge+4 |
675 read_int_eeprom 0x0C | 676 read_int_eeprom 0x0C |
676 movff EEDATA,battery_gauge+5 | 677 movff EEDATA,battery_gauge+5 |
677 | 678 |
678 call menu_processor_reset ; restart from first icon. | 679 call menu_processor_reset ; restart from first icon. |
679 | 680 |
680 MENU_BEGIN tNewBattTitle, .5 | 681 ; hardware_flag: |
682 ; 3: 0x0A or 0x13 (2016) | |
683 ; cR: 0x05 | |
684 ; 2 with BLE: 0x11 | |
685 ; Sport: 0x12 | |
686 ; 3 with BLE: 0x1A | |
687 | |
688 movlw 0x0A | |
689 cpfseq hardware_flag | |
690 bra $+4 | |
691 bra menu_new_battery_AA | |
692 movlw 0x13 | |
693 cpfseq hardware_flag | |
694 bra $+4 | |
695 bra menu_new_battery_AA | |
696 movlw 0x12 | |
697 cpfseq hardware_flag | |
698 bra $+4 | |
699 bra menu_new_battery_AA | |
700 movlw 0x1A | |
701 cpfseq hardware_flag | |
702 bra $+4 | |
703 bra menu_new_battery_AA | |
704 movlw 0x11 | |
705 cpfseq hardware_flag | |
706 bra $+4 | |
707 bra menu_new_battery_18650 | |
708 movlw 0x05 | |
709 cpfseq hardware_flag | |
710 bra $+4 | |
711 bra menu_new_battery_18650 | |
712 bra use_old_batteries ; any unsupported value | |
713 | |
714 menu_new_battery_AA: | |
715 MENU_BEGIN tNewBattTitle, .4 | |
681 MENU_CALL tNewBattOld, use_old_batteries | 716 MENU_CALL tNewBattOld, use_old_batteries |
682 MENU_CALL tNewBattNew36, use_new_36V_batteries | 717 MENU_CALL tNewBattNew36, use_new_36V_batteries |
683 MENU_CALL tNewBattNew15, use_new_15V_batteries | 718 MENU_CALL tNewBattNew15, use_new_15V_batteries |
684 MENU_CALL tNewBattAccu, use_36V_rechargeable | 719 MENU_CALL tNewBattAccu, use_36V_rechargeable |
720 MENU_END | |
721 | |
722 menu_new_battery_18650: | |
723 MENU_BEGIN tNewBattTitle, .2 | |
724 MENU_CALL tNewBattOld, use_old_batteries | |
685 MENU_CALL tNew18650, use_18650_battery | 725 MENU_CALL tNew18650, use_18650_battery |
686 MENU_END | 726 MENU_END |
687 | 727 |
728 | |
688 global use_old_prior_209 | 729 global use_old_prior_209 |
689 use_old_prior_209: | 730 use_old_prior_209: |
690 clrf EEADRH | 731 clrf EEADRH |
691 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah | 732 read_int_eeprom 0x0F ; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah |
692 tstfsz EEDATA ; Was 0x00? | 733 tstfsz EEDATA ; Was 0x00? |
728 rcall setup_new_saft ;=1 | 769 rcall setup_new_saft ;=1 |
729 dcfsnz EEDATA,F | 770 dcfsnz EEDATA,F |
730 rcall setup_new_panasonic ;=2 | 771 rcall setup_new_panasonic ;=2 |
731 dcfsnz EEDATA,W | 772 dcfsnz EEDATA,W |
732 rcall setup_new_18650 ;=3 | 773 rcall setup_new_18650 ;=3 |
733 | 774 |
734 goto power_on_return | 775 bcf use_old_batt_flag ; clear flag |
776 goto surfloop ; Jump to Surfaceloop! | |
735 | 777 |
736 setup_new_saft: | 778 setup_new_saft: |
737 banksel battery_capacity | 779 banksel battery_capacity |
738 movlw LOW internal_saft_capacity | 780 movlw LOW internal_saft_capacity |
739 movwf internal_battery_capacity+0 | 781 movwf internal_battery_capacity+0 |
809 bra use_new_36V_2 | 851 bra use_new_36V_2 |
810 use_new_15V_batteries: | 852 use_new_15V_batteries: |
811 rcall setup_new_15v | 853 rcall setup_new_15v |
812 use_new_36V_2: | 854 use_new_36V_2: |
813 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 | 855 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 |
814 goto power_on_return | 856 goto surfloop ; Jump to Surfaceloop! |
815 use_36V_rechargeable: | 857 use_36V_rechargeable: |
816 rcall setup_new_panasonic | 858 rcall setup_new_panasonic |
817 call reset_battery_internal_only | 859 call reset_battery_internal_only |
818 goto power_on_return | 860 goto surfloop ; Jump to Surfaceloop! |
819 | 861 |
820 END | 862 END |