diff 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
line wrap: on
line diff
--- a/src/comm.asm	Tue Nov 03 11:35:29 2015 +0100
+++ b/src/comm.asm	Thu Nov 05 20:15:52 2015 +0100
@@ -102,38 +102,25 @@
 	dcfsnz 	timeout_counter,F
 	bra		comm_service_exit           ; Timeout -> Exit
 comm_mode2:
-    btfsc   rechargeable
-    bra     comm_mode4                  ; Skip
-
-	call	get_battery_voltage			; gets battery voltage
-    movlw   .3
-    cpfslt  batt_voltage+1              ; Batt Voltage less then 3*256mV?
-    bra     comm_mode3                  ; No
-    ; Set flag
-    bsf     battery_removed_in_usb      ; =1: The battery has been removed in USB
-    bra     comm_mode4
-
-comm_mode3:
-    ; Voltage ok. Do we have a new battery now?
-    btfsc   battery_removed_in_usb      ; =1: The battery has been removed in USB
-    goto	new_battery_menu            ; show "New battery dialog"
-
-comm_mode4:
+;    btfsc   rechargeable
+;    bra     comm_mode4                  ; Skip
+;
+;	call	get_battery_voltage			; gets battery voltage
+;    movlw   .3
+;    cpfslt  batt_voltage+1              ; Batt Voltage less then 3*256mV?
+;    bra     comm_mode3                  ; No
+;    ; Set flag
+;    bsf     battery_removed_in_usb      ; =1: The battery has been removed in USB
+;    bra     comm_mode4
+;
+;comm_mode3:
+;    ; Voltage ok. Do we have a new battery now?
+;    btfsc   battery_removed_in_usb      ; =1: The battery has been removed in USB
+;    goto	new_battery_menu            ; show "New battery dialog"
+;
+;comm_mode4:
 	rcall	comm_write_get_byte
 
-    btfss   vusb_in                     ; USB plugged in?
-    bra     comm_service_exit_nousb_delay   ; Disconnected -> Exit
-comm_mode4a:
-
-	btfsc	switch_right				; Abort with right
-	bra		comm_service_exit
-
-	btfsc	onesecupdate
-	bra		comm_mode1
-
-    btfsc   rs232_recieve_overflow
-    bra     comm_mode2				; Cycle
-
 	movlw	0xAA						; start byte=0xAA?
 	cpfseq	RCREG1
 	bra		comm_mode2a
@@ -141,9 +128,21 @@
 comm_mode2a:
 	movlw	0xBB						; start byte=0xBB?
 	cpfseq	RCREG1
-	bra		comm_mode2				; Cycle
+	bra		comm_mode2c
 	bra		comm_download_mode		; Startbyte for download mode found
 
+comm_mode2c:
+    btfss   vusb_in                     ; USB plugged in?
+    bra     comm_service_exit_nousb_delay   ; Disconnected -> Exit
+comm_mode4a:
+	btfsc	switch_right				; Abort with right
+	bra		comm_service_exit
+
+	btfsc	onesecupdate
+	bra		comm_mode1
+
+    bra     comm_mode2				; Cycle
+
 comm_mode2b:
 	; Startbyte found
 	rcall	comm_rs232_wait_tx			; Wait for UART