comparison src/menu_tree.asm @ 614:a32212cd5ea9

work on new battery menu
author heinrichsweikamp
date Wed, 30 Jan 2019 21:46:42 +0100
parents 6341f6663579
children b87f23fae743
comparison
equal deleted inserted replaced
613:8077ee960199 614:a32212cd5ea9
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File menu_tree.asm REFACTORED VERSION V2.99e 3 ; File menu_tree.asm REFACTORED VERSION V2.99g
4 ; 4 ;
5 ; OSTC menus 5 ; OSTC menus
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
751 751
752 do_date_time_menu: 752 do_date_time_menu:
753 MENU_BEGIN tSetTimeDate, .4 753 MENU_BEGIN tSetTimeDate, .4
754 MENU_CALL tSetTime, do_time_menu 754 MENU_CALL tSetTime, do_time_menu
755 MENU_CALL tSetDate, do_date_menu 755 MENU_CALL tSetDate, do_date_menu
756 MENU_OPTION tDateFormat,oDateFormat, 0 756 MENU_OPTION tDateFormat, oDateFormat, 0
757 MENU_CALL tBack, do_return_settings 757 MENU_CALL tBack, do_return_settings
758 MENU_END 758 MENU_END
759 759
760 760
761 do_date_menu: 761 do_date_menu:
953 ELSE 953 ELSE
954 bsf disable_comm_mode ; to prevent exiting into COMM mode immediately 954 bsf disable_comm_mode ; to prevent exiting into COMM mode immediately
955 ENDIF 955 ENDIF
956 956
957 call TFT_boot ; initialize TFT (includes clear screen) 957 call TFT_boot ; initialize TFT (includes clear screen)
958 call TFT_Display_FadeIn ; show splash 958 call TFT_Display_FadeIn ; switch on backlight
959 movlw .100 959 movlw .100
960 movwf batt_percent ; make sure to reset batt_percent 960 movwf batt_percent ; make sure to reset batt_percent
961 961
962 ; Default (in cases of timeout or USB): use old battery 962 ; Default (in cases of timeout or USB): use old battery
963 clrf EEADRH 963 clrf EEADRH
974 read_int_eeprom 0x0C 974 read_int_eeprom 0x0C
975 movff EEDATA,battery_gauge+5 975 movff EEDATA,battery_gauge+5
976 976
977 call menu_processor_reset ; restart from first item 977 call menu_processor_reset ; restart from first item
978 978
979 ; hardware_flag1: 979 ; hardware_flag1: battery changeable by user charger supported battery types
980 ; 3: 0x0A or 0x13 (2016) 980 ; -------------------------------------------------------------------------------------------------------------------------------------------------------
981 ; cR: 0x05 981 ; 0x11: BLE and battery gauge ---> OSTC 2 (old model ) NO YES internal 18650
982 ; 2 with BLE: 0x11 982 ; 0x05: analog input and battery gauge ---> OSTC 2 cR NO YES internal 18650
983 ; Sport: 0x12 983 ; 0x33: BLE and xmitter input and ambient sensor and battery gauge ---> OSTC 2 TR NO YES internal 16650
984 ; 3 with BLE: 0x1A 984 ; 0x13: BLE and ambient sensor and battery gauge -+-> OSTC 2 (new model ) NO YES internal 16650
985 985 ; +-> OSTC Plus YES YES 1.5V ----- NO! ----- 3.6V rechargeable
986 movlw 0x0A 986 ; 0x12; BLE and ambient sensor ---> OSTC Sport (both models) YES NO 1.5V 3.6V disposable 3.6V rechargeable
987 cpfseq hardware_flag1 987 ; 0x0A: optical input and ambient sensor ---> OSTC 3 /USB YES NO 1.5V 3.6V disposable 3.6V rechargeable
988 bra $+4 988 ; 0x1A: BLE and optical input and ambient sensor ---> OSTC 3 /BLE YES NO 1.5V 3.6V disposable 3.6V rechargeable
989 bra menu_new_battery_AA 989
990 movlw 0x13 990 ; OSTC 3 (2016) ???
991 cpfseq hardware_flag1 991
992 bra $+4 992 movlw 0x0A ; OSTC 3 /USB
993 bra menu_new_battery_16650 993 cpfseq hardware_flag1
994 movlw 0x33 994 bra $+4
995 cpfseq hardware_flag1 995 bra menu_new_battery_AA
996 bra $+4 996
997 bra menu_new_battery_AA_16650 997 movlw 0x13 ; OSTC 2 and Plus
998 movlw 0x12 998 cpfseq hardware_flag1
999 cpfseq hardware_flag1 999 bra $+4
1000 bra $+4 1000 bra menu_new_battery_AA_16650
1001 bra menu_new_battery_AA 1001
1002 movlw 0x1A 1002 movlw 0x33 ; OSTC 2 TR
1003 cpfseq hardware_flag1 1003 cpfseq hardware_flag1
1004 bra $+4 1004 bra $+4
1005 bra menu_new_battery_AA 1005 bra menu_new_battery_AA_16650
1006 movlw 0x11 1006
1007 cpfseq hardware_flag1 1007 movlw 0x12 ; OSTC Sport
1008 bra $+4 1008 cpfseq hardware_flag1
1009 bra menu_new_battery_18650 1009 bra $+4
1010 movlw 0x05 1010 bra menu_new_battery_AA
1011 cpfseq hardware_flag1 1011
1012 bra $+4 1012 movlw 0x1A ; OSTC 3 /BLE
1013 bra menu_new_battery_18650 1013 cpfseq hardware_flag1
1014 bra $+4
1015 bra menu_new_battery_AA
1016
1017 movlw 0x11 ; OSTC 2 (old model)
1018 cpfseq hardware_flag1
1019 bra $+4
1020 bra menu_new_battery_18650
1021
1022 movlw 0x05 ; OSTC 2 cR
1023 cpfseq hardware_flag1
1024 bra $+4
1025 bra menu_new_battery_18650
1026
1014 bra use_old_batteries ; any unsupported value 1027 bra use_old_batteries ; any unsupported value
1015 1028
1016 menu_new_battery_16650: 1029
1017 MENU_BEGIN tNewBattTitle, .1 1030 do_return_menu_new_bat_AA_16650:
1018 MENU_CALL tNew16650, use_16650_battery 1031 call menu_processor_double_pop ; drop exit line and back to last line
1019 MENU_END 1032
1020 1033 ; OSTC 2, TR and Plus
1021 menu_new_battery_AA_16650: 1034 menu_new_battery_AA_16650:
1022 MENU_BEGIN tNewBattTitle, .5 1035 MENU_BEGIN tNewBattTitle, .4
1023 MENU_CALL tNewBattOld, use_old_batteries 1036 MENU_CALL tNewBattOld, use_old_batteries
1024 MENU_CALL tNewBattNew15, use_new_15V_batteries 1037 MENU_CALL tNewBattNew15, use_new_15V_batteries ; OSTC Plus : not rechargeable
1025 MENU_CALL tNewBattNew36, use_new_36V_batteries 1038 ; MENU_CALL tNewBattNew36, use_new_36V_batteries ; OSTC Plus : not rechargeable -> not allowed any more !!!
1026 MENU_CALL tNewBattAccu, use_36V_rechargeable 1039 MENU_CALL tNewBattAccu, pre_36V_rechargeable ; OSTC Plus : rechargeable -> goto safety question
1027 MENU_CALL tNew16650, use_16650_battery 1040 MENU_CALL tNew16650, use_16650_battery ; OSTC 2, TR: rechargeable
1028 MENU_END 1041 MENU_END
1029 1042
1030 1043 ; OSTC 3 and Sport (no charging function)
1031 menu_new_battery_AA: 1044 menu_new_battery_AA:
1032 MENU_BEGIN tNewBattTitle, .4 1045 MENU_BEGIN tNewBattTitle, .4
1033 MENU_CALL tNewBattOld, use_old_batteries 1046 MENU_CALL tNewBattOld, use_old_batteries
1034 MENU_CALL tNewBattNew15, use_new_15V_batteries 1047 MENU_CALL tNewBattNew15, use_new_15V_batteries ; not rechargeable
1035 MENU_CALL tNewBattNew36, use_new_36V_batteries 1048 MENU_CALL tNewBattNew36, use_new_36V_batteries ; not rechargeable
1036 MENU_CALL tNewBattAccu, use_36V_rechargeable 1049 MENU_CALL tNewBattAccu, use_36V_rechargeable ; rechargeable
1037 MENU_END 1050 MENU_END
1038 1051
1039 1052 ; OSTC 2 (big housing) and cR
1040 menu_new_battery_18650: 1053 menu_new_battery_18650:
1041 MENU_BEGIN tNewBattTitle, .2 1054 MENU_BEGIN tNewBattTitle, .2
1042 MENU_CALL tNewBattOld, use_old_batteries 1055 MENU_CALL tNewBattOld, use_old_batteries
1043 MENU_CALL tNew18650, use_18650_battery 1056 MENU_CALL tNew18650, use_18650_battery ; rechargeable
1057 MENU_END
1058
1059
1060 pre_36V_rechargeable:
1061 MENU_BEGIN tNewBattTitle, .5
1062 MENU_CALL tConfirmChargeable1, 0 ; safety question, line 1
1063 MENU_CALL tConfirmChargeable2, 0 ; safety question, line 2
1064 MENU_CALL tConfirmChargeable3, 0 ; safety question, line 3
1065 MENU_CALL tNo, do_return_menu_new_bat_AA_16650 ; NO - go back
1066 MENU_CALL tYes, use_36V_rechargeable ; YES - confirmed rechargeable
1044 MENU_END 1067 MENU_END
1045 1068
1046 1069
1047 global use_old_prior_209 1070 global use_old_prior_209
1048 use_old_prior_209: 1071 use_old_prior_209:
1050 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 1073 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
1051 incfsz EEDATA,F ; was 0xFF? 1074 incfsz EEDATA,F ; was 0xFF?
1052 return ; NO - done 1075 return ; NO - done
1053 1076
1054 call lt2942_get_status ; check for gauge IC 1077 call lt2942_get_status ; check for gauge IC
1055 movlw .3 ; Assume a 18650 1078 movlw .3 ; assume a 18650
1056 btfss battery_gauge_available ; cR/2 hardware? 1079 btfss battery_gauge_available ; cR/2 hardware?
1057 movlw .1 ; assume a Saft 1080 movlw .1 ; assume a Saft
1058 movwf EEDATA 1081 movwf EEDATA
1059 write_int_eeprom 0x0F ; store the new battery type into EEPROM 1082 write_int_eeprom 0x0F ; store the new battery type into EEPROM
1060 return 1083 return
1076 read_int_eeprom 0x0C 1099 read_int_eeprom 0x0C
1077 movff EEDATA,battery_gauge+5 1100 movff EEDATA,battery_gauge+5
1078 read_int_eeprom 0x0F 1101 read_int_eeprom 0x0F
1079 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 1102 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
1080 1103
1081 rcall setup_new_saft ; any other value 1104 rcall setup_new_saft ; set a save default, not rechargeable
1105
1082 incf EEDATA,F ; 1...5 1106 incf EEDATA,F ; 1...5
1083 dcfsnz EEDATA,F 1107 dcfsnz EEDATA,F
1084 rcall setup_new_15v ; =0 1108 rcall setup_new_15v ; =0
1085 dcfsnz EEDATA,F 1109 dcfsnz EEDATA,F
1086 rcall setup_new_saft ; =1 1110 rcall setup_new_saft ; =1
1092 rcall setup_new_16650 ; =4 1116 rcall setup_new_16650 ; =4
1093 1117
1094 bcf use_old_batt_flag ; clear flag 1118 bcf use_old_batt_flag ; clear flag
1095 1119
1096 IFNDEF _screendump 1120 IFNDEF _screendump
1097 bcf disable_comm_mode ; re-enable COMM mode again 1121 bcf disable_comm_mode ; re-enable COMM mode again
1098 ENDIF 1122 ENDIF
1099 1123
1100 goto surfloop ; jump to surface loop 1124 goto surfloop ; jump to surface loop
1101 1125
1102 1126
1208 use_batt_exit: 1232 use_batt_exit:
1209 call reset_battery_pointer ; resets battery pointer 0x07-0x0C and battery_gauge:5 1233 call reset_battery_pointer ; resets battery pointer 0x07-0x0C and battery_gauge:5
1210 use_batt_exit1: 1234 use_batt_exit1:
1211 1235
1212 IFNDEF _screendump 1236 IFNDEF _screendump
1213 bcf disable_comm_mode ; re-enable COMM mode again 1237 bcf disable_comm_mode ; re-enable COMM mode again
1214 ENDIF 1238 ENDIF
1215 1239
1216 goto surfloop ; jump to surface loop 1240 goto surfloop ; jump to surface loop
1217 1241
1218 use_36V_rechargeable: 1242 use_36V_rechargeable: