comparison src/menu_tree.asm @ 448:aadfe9f2edaf

work on new battery options
author heinrichsweikamp
date Tue, 30 Aug 2016 17:26:21 +0200
parents eccae727702f
children 791a25c4aab4
comparison
equal deleted inserted replaced
447:f2a1d535347f 448:aadfe9f2edaf
358 358
359 do_return_settings_more: 359 do_return_settings_more:
360 rcall menu_tree_double_pop ; drop exit line and back to last line 360 rcall menu_tree_double_pop ; drop exit line and back to last line
361 361
362 do_settings_menu_more: 362 do_settings_menu_more:
363 btfsc rechargeable ; piezo buttons available 363 btfsc battery_gauge_available ; piezo buttons available
364 bra do_settings_menu_more_piezo 364 bra do_settings_menu_more_piezo
365 btfsc ble_available ; ble available 365 btfsc ble_available ; ble available
366 bra do_settings_menu_more_ostc3p 366 bra do_settings_menu_more_ostc3p
367 MENU_BEGIN tSystSets, .7 367 MENU_BEGIN tSystSets, .7
368 MENU_CALL tCompassMenu, do_compass_menu 368 MENU_CALL tCompassMenu, do_compass_menu
629 MENU_CALL tMore, do_dispsets_menu_more 629 MENU_CALL tMore, do_dispsets_menu_more
630 MENU_CALL tExit, do_return_settings 630 MENU_CALL tExit, do_return_settings
631 MENU_END 631 MENU_END
632 632
633 do_dispsets_menu_more: 633 do_dispsets_menu_more:
634 MENU_BEGIN tDispSets, .4 634 MENU_BEGIN tDispSets, .5
635 MENU_OPTION tMODwarning, oMODwarning, 0 635 MENU_OPTION tMODwarning, oMODwarning, 0
636 MENU_OPTION tVSItext2, oVSItextv2, 0 636 MENU_OPTION tVSItext2, oVSItextv2, 0
637 MENU_OPTION tVSIgraph, oVSIgraph, 0 637 MENU_OPTION tVSIgraph, oVSIgraph, 0
638 MENU_OPTION tTimeoutDive, oDiveTimeout, 0
638 MENU_CALL tExit, do_dispsets_menu_3stack 639 MENU_CALL tExit, do_dispsets_menu_3stack
639 MENU_END 640 MENU_END
640 641
641 extern oColorSetDive 642 extern oColorSetDive
642 do_color_scheme: 643 do_color_scheme:
672 read_int_eeprom 0x0C 673 read_int_eeprom 0x0C
673 movff EEDATA,battery_gauge+5 674 movff EEDATA,battery_gauge+5
674 675
675 call menu_processor_reset ; restart from first icon. 676 call menu_processor_reset ; restart from first icon.
676 677
677 MENU_BEGIN tNewBattTitle, .3 678 MENU_BEGIN tNewBattTitle, .5
678 MENU_CALL tNewBattOld, use_old_batteries 679 MENU_CALL tNewBattOld, use_old_batteries
679 MENU_CALL tNewBattNew36, use_new_36V_batteries 680 MENU_CALL tNewBattNew36, use_new_36V_batteries
680 MENU_CALL tNewBattNew15, use_new_15V_batteries 681 MENU_CALL tNewBattNew15, use_new_15V_batteries
682 MENU_CALL tNewBattAccu, use_36V_rechargeable
683 MENU_CALL tNew18650, use_18650_battery
681 MENU_END 684 MENU_END
682 685
683 global use_old_batteries 686 global use_old_batteries
684 use_old_batteries: 687 use_old_batteries:
685 clrf EEADRH 688 clrf EEADRH
693 movff EEDATA,battery_gauge+3 696 movff EEDATA,battery_gauge+3
694 read_int_eeprom 0x0B 697 read_int_eeprom 0x0B
695 movff EEDATA,battery_gauge+4 698 movff EEDATA,battery_gauge+4
696 read_int_eeprom 0x0C 699 read_int_eeprom 0x0C
697 movff EEDATA,battery_gauge+5 700 movff EEDATA,battery_gauge+5
701 read_int_eeprom 0x0F
702 movff EEDATA,battery_type; =0:1.5V, =1:3,6V Saft, =2:LiIon 3,7V/0.8Ah, =3:LiIon 3,7V/3.1Ah
703
704 incf EEDATA,W
705 dcfsnz WREG,W
706 rcall setup_new_15v ;=0
707 dcfsnz WREG,W
708 rcall setup_new_saft ;=1
709 dcfsnz WREG,W
710 rcall setup_new_panasonic ;=2
711 dcfsnz WREG,W
712 rcall setup_new_18650 ;=3
713
714 rcall setup_new_saft ; Any other value
715 goto power_on_return
716
717 setup_new_saft:
718 banksel battery_capacity
719 movlw LOW internal_saft_capacity
720 movwf internal_battery_capacity+0
721 movlw HIGH internal_saft_capacity
722 movwf internal_battery_capacity+1
723 movlw LOW saft_capacity
724 movwf battery_capacity+0
725 movlw HIGH saft_capacity
726 movwf battery_capacity+1
727 movlw LOW saft_offset
728 movwf battery_offset+0
729 movlw HIGH saft_offset
730 movwf battery_offset+1
731 banksel common
732 bsf charge_disable
733 bcf TRISE,2
734 movlw .1
735 movff WREG,battery_type
736 return
737
738 setup_new_18650:
739 banksel battery_capacity
740 clrf internal_battery_capacity+0
741 clrf internal_battery_capacity+1
742 movlw LOW ncr18650_capacity
743 movwf battery_capacity+0
744 movlw HIGH ncr18650_capacity
745 movwf battery_capacity+1
746 movlw LOW ncr18650_offset
747 movwf battery_offset+0
748 movlw HIGH ncr18650_offset
749 movwf battery_offset+1
750 banksel common
751 bcf charge_disable
752 bsf TRISE,2
753 movlw .3
754 movff WREG,battery_type
755 return
756
757 setup_new_panasonic:
758 banksel battery_capacity
759 movlw LOW internal_panasonic_capacity
760 movwf internal_battery_capacity+0
761 movlw HIGH internal_panasonic_capacity
762 movwf internal_battery_capacity+1
763 movlw LOW panasonic_capacity
764 movwf battery_capacity+0
765 movlw HIGH panasonic_capacity
766 movwf battery_capacity+1
767 movlw LOW panasonic_offset
768 movwf battery_offset+0
769 movlw HIGH panasonic_offset
770 movwf battery_offset+1
771 banksel common
772 bcf charge_disable
773 bsf TRISE,2
774 return
775
776 setup_new_15v:
777 bsf charge_disable
778 bcf TRISE,2
698 movlw .100 779 movlw .100
699 movwf batt_percent ; To have 1,5V batteries right after firmware update 780 movwf batt_percent ; To have 1,5V batteries right after firmware update
700 goto power_on_return 781 movlw .0
701 782 movff WREG,battery_type
783 return
784
785 use_18650_battery:
786 rcall setup_new_18650
787 bra use_new_36V_2
788 use_new_36V_batteries:
789 rcall setup_new_saft
790 bra use_new_36V_2
702 use_new_15V_batteries: 791 use_new_15V_batteries:
703 use_new_36V_batteries: 792 rcall setup_new_15v
793 use_new_36V_2:
704 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 794 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5
705 goto power_on_return 795 goto power_on_return
796 use_36V_rechargeable:
797 rcall setup_new_panasonic
798 call reset_battery_internal_only
799 goto power_on_return
706 800
707 END 801 END