comparison src/comm.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 aadfe9f2edaf
children 237afdfb4918
comparison
equal deleted inserted replaced
463:2c58631d5229 464:0491a84fd0b8
21 #include "surfmode.inc" 21 #include "surfmode.inc"
22 #include "rtc.inc" 22 #include "rtc.inc"
23 #include "adc_lightsensor.inc" 23 #include "adc_lightsensor.inc"
24 #include "shared_definitions.h" 24 #include "shared_definitions.h"
25 25
26 extern new_battery_menu,restart,option_reset_all 26 extern restart,option_reset_all
27 extern option_check_all, gaslist_cleanup_list, get_first_gas_to_WREG, get_first_dil_to_WREG 27 extern option_check_all, gaslist_cleanup_list, get_first_gas_to_WREG, get_first_dil_to_WREG
28 extern vault_decodata_into_eeprom 28 extern vault_decodata_into_eeprom
29 29
30 #DEFINE timeout_comm_pre_mode .240 ; Pre-loop 30 #DEFINE timeout_comm_pre_mode .240 ; Pre-loop
31 #DEFINE timeout_comm_mode .120 ; Download mode 31 #DEFINE timeout_comm_mode .120 ; Download mode
100 bcf onesecupdate 100 bcf onesecupdate
101 bcf LEDr 101 bcf LEDr
102 dcfsnz timeout_counter,F 102 dcfsnz timeout_counter,F
103 bra comm_service_exit ; Timeout -> Exit 103 bra comm_service_exit ; Timeout -> Exit
104 comm_mode2: 104 comm_mode2:
105 ; btfsc battery_gauge_available
106 ; bra comm_mode4 ; Skip
107 ;
108 ; call get_battery_voltage ; gets battery voltage
109 ; movlw .3
110 ; cpfslt batt_voltage+1 ; Batt Voltage less then 3*256mV?
111 ; bra comm_mode3 ; No
112 ; ; Set flag
113 ; bsf battery_removed_in_usb ; =1: The battery has been removed in USB
114 ; bra comm_mode4
115 ;
116 ;comm_mode3:
117 ; ; Voltage ok. Do we have a new battery now?
118 ; btfsc battery_removed_in_usb ; =1: The battery has been removed in USB
119 ; goto new_battery_menu ; show "New battery dialog"
120 ;
121 ;comm_mode4:
122 rcall comm_write_get_byte 105 rcall comm_write_get_byte
123 106
124 movlw 0xAA ; start byte=0xAA? 107 movlw 0xAA ; start byte=0xAA?
125 cpfseq RCREG1 108 cpfseq RCREG1
126 bra comm_mode2a 109 bra comm_mode2a