Mercurial > public > hwos_code
comparison src/comm.asm @ 393:9e5abca93c32
tweak response timing in comm mode
author | heinrichsweikamp |
---|---|
date | Thu, 05 Nov 2015 20:15:52 +0100 |
parents | 682199d87b5c |
children | 61984f91174a |
comparison
equal
deleted
inserted
replaced
392:32780516c8c6 | 393:9e5abca93c32 |
---|---|
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 rechargeable | 105 ; btfsc rechargeable |
106 bra comm_mode4 ; Skip | 106 ; bra comm_mode4 ; Skip |
107 | 107 ; |
108 call get_battery_voltage ; gets battery voltage | 108 ; call get_battery_voltage ; gets battery voltage |
109 movlw .3 | 109 ; movlw .3 |
110 cpfslt batt_voltage+1 ; Batt Voltage less then 3*256mV? | 110 ; cpfslt batt_voltage+1 ; Batt Voltage less then 3*256mV? |
111 bra comm_mode3 ; No | 111 ; bra comm_mode3 ; No |
112 ; Set flag | 112 ; ; Set flag |
113 bsf battery_removed_in_usb ; =1: The battery has been removed in USB | 113 ; bsf battery_removed_in_usb ; =1: The battery has been removed in USB |
114 bra comm_mode4 | 114 ; bra comm_mode4 |
115 | 115 ; |
116 comm_mode3: | 116 ;comm_mode3: |
117 ; Voltage ok. Do we have a new battery now? | 117 ; ; Voltage ok. Do we have a new battery now? |
118 btfsc battery_removed_in_usb ; =1: The battery has been removed in USB | 118 ; btfsc battery_removed_in_usb ; =1: The battery has been removed in USB |
119 goto new_battery_menu ; show "New battery dialog" | 119 ; goto new_battery_menu ; show "New battery dialog" |
120 | 120 ; |
121 comm_mode4: | 121 ;comm_mode4: |
122 rcall comm_write_get_byte | 122 rcall comm_write_get_byte |
123 | |
124 btfss vusb_in ; USB plugged in? | |
125 bra comm_service_exit_nousb_delay ; Disconnected -> Exit | |
126 comm_mode4a: | |
127 | |
128 btfsc switch_right ; Abort with right | |
129 bra comm_service_exit | |
130 | |
131 btfsc onesecupdate | |
132 bra comm_mode1 | |
133 | |
134 btfsc rs232_recieve_overflow | |
135 bra comm_mode2 ; Cycle | |
136 | 123 |
137 movlw 0xAA ; start byte=0xAA? | 124 movlw 0xAA ; start byte=0xAA? |
138 cpfseq RCREG1 | 125 cpfseq RCREG1 |
139 bra comm_mode2a | 126 bra comm_mode2a |
140 bra comm_mode2b ; Startbyte for service mode found | 127 bra comm_mode2b ; Startbyte for service mode found |
141 comm_mode2a: | 128 comm_mode2a: |
142 movlw 0xBB ; start byte=0xBB? | 129 movlw 0xBB ; start byte=0xBB? |
143 cpfseq RCREG1 | 130 cpfseq RCREG1 |
144 bra comm_mode2 ; Cycle | 131 bra comm_mode2c |
145 bra comm_download_mode ; Startbyte for download mode found | 132 bra comm_download_mode ; Startbyte for download mode found |
133 | |
134 comm_mode2c: | |
135 btfss vusb_in ; USB plugged in? | |
136 bra comm_service_exit_nousb_delay ; Disconnected -> Exit | |
137 comm_mode4a: | |
138 btfsc switch_right ; Abort with right | |
139 bra comm_service_exit | |
140 | |
141 btfsc onesecupdate | |
142 bra comm_mode1 | |
143 | |
144 bra comm_mode2 ; Cycle | |
146 | 145 |
147 comm_mode2b: | 146 comm_mode2b: |
148 ; Startbyte found | 147 ; Startbyte found |
149 rcall comm_rs232_wait_tx ; Wait for UART | 148 rcall comm_rs232_wait_tx ; Wait for UART |
150 movlw 0x4B | 149 movlw 0x4B |