comparison src/comm.asm @ 656:8af5aefbcdaf default tip

Update to 3.31 beta
author heinrichsweikamp
date Thu, 27 Nov 2025 18:32:58 +0100
parents 75e90cd0c2c3
children
comparison
equal deleted inserted replaced
655:c7b7b8a358cd 656:8af5aefbcdaf
102 ;----------------------------------------------------------------------------- 102 ;-----------------------------------------------------------------------------
103 ; Common Part of Comm Mode Entry 103 ; Common Part of Comm Mode Entry
104 ; 104 ;
105 comm_mode_common: 105 comm_mode_common:
106 clrf STKPTR ; reset addresses stack 106 clrf STKPTR ; reset addresses stack
107 call enable_rs232 ; enable serial comm, also sets CPU to normal speed (init here, we need the aux_flag valid)
107 call TFT_ClearScreen ; clear screen 108 call TFT_ClearScreen ; clear screen
108 FONT_COLOR color_greenish ; set color 109 FONT_COLOR color_green ; set color
109 110
110 btfss aux_flag ; shall show USB title? 111 btfss aux_flag ; shall show USB title?
111 bra comm_mode_common_bt ; NO - show BT title 112 bra comm_mode_common_bt ; NO - show BT title
112 ;bra comm_mode_common_usb ; YES - show USB title 113 ;bra comm_mode_common_usb ; YES - show USB title
113 114
114 comm_mode_common_usb: 115 comm_mode_common_usb:
115 WIN_SMALL comm_title_column_usb, comm_title_row ; set USB title position 116 WIN_SMALL comm_title_column_usb, comm_title_row ; set USB title position
116 STRCPY_TEXT_PRINT tUsbTitle ; print USB title text 117 STRCPY_TEXT_PRINT tUsbTitle ; print USB title text
117 bra comm_mode_common_logo ; continue with logo 118 bra comm_mode_common_start
118 119
119 comm_mode_common_bt: 120 comm_mode_common_bt:
120 WIN_SMALL comm_title_column_ble, comm_title_row ; set BT title position 121 WIN_SMALL comm_title_column_ble, comm_title_row ; set BT title position
121 STRCPY_TEXT_PRINT tBleTitle ; print BT title text 122 STRCPY_TEXT_PRINT tBleTitle ; print BT title text
122 ;bra comm_mode_common_logo ; continue with logo 123 ;bra comm_mode_common_start
123 124
124 comm_mode_common_logo: 125 ;comm_mode_common_logo:
125 WIN_TOP .10 ; set position of USB/BLE logo, row 126 ; WIN_TOP .10 ; set position of USB/BLE logo, row
126 WIN_LEFT .1 ; set position of USB/BLE logo, column 127 ; WIN_LEFT .1 ; set position of USB/BLE logo, column
127 btfss battery_gauge_available ; "+" bootloader ? 128 ; btfss battery_gauge_available ; "+" bootloader ?
128 bra comm_mode_common_logo2 ; YES - show logo type 2 129 ; bra comm_mode_common_logo2 ; YES - show logo type 2
129 ;bra comm_mode_common_logo1 ; NO - show logo type 1 130 ; ;bra comm_mode_common_logo1 ; NO - show logo type 1
130 131 ;
131 comm_mode_common_logo1: 132 ;comm_mode_common_logo1:
132 TFT_WRITE_PROM_IMAGE_BY_ADDR comm_logo_1 ; show USB/BT logo 133 ; btfsc dn_flag
133 bra comm_mode_common_start ; continue with starting message 134 ; bra comm_mode_common_logo3
134 135 ; TFT_WRITE_PROM_IMAGE_BY_ADDR comm_logo_1 ; show USB/BT logo
135 comm_mode_common_logo2: 136 ; bra comm_mode_common_start ; continue with starting message
136 btfsc dn_flag 137 ;
137 bra comm_mode_common_logo3 138 ;comm_mode_common_logo2:
138 TFT_WRITE_PROM_IMAGE_BY_ADDR comm_logo_2 ; show BT logo / OSTC+ 139 ; TFT_WRITE_PROM_IMAGE_BY_ADDR comm_logo_2 ; show BT logo / OSTC+
139 bra comm_mode_common_start ; continue with starting message 140 ; bra comm_mode_common_start ; continue with starting message
140 141 ;
141 comm_mode_common_logo3: 142 ;comm_mode_common_logo3:
142 TFT_WRITE_PROM_IMAGE_BY_ADDR comm_logo_3 ; show BT logo / dn 143 ; TFT_WRITE_PROM_IMAGE_BY_ADDR comm_logo_3 ; show BT logo / dn
143 144
144 comm_mode_common_start: 145 comm_mode_common_start:
145 WIN_SMALL comm_status1_column,comm_status1_row ; set position 146 WIN_SMALL comm_status1_column,comm_status1_row ; set position
146 FONT_COLOR_MEMO ; set standard color 147 FONT_COLOR_MEMO ; set standard color
147 STRCPY_TEXT_PRINT tUsbStarting ; print status message "starting..." 148 STRCPY_TEXT_PRINT tUsbStarting ; print status message "starting..."
152 IFDEF _screendump 153 IFDEF _screendump
153 bcf screen_dump_avail ; disable screen dump function 154 bcf screen_dump_avail ; disable screen dump function
154 ENDIF 155 ENDIF
155 156
156 bcf switch_right ; clear potential left-over right button event 157 bcf switch_right ; clear potential left-over right button event
157 call enable_rs232 ; enable serial comm, also sets CPU to normal speed 158 TSTOSC opt_BLE_compatibility ; Use BLE compatibility mode?
158 159 call ble2_configure_name ; YES, setup BLE name (Will only do something for dn_mode flag set)
160
159 WIN_SMALL comm_status1_column+.80,comm_status1_row ; set position after starting message 161 WIN_SMALL comm_status1_column+.80,comm_status1_row ; set position after starting message
160 FONT_COLOR_MEMO ; set standard color 162 FONT_COLOR_MEMO ; set standard color
161 STRCPY_TEXT_PRINT tUsbStartDone ; print (adding to status message) "done..." 163 STRCPY_TEXT_PRINT tUsbStartDone ; print (adding to status message) "done..."
162 164
163 movlw timeout_comm_pre_mode ; get timeout for phase without communication established yet 165 movlw timeout_comm_pre_mode ; get timeout for phase without communication established yet
184 movf lo,W ; NO - copy received byte to lo again 186 movf lo,W ; NO - copy received byte to lo again
185 xorlw 0xBB ; - download mode start byte received? 187 xorlw 0xBB ; - download mode start byte received?
186 bz comm_download_mode ; YES - enter command loop 188 bz comm_download_mode ; YES - enter command loop
187 ;bra comm_mode_selection_loop_2 ; NO - check for comm mode termination 189 ;bra comm_mode_selection_loop_2 ; NO - check for comm mode termination
188 comm_mode_selection_loop_2: 190 comm_mode_selection_loop_2:
191 btfsc dual_comm ; Dual comm hardware?
192 bra comm_mode_selection_loop_3 ; YES - skip USB check check since vusb_in is only used for usb here
189 btfsc ble_available ; BT available? 193 btfsc ble_available ; BT available?
190 bra comm_mode_selection_loop_3 ; YES - skip USB check check (required for very old OSTC sport) 194 bra comm_mode_selection_loop_3 ; YES - skip USB check check (required for very old OSTC sport)
191 btfss vusb_in ; NO - USB plugged in? 195 btfss vusb_in ; NO - USB plugged in?
192 bra comm_service_exit_nousb_delay ; NO - disconnected, check for vusb_in glitch 196 bra comm_service_exit_nousb_delay ; NO - disconnected, check for vusb_in glitch
193 ;bra comm_mode_selection_loop_3 ; YES - check for exit button or continue looping 197 ;bra comm_mode_selection_loop_3 ; YES - check for exit button or continue looping
319 SERIAL_CC_RECEIVE lo ; (try to) receive a command byte 323 SERIAL_CC_RECEIVE lo ; (try to) receive a command byte
320 btfss rs232_rx_timeout ; timeout? 324 btfss rs232_rx_timeout ; timeout?
321 bra comm_command_decode ; NO - decode and execute the command 325 bra comm_command_decode ; NO - decode and execute the command
322 btfsc comm_service_mode ; YES - service mode enabled? 326 btfsc comm_service_mode ; YES - service mode enabled?
323 btg LEDr ; YES - blink in service mode 327 btg LEDr ; YES - blink in service mode
328 btfsc dual_comm ; Dual comm hardware?
329 bra comm_command_loop_wait_1 ; YES - skip USB check check since vusb_in is only used for usb here
324 btfsc ble_available ; - BT available? 330 btfsc ble_available ; - BT available?
325 bra comm_command_loop_wait_1 ; YES - skip USB check (required for very old OSTC sport) 331 bra comm_command_loop_wait_1 ; YES - skip USB check (required for very old OSTC sport)
326 btfss vusb_in ; NO - USB still plugged in? 332 btfss vusb_in ; NO - USB still plugged in?
327 bra comm_service_exit_nousb ; NO - disconnected -> exit comm mode 333 bra comm_service_exit_nousb ; NO - disconnected -> exit comm mode
328 ;bra comm_command_loop_wait_1 ; YES - proceed 334 ;bra comm_command_loop_wait_1 ; YES - proceed