Mercurial > public > hwos_code
comparison src/comm.asm @ 628:cd58f7fc86db
3.05 stable work
author | heinrichsweikamp |
---|---|
date | Thu, 19 Sep 2019 12:01:29 +0200 |
parents | c40025d8e750 |
children | 185ba2f91f59 |
comparison
equal
deleted
inserted
replaced
627:bf5fee575701 | 628:cd58f7fc86db |
---|---|
1 ;============================================================================= | 1 ;============================================================================= |
2 ; | 2 ; |
3 ; File comm.asm combined next generation V3.03.3 | 3 ; File comm.asm combined next generation V3.04.3 |
4 ; | 4 ; |
5 ; RS232 via USB | 5 ; RS232 via USB |
6 ; | 6 ; |
7 ; Copyright (c) 2012, JD Gascuel, HeinrichsWeikamp, all right reserved. | 7 ; Copyright (c) 2012, JD Gascuel, HeinrichsWeikamp, all right reserved. |
8 ;============================================================================= | 8 ;============================================================================= |
89 STRCPY_TEXT_PRINT tBleTitle ; print BLE title text | 89 STRCPY_TEXT_PRINT tBleTitle ; print BLE title text |
90 comm_mode_common_2: | 90 comm_mode_common_2: |
91 call TFT_standard_color ; set standard color | 91 call TFT_standard_color ; set standard color |
92 WIN_TOP .10 ; positioning of USB/BLE logo, row | 92 WIN_TOP .10 ; positioning of USB/BLE logo, row |
93 WIN_LEFT .1 ; positioning of USB/BLE logo, column | 93 WIN_LEFT .1 ; positioning of USB/BLE logo, column |
94 TFT_WRITE_PROM_IMAGE_BY_ADDR usb_ble_logo_block ; show USB/BLE logo, respective logo is stored in bootloader section dependent on OSTC type | 94 btfsc battery_gauge_available ; "+" bootloader ? |
95 bra comm_mode_common_3 ; NO | |
96 TFT_WRITE_PROM_IMAGE_BY_ADDR usb_ble_logo_2 ; YES - show USB/BLE logo 2 | |
97 bra comm_mode_common_4 | |
98 comm_mode_common_3: | |
99 TFT_WRITE_PROM_IMAGE_BY_ADDR usb_ble_logo_1 ; NO - show USB/BLE logo 1 | |
100 comm_mode_common_4: | |
95 WIN_SMALL comm_status1_column,comm_status1_row ; positioning of status message | 101 WIN_SMALL comm_status1_column,comm_status1_row ; positioning of status message |
96 STRCPY_TEXT_PRINT tUsbStarting ; print status message "starting..." | 102 STRCPY_TEXT_PRINT tUsbStarting ; print status message "starting..." |
97 WIN_TINY .40,.240-.16 ; set output position to bottom line | 103 WIN_TINY .40,.240-.16 ; set output position to bottom line |
98 call TFT_show_serial_and_firmware ; show serial number and firmware version | 104 call TFT_show_serial_and_firmware ; show serial number and firmware version |
99 call option_save_all ; save all settings into EEPROM (comm mode may be entered after settings have been changed without leaving the menu in between) | 105 call option_save_all ; save all settings into EEPROM (comm mode may be entered after settings have been changed without leaving the menu in between) |
125 movlw 0xBB ; coding of download mode start byte: 0xBB | 131 movlw 0xBB ; coding of download mode start byte: 0xBB |
126 cpfseq RCREG1 ; received download mode start byte? | 132 cpfseq RCREG1 ; received download mode start byte? |
127 bra comm_mode2c ; NO | 133 bra comm_mode2c ; NO |
128 bra comm_download_mode ; YES - received start byte for download mode | 134 bra comm_download_mode ; YES - received start byte for download mode |
129 comm_mode2c: | 135 comm_mode2c: |
136 btfsc ble_available ; BLE available? | |
137 bra comm_mode4a ; YES - skip USB check check (required for very old OSTC sport) | |
130 btfss vusb_in ; USB plugged in? | 138 btfss vusb_in ; USB plugged in? |
131 bra comm_service_exit_nousb_delay; NO - disconnected, exit comm mode | 139 bra comm_service_exit_nousb_delay; NO - disconnected, exit comm mode |
132 comm_mode4a: | 140 comm_mode4a: |
133 btfsc switch_right ; right button pressed? | 141 btfsc switch_right ; right button pressed? |
134 bra comm_service_exit ; YES - exit comm mode | 142 bra comm_service_exit ; YES - exit comm mode |
168 | 176 |
169 comm_service_exit_nousb_delay: | 177 comm_service_exit_nousb_delay: |
170 WAITMS d'200' ; wait 200 ms | 178 WAITMS d'200' ; wait 200 ms |
171 btfsc vusb_in ; USB plugged in? | 179 btfsc vusb_in ; USB plugged in? |
172 bra comm_mode4a ; YES - (still) connected, return | 180 bra comm_mode4a ; YES - (still) connected, return |
173 comm_service_exit_nousb: ; NO - disconnected | 181 comm_service_exit_nousb: |
182 bcf LEDr ; switch off red LED | |
174 WIN_SMALL comm_status3_column, comm_status3_row | 183 WIN_SMALL comm_status3_column, comm_status3_row |
175 STRCPY_TEXT_PRINT tUsbClosed ; print port closed message | 184 STRCPY_TEXT_PRINT tUsbClosed ; print port closed message |
176 bra comm_service_exit_common ; exit to restart | 185 bra comm_service_exit_common ; exit to restart |
177 | 186 |
178 comm_service_exit: | 187 comm_service_exit: |
408 comm_download_mode1: | 417 comm_download_mode1: |
409 bcf trigger_full_second ; clear 'one second elapsed' flag | 418 bcf trigger_full_second ; clear 'one second elapsed' flag |
410 dcfsnz comm_timeout_timer,F ; decrement timeout, reached zero? | 419 dcfsnz comm_timeout_timer,F ; decrement timeout, reached zero? |
411 bra comm_service_exit ; YES - exit | 420 bra comm_service_exit ; YES - exit |
412 comm_download_mode2: | 421 comm_download_mode2: |
413 rcall comm_get_byte ; No - check for a byte | 422 rcall comm_get_byte ; NO - check for a byte |
414 btfsc comm_service_enabled ; com service mode enabled? | 423 btfsc comm_service_enabled ; com service mode enabled? |
415 btg LEDr ; YES - blink in service mode | 424 btg LEDr ; YES - blink in service mode |
425 btfsc ble_available ; BLE available? | |
426 bra comm_download_mode3 ; YES - skip USB check (required for very old OSTC sport) | |
416 btfss vusb_in ; USB plugged in? | 427 btfss vusb_in ; USB plugged in? |
417 bra comm_service_exit_nousb ; NO - disconnected -> exit | 428 bra comm_service_exit_nousb ; NO - disconnected -> exit |
418 btfsc switch_right ; YES - shall abort? | 429 comm_download_mode3: |
419 bra comm_service_exit ; YES | 430 btfsc switch_right ; shall abort? |
420 btfsc trigger_full_second ; NO - did 1 second elapsed meanwhile? | 431 bra comm_service_exit ; YES |
421 bra comm_download_mode1 ; YES - check for timeout | 432 btfsc trigger_full_second ; NO - did 1 second elapsed meanwhile? |
422 btfsc rs232_rx_timeout ; NO - got a byte? | 433 bra comm_download_mode1 ; YES - check for timeout |
423 bra comm_download_mode2 ; NO - loop waiting for command byte | 434 btfsc rs232_rx_timeout ; NO - got a byte? |
424 ; YES - command received | 435 bra comm_download_mode2 ; NO - loop waiting for command byte |
436 ; Command received | |
425 bcf LEDr | 437 bcf LEDr |
426 movlw 0xFF | 438 movlw 0xFF |
427 cpfseq RCREG1 | 439 cpfseq RCREG1 |
428 bra $+4 | 440 bra $+4 |
429 bra comm_service_exit ; exit | 441 bra comm_service_exit ; exit |
1174 dcfsnz WREG | 1186 dcfsnz WREG |
1175 movff opt_store_apnoe_dive, TXREG1 ; RCREG1=0x88 | 1187 movff opt_store_apnoe_dive, TXREG1 ; RCREG1=0x88 |
1176 dcfsnz WREG | 1188 dcfsnz WREG |
1177 movff opt_tissue_graphics, TXREG1 ; RCREG1=0x89 | 1189 movff opt_tissue_graphics, TXREG1 ; RCREG1=0x89 |
1178 dcfsnz WREG | 1190 dcfsnz WREG |
1179 movff opt_layout, TXREG1 ; RCREG1=0x90 | 1191 movff opt_layout, TXREG1 ; RCREG1=0x8A |
1180 dcfsnz WREG | 1192 dcfsnz WREG |
1181 movff opt_extended_stops, TXREG1 ; RCREG1=0x91 | 1193 movff opt_extended_stops, TXREG1 ; RCREG1=0x8B |
1194 dcfsnz WREG | |
1195 movff char_I_gas_density_att, TXREG1 ; RCREG1=0x8C | |
1196 dcfsnz WREG | |
1197 movff char_I_gas_density_warn, TXREG1 ; RCREG1=0x8D | |
1198 dcfsnz WREG | |
1199 movff char_I_dil_ppO2_check, TXREG1 ; RCREG1=0x8E | |
1182 | 1200 |
1183 comm_read_abort: | 1201 comm_read_abort: |
1184 comm_read_done: | 1202 comm_read_done: |
1185 bra comm_download_mode0 ; done, loop with timeout reset | 1203 bra comm_download_mode0 ; done, loop with timeout reset |
1186 | 1204 |
1503 dcfsnz WREG | 1521 dcfsnz WREG |
1504 movff RCREG1, opt_store_apnoe_dive ; RCREG1=0x88 | 1522 movff RCREG1, opt_store_apnoe_dive ; RCREG1=0x88 |
1505 dcfsnz WREG | 1523 dcfsnz WREG |
1506 movff RCREG1, opt_tissue_graphics ; RCREG1=0x89 | 1524 movff RCREG1, opt_tissue_graphics ; RCREG1=0x89 |
1507 dcfsnz WREG | 1525 dcfsnz WREG |
1508 movff RCREG1, opt_layout ; RCREG1=0x90 | 1526 movff RCREG1, opt_layout ; RCREG1=0x8A |
1509 dcfsnz WREG | 1527 dcfsnz WREG |
1510 movff RCREG1, opt_extended_stops ; RCREG1=0x91 | 1528 movff RCREG1, opt_extended_stops ; RCREG1=0x8B |
1529 dcfsnz WREG | |
1530 movff RCREG1, char_I_gas_density_att ; RCREG1=0x8C | |
1531 dcfsnz WREG | |
1532 movff RCREG1, char_I_gas_density_warn ; RCREG1=0x8D | |
1533 dcfsnz WREG | |
1534 movff RCREG1, char_I_dil_ppO2_check ; RCREG1=0x8E | |
1511 | 1535 |
1512 | 1536 |
1513 comm_write_abort: | 1537 comm_write_abort: |
1514 comm_write_done: | 1538 comm_write_done: |
1515 ; check options, gases and diluents | 1539 ; check options, gases and diluents |