Mercurial > public > hwos_code
annotate src/comm.asm @ 627:bf5fee575701
minor cleanup, reset rx circuity
author | heinrichsweikamp |
---|---|
date | Sun, 30 Jun 2019 23:22:32 +0200 |
parents | c40025d8e750 |
children | cd58f7fc86db |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
623 | 3 ; File comm.asm combined next generation V3.03.3 |
0 | 4 ; |
5 ; RS232 via USB | |
6 ; | |
7 ; Copyright (c) 2012, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-08-22 : [mH] Creation | |
604 | 11 ; 2012-02-11 : [jDG] Added "c" set custom text, and "i" identify |
0 | 12 |
275 | 13 #include "hwos.inc" |
0 | 14 #include "eeprom_rs232.inc" |
15 #include "tft.inc" | |
16 #include "wait.inc" | |
17 #include "strings.inc" | |
18 #include "convert.inc" | |
19 #include "external_flash.inc" | |
20 #include "tft_outputs.inc" | |
21 #include "surfmode.inc" | |
22 #include "rtc.inc" | |
23 #include "adc_lightsensor.inc" | |
299
6c4800af27ac
Make char_I_bottom_usage and char_I_deco_usage configurable from PC
heinrichsweikamp
parents:
275
diff
changeset
|
24 #include "shared_definitions.h" |
604 | 25 #include "math.inc" |
0 | 26 |
582 | 27 extern restart |
28 extern option_reset_all | |
29 extern option_check_all | |
30 extern gaslist_cleanup_list | |
604 | 31 extern option_save_all |
582 | 32 extern vault_decodata_into_eeprom |
0 | 33 |
34 | |
623 | 35 #DEFINE timeout_comm_pre_mode .240 ; timeout before communication is established |
36 #DEFINE timeout_service_mode .120 ; timeout when communication is established | |
582 | 37 |
623 | 38 #DEFINE comm_title_row .0 ; positioning of title |
39 #DEFINE comm_title_column_usb .40 | |
582 | 40 #DEFINE comm_title_column_ble .25 |
0 | 41 |
623 | 42 #DEFINE comm_string_row .30 ; positioning of host-sent text messages |
582 | 43 #DEFINE comm_string_column .40 |
44 | |
623 | 45 #DEFINE comm_status1_row .70 ; positioning of COMM mode status messages |
582 | 46 #DEFINE comm_status1_column .10 |
47 #DEFINE comm_status2_row .100 | |
48 #DEFINE comm_status2_column comm_status1_column | |
49 #DEFINE comm_status3_row .130 | |
50 #DEFINE comm_status3_column comm_status1_column | |
604 | 51 #DEFINE comm_status4_row .160 |
52 #DEFINE comm_status4_column comm_status1_column | |
53 | |
623 | 54 #DEFINE comm_warning_row .160 ; positioning of COMM mode warning messages |
55 #DEFINE comm_warning_column .65 | |
582 | 56 |
0 | 57 |
604 | 58 comm CODE |
59 | |
60 ;============================================================================= | |
0 | 61 |
623 | 62 global comm_mode_usb |
63 comm_mode_usb: ; entry point for comm mode via USB | |
64 WAITMS d'1' ; wait 1 ms | |
65 btfss vusb_in ; USB still plugged in? | |
66 return ; NO - it was only a glitch, abort | |
67 WAITMS d'1' ; wait 1 ms | |
68 btfss vusb_in ; USB still plugged in? | |
69 return ; NO - it was only a glitch, abort | |
70 bsf aux_flag ; YES - remember to show USB title | |
71 bra comm_mode_common ; - continue with common part | |
72 | |
73 global comm_mode_ble | |
74 comm_mode_ble: ; entry point for comm mode via BLE | |
75 bcf aux_flag ; remember to show BLE title | |
76 ;bra comm_mode_common ; continue with common part | |
77 | |
78 comm_mode_common: | |
79 clrf STKPTR ; clear return addresses stack | |
80 call TFT_ClearScreen ; clear screen | |
81 WIN_COLOR color_greenish ; set color | |
82 btfss aux_flag ; shall show USB title? | |
83 bra comm_mode_common_1 ; NO | |
84 WIN_SMALL comm_title_column_usb, comm_title_row ; YES - set USB title position | |
85 STRCPY_TEXT_PRINT tUsbTitle ; - print USB title text | |
86 bra comm_mode_common_2 | |
87 comm_mode_common_1: | |
88 WIN_SMALL comm_title_column_ble, comm_title_row ; set BLE title position | |
89 STRCPY_TEXT_PRINT tBleTitle ; print BLE title text | |
90 comm_mode_common_2: | |
91 call TFT_standard_color ; set standard color | |
92 WIN_TOP .10 ; positioning of USB/BLE logo, row | |
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 | |
95 WIN_SMALL comm_status1_column,comm_status1_row ; positioning of status message | |
96 STRCPY_TEXT_PRINT tUsbStarting ; print status message "starting..." | |
97 WIN_TINY .40,.240-.16 ; set output position to bottom line | |
98 call TFT_show_serial_and_firmware ; show serial number and firmware version | |
604 | 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) |
100 | |
101 IFDEF _screendump | |
623 | 102 bcf screen_dump_avail ; disable screen dump function |
604 | 103 ENDIF |
104 | |
623 | 105 bcf switch_right ; clear left-over right button event |
106 bcf comm_service_enabled ; communication is not yet established | |
107 bsf surfmode_menu ; flag that restart will be entered from surface menu / comm mode | |
108 movlw timeout_comm_pre_mode ; get timeout for phase without communication established yet | |
109 movwf comm_timeout_timer ; initialize timeout counter | |
582 | 110 WIN_SMALL comm_status1_column+.80,comm_status1_row |
623 | 111 STRCPY_TEXT_PRINT tUsbStartDone ; add to status message "done..." |
112 call enable_rs232 ; enable serial comm, also sets CPU to normal speed | |
0 | 113 comm_mode1: |
623 | 114 bcf trigger_full_second ; clear 'one second elapsed' flag |
115 bcf LEDr ; switch off red LED / power down TR co-processor | |
116 dcfsnz comm_timeout_timer,F ; decrement timeout, reached zero? | |
117 bra comm_service_exit ; YES - timeout, exit comm mode | |
0 | 118 comm_mode2: |
623 | 119 rcall comm_get_byte ; read 1 byte from RX buffer |
120 movlw 0xAA ; coding of service mode start byte: 0xAA | |
121 cpfseq RCREG1 ; received service mode start byte? | |
122 bra comm_mode2a ; NO - probe for download mode | |
123 bra comm_mode2b ; YES - received start byte for service mode | |
0 | 124 comm_mode2a: |
623 | 125 movlw 0xBB ; coding of download mode start byte: 0xBB |
126 cpfseq RCREG1 ; received download mode start byte? | |
127 bra comm_mode2c ; NO | |
128 bra comm_download_mode ; YES - received start byte for download mode | |
393 | 129 comm_mode2c: |
582 | 130 btfss vusb_in ; USB plugged in? |
623 | 131 bra comm_service_exit_nousb_delay; NO - disconnected, exit comm mode |
393 | 132 comm_mode4a: |
623 | 133 btfsc switch_right ; right button pressed? |
134 bra comm_service_exit ; YES - exit comm mode | |
135 btfsc trigger_full_second ; NO - did 1 second elapsed meanwhile? | |
136 bra comm_mode1 ; YES - loop with clocking down timeout counter | |
137 bra comm_mode2 ; NO - loop without clocking down timeout counter | |
0 | 138 |
623 | 139 ; received start byte for service mode |
140 comm_mode2b: | |
141 rcall comm_write_byte ; wait for completion of transmit | |
142 movlw 0x4B ; prepare answer | |
143 movwf TXREG1 ; send answer | |
144 ; check if correct service key is received | |
145 rcall comm_get_byte ; receive first byte | |
146 rcall comm_write_byte ; wait for completion of transmit | |
147 movff RCREG1,TXREG1 ; echo received byte | |
148 movlw UPPER comm_service_key ; load expected byte | |
149 cpfseq RCREG1 ; received expected byte? | |
150 bra comm_mode1 ; NO - restart | |
151 rcall comm_get_byte ; receive second byte | |
152 rcall comm_write_byte ; wait for completion of transmit | |
153 movff RCREG1,TXREG1 ; echo received byte | |
154 movlw HIGH (comm_service_key & 0xFFFF) ; load expected byte | |
155 cpfseq RCREG1 ; received expected byte? | |
156 bra comm_mode1 ; NO - restart | |
157 rcall comm_get_byte ; receive third byte | |
158 rcall comm_write_byte ; wait for completion of transmit | |
159 movff RCREG1,TXREG1 ; echo received byte | |
160 movlw LOW comm_service_key ; load expected byte | |
161 cpfseq RCREG1 ; received expected byte? | |
162 bra comm_mode1 ; NO - restart | |
163 ; YES to all - enable com service mode | |
582 | 164 WIN_SMALL comm_status2_column, comm_status2_row |
623 | 165 STRCPY_TEXT_PRINT tUsbServiceMode ; print service mode enabled message |
166 bsf comm_service_enabled ; set flag for com service mode enabled | |
167 bra comm_download_mode0 ; continue using common routine | |
69 | 168 |
169 comm_service_exit_nousb_delay: | |
623 | 170 WAITMS d'200' ; wait 200 ms |
582 | 171 btfsc vusb_in ; USB plugged in? |
604 | 172 bra comm_mode4a ; YES - (still) connected, return |
623 | 173 comm_service_exit_nousb: ; NO - disconnected |
582 | 174 WIN_SMALL comm_status3_column, comm_status3_row |
623 | 175 STRCPY_TEXT_PRINT tUsbClosed ; print port closed message |
176 bra comm_service_exit_common ; exit to restart | |
0 | 177 |
178 comm_service_exit: | |
179 WIN_SMALL comm_status3_column, comm_status3_row | |
623 | 180 STRCPY_TEXT_PRINT tUsbExit ; print exited message |
0 | 181 comm_service_exit_common: |
623 | 182 rcall comm_write_byte ; wait for completion of transmit |
183 movlw 0xFF ; prepare reply "FF" | |
184 movwf TXREG1 ; send reply | |
185 call wait_1s ; wait <= 1 second | |
186 call wait_1s ; wait 1 second | |
187 call disable_rs232 ; shut down comm port | |
188 goto restart ; restart | |
0 | 189 |
190 | |
191 ;----------------------------------------------------------------------------- | |
623 | 192 ; Start Bootloader |
193 ; | |
0 | 194 comm_service_ll_bootloader: |
623 | 195 bsf LEDr ; switch on red LED |
582 | 196 WIN_SMALL comm_status3_column, comm_status3_row |
623 | 197 STRCPY_TEXT_PRINT tUsbLlBld ; print low level bootloader started message |
198 WIN_TOP comm_warning_row ; set row for icon | |
199 WIN_LEFT comm_warning_column ; set column for icon | |
200 TFT_WRITE_PROM_IMAGE_BY_LABEL dive_warning2_block ; show the warning icon | |
201 goto 0x1FF0C ; jump into the bootloader code | |
202 | |
0 | 203 |
204 ;----------------------------------------------------------------------------- | |
623 | 205 ; Send Firmware to Bootloader |
0 | 206 ; |
207 comm_send_firmware: | |
623 | 208 movlw 0x50 ; prepare reply |
209 movwf TXREG1 ; send reply | |
210 rcall comm_write_byte ; wait for completion of transmit | |
211 lfsr FSR2,buffer ; load base address of buffer | |
212 movlw .5 ; read 5 bytes into buffer | |
213 movwf lo ; initialize loop counter | |
214 movlw 0x55 ; initialize checksum byte | |
215 movwf hi ; store in hi | |
0 | 216 comm_send_firmware_loop: |
623 | 217 rcall comm_get_byte ; receive one byte |
218 btfsc rs232_rx_timeout ; got a byte? | |
219 bra comm_send_firmware_abort ; NO - abort | |
220 movf RCREG1,W ; YES - copy received byte to WREG | |
221 movwf POSTINC2 ; - copy received byte to buffer | |
222 xorwf hi,F ; - xor received byte into checksum | |
223 rlncf hi,F ; - rotate checksum byte | |
224 decfsz lo,F ; - decrement loop counter, done? | |
225 bra comm_send_firmware_loop ; NO - loop | |
226 movf hi,W ; YES - copy checksum to WREG, zero flag set? | |
227 bnz comm_send_firmware_failed ; NO - checksum test failed | |
228 movlw 0x4C ; YES - checksum ok, prepare reply | |
229 movwf TXREG1 ; - send reply | |
230 rcall comm_write_byte ; - wait for completion of transmit | |
231 call vault_decodata_into_eeprom ; - store last deco data (and time/date) to EEPROM | |
232 goto 0x1FDF0 ; - jump into the bootloader code | |
0 | 233 |
234 comm_send_firmware_failed: | |
582 | 235 WIN_SMALL comm_string_column, comm_string_row |
623 | 236 call TFT_warning_color ; set warning color |
237 STRCPY_PRINT "Checksum failed" ; print failure message | |
0 | 238 comm_send_firmware_abort: |
623 | 239 movlw 0xFF ; prepare reply for ABORTED |
240 movwf TXREG1 ; send reply | |
604 | 241 bra comm_download_mode0 ; done |
0 | 242 |
623 | 243 |
0 | 244 ;----------------------------------------------------------------------------- |
623 | 245 ; Reset to Dive 1 in Logbook |
246 ; | |
0 | 247 comm_reset_logbook_pointers: |
623 | 248 call eeprom_reset_logbook_pointers ; clear logbook pointers in EEPROM |
249 call ext_flash_erase_logbook ; clear complete logbook(!) | |
582 | 250 bra comm_download_mode0 ; done |
0 | 251 |
252 ;----------------------------------------------------------------------------- | |
623 | 253 ; Reset Battery Gauge |
254 ; | |
255 comm_reset_battery_gauge: ; reset battery gauge registers | |
256 call reset_battery_pointer ; reset battery pointer 0x07-0x0C and battery gauge | |
604 | 257 bra comm_download_mode0 ; done |
0 | 258 |
259 ;----------------------------------------------------------------------------- | |
623 | 260 ; Erase a Memory Range given byte Start Address and Number of 4 kB Blocks |
261 ; | |
262 comm_erase_range4kb: | |
263 movlw 0x42 ; prepare reply | |
264 movwf TXREG1 ; send reply | |
265 rcall comm_write_byte ; wait for completion of transmit | |
266 bcf INTCON,GIE ; disable all interrupts | |
267 rcall comm_get_flash_address ; get three bytes start address or return | |
268 btfsc rs232_rx_timeout ; got start address? | |
269 bra comm_download_mode0 ; NO - done | |
270 rcall comm_get_byte ; YES - get number of blocks | |
271 btfsc rs232_rx_timeout ; - got number? | |
272 bra comm_download_mode0 ; NO - done | |
273 movff RCREG1,lo ; YES - copy number of blocks to lo | |
274 comm_erase_range4kb_loop: | |
275 call ext_flash_erase4kB ; - erase a memory block | |
276 movlw 0x10 ; - increase start address by 4096 (0x1000) | |
277 addwf ext_flash_address+1,F ; - ... | |
278 movlw .0 ; - ... | |
279 addwfc ext_flash_address+2,F ; - ... | |
280 decfsz lo,F ; - decrement block counter, all blocks done? | |
281 bra comm_erase_range4kb_loop ; NO - loop | |
282 bra comm_download_mode0 ; YES - done | |
0 | 283 |
623 | 284 ;----------------------------------------------------------------------------- |
285 ; Erase one Memory Block of 4 kB Size | |
286 ; | |
287 comm_erase_4kb: | |
288 bcf INTCON,GIE ; disable all interrupts | |
289 rcall comm_get_flash_address ; get three bytes start address or return | |
290 btfsc rs232_rx_timeout ; got start address? | |
291 bra comm_download_mode0 ; NO - done | |
292 call ext_flash_erase4kB ; YES - erase memory block | |
293 bra comm_download_mode0 ; - done | |
0 | 294 |
295 ;----------------------------------------------------------------------------- | |
623 | 296 ; Write a Stream of Data Bytes to Memory |
297 ; | |
298 comm_write_range: | |
299 movlw 0x30 ; prepare reply | |
300 movwf TXREG1 ; send reply | |
301 rcall comm_write_byte ; wait for completion of transmit | |
302 bcf INTCON,GIE ; disable all interrupts | |
303 rcall comm_get_flash_address ; get three bytes starts address or return | |
304 btfsc rs232_rx_timeout ; got start address? | |
305 bra comm_download_mode0 ; NO - done | |
306 comm_write_range_loop: | |
307 rcall comm_get_byte ; YES - get data byte to write to memory | |
308 btfsc rs232_rx_timeout ; got byte? | |
309 bra comm_download_mode0 ; NO - done | |
310 movf RCREG1,W ; YES - copy received data byte to WREG | |
311 ; bsf NCTS ; - hold Bluetooth chip (requires PC/Android/iOS side to use flow control...) | |
312 call ext_flash_byte_write_comms ; - write data byte to flash memory | |
313 ; bcf NCTS ; - release Bluetooth chip (requires PC/Android/iOS side to use flow control...) | |
314 call incf_ext_flash_address_p1 ; - increase address | |
315 bra comm_write_range_loop ; - loop | |
0 | 316 |
623 | 317 |
318 ;----------------------------------------------------------------------------- | |
319 ; Read a Memory Section given by Start Address and Length | |
320 ; | |
321 comm_send_range: | |
322 movlw 0x20 ; prepare reply | |
323 movwf TXREG1 ; send reply | |
324 rcall comm_write_byte ; wait for completion of transmit | |
325 bcf INTCON,GIE ; disable all interrupts | |
326 rcall comm_get_flash_address ; get three bytes start address or return | |
327 btfsc rs232_rx_timeout ; got start address? | |
604 | 328 bra comm_download_mode0 ; NO - done |
623 | 329 rcall comm_get_byte ; get length, 3rd byte |
330 btfsc rs232_rx_timeout ; got byte? | |
604 | 331 bra comm_download_mode0 ; NO - done |
623 | 332 movff RCREG1,up ; store length, 3rd byte |
333 rcall comm_get_byte ; get length, 2nd byte | |
334 btfsc rs232_rx_timeout ; got byte? | |
604 | 335 bra comm_download_mode0 ; NO - done |
623 | 336 movff RCREG1,hi ; store length, 2nd byte |
337 rcall comm_get_byte ; get length, 1st byte | |
338 btfsc rs232_rx_timeout ; got byte? | |
604 | 339 bra comm_download_mode0 ; NO - done |
623 | 340 movff RCREG1,lo ; store length, 1st byte |
604 | 341 ; if lo==0, we must precondition hi because there are too many bytes sent |
582 | 342 movf lo,W |
343 bnz $+4 | |
344 decf hi,F | |
345 movlw 0x40 | |
623 | 346 cpfslt up ; up > 0x3F ? |
604 | 347 bra comm_download_mode0 ; YES - abort |
582 | 348 ; 6 bytes received, send data |
349 ; needs ext_flash_address:3 start address and up:hi:lo amount | |
0 | 350 call ext_flash_read_block_start |
351 movwf TXREG1 | |
604 | 352 bra comm_send_range24 ; counter 24 bit |
0 | 353 comm_send_range24_loop: |
604 | 354 call ext_flash_read_block ; read one byte |
355 movwf TXREG1 ; start new transmit | |
0 | 356 comm_send_range24: |
623 | 357 rcall comm_write_byte ; wait for completion of transmit |
0 | 358 decfsz lo,F |
359 bra comm_send_range24_loop | |
360 decf hi,F | |
361 movlw 0xFF | |
362 cpfseq hi | |
363 bra comm_send_range24_loop | |
364 decf up,F | |
365 movlw 0xFF | |
366 cpfseq up | |
367 bra comm_send_range24_loop | |
368 call ext_flash_read_block_stop | |
604 | 369 bra comm_download_mode0 ; done |
0 | 370 |
371 ;----------------------------------------------------------------------------- | |
372 | |
373 comm_get_flash_address: | |
604 | 374 rcall comm_get_byte |
623 | 375 btfsc rs232_rx_timeout ; got byte? |
604 | 376 return ; NO - return |
0 | 377 movff RCREG1,ext_flash_address+2 |
604 | 378 rcall comm_get_byte |
623 | 379 btfsc rs232_rx_timeout ; got byte? |
604 | 380 return ; NO - return |
0 | 381 movff RCREG1,ext_flash_address+1 |
604 | 382 rcall comm_get_byte |
623 | 383 btfsc rs232_rx_timeout ; got byte? |
604 | 384 return ; NO - return |
0 | 385 movff RCREG1,ext_flash_address+0 |
386 return | |
387 | |
388 ;----------------------------------------------------------------------------- | |
389 | |
390 comm_download_mode: | |
391 ; Enable comm download mode | |
582 | 392 WIN_SMALL comm_status2_column, comm_status2_row |
604 | 393 STRCPY_TEXT_PRINT tUsbDownloadMode ; download mode enabled |
394 bsf INTCON,GIE ; all interrupts on | |
623 | 395 rcall comm_write_byte ; wait for completion of transmit |
604 | 396 movlw 0xBB ; command echo |
397 movwf TXREG1 ; send answer | |
0 | 398 comm_download_mode0: |
604 | 399 bsf INTCON,GIE ; all interrupts on |
623 | 400 rcall comm_write_byte ; wait for completion of transmit |
401 movlw 0x4C ; default reply is 4C for service mode | |
402 btfss comm_service_enabled ; com service enabled? | |
403 movlw 0x4D ; NO - change to reply 4D for download mode | |
604 | 404 movwf TXREG1 ; send answer |
623 | 405 movlw timeout_service_mode ; get timeout value |
406 movwf comm_timeout_timer ; load into timeout counter | |
407 bcf switch_right ; clear left-over button event | |
0 | 408 comm_download_mode1: |
623 | 409 bcf trigger_full_second ; clear 'one second elapsed' flag |
410 dcfsnz comm_timeout_timer,F ; decrement timeout, reached zero? | |
411 bra comm_service_exit ; YES - exit | |
0 | 412 comm_download_mode2: |
623 | 413 rcall comm_get_byte ; No - check for a byte |
414 btfsc comm_service_enabled ; com service mode enabled? | |
415 btg LEDr ; YES - blink in service mode | |
416 btfss vusb_in ; USB plugged in? | |
417 bra comm_service_exit_nousb ; NO - disconnected -> exit | |
418 btfsc switch_right ; YES - shall abort? | |
419 bra comm_service_exit ; YES | |
420 btfsc trigger_full_second ; NO - did 1 second elapsed meanwhile? | |
421 bra comm_download_mode1 ; YES - check for timeout | |
422 btfsc rs232_rx_timeout ; NO - got a byte? | |
423 bra comm_download_mode2 ; NO - loop waiting for command byte | |
424 ; YES - command received | |
0 | 425 bcf LEDr |
426 movlw 0xFF | |
427 cpfseq RCREG1 | |
428 bra $+4 | |
429 bra comm_service_exit ; exit | |
430 movlw "a" | |
431 cpfseq RCREG1 | |
432 bra $+4 | |
604 | 433 bra comm_send_headers ; send all 256 dive headers |
0 | 434 movlw "b" |
435 cpfseq RCREG1 | |
436 bra $+4 | |
604 | 437 bra comm_set_time ; read time and date from the PC and set clock |
0 | 438 movlw "c" |
439 cpfseq RCREG1 | |
440 bra $+4 | |
604 | 441 bra comm_set_custom_text ; send a opt_name_length byte string of custom text |
582 | 442 movlw "f" ; 0x66 |
0 | 443 cpfseq RCREG1 |
444 bra $+4 | |
604 | 445 bra comm_send_dive ; send header and profile for one dive |
0 | 446 movlw "i" |
447 cpfseq RCREG1 | |
448 bra $+4 | |
604 | 449 bra comm_identify ; send firmware, serial, etc. |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
450 movlw "j" |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
451 cpfseq RCREG1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
452 bra $+4 |
604 | 453 bra comm_hardware_descriptor ; send hardware descriptor byte |
441
360acdcda0d7
+BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents:
426
diff
changeset
|
454 movlw 0x60 |
360acdcda0d7
+BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents:
426
diff
changeset
|
455 cpfseq RCREG1 |
360acdcda0d7
+BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents:
426
diff
changeset
|
456 bra $+4 |
604 | 457 bra comm_feature_and_hardware ; send more detailed information |
0 | 458 movlw "n" |
459 cpfseq RCREG1 | |
460 bra $+4 | |
604 | 461 goto comm_send_string ; send a 15 byte string to the screen |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
462 movlw "m" |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
463 cpfseq RCREG1 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
464 bra $+4 |
604 | 465 goto comm_send_compact_headers ; send all 256 compact headers |
466 IFDEF _screendump | |
0 | 467 movlw "l" |
468 cpfseq RCREG1 | |
604 | 469 bra $+4 |
470 call TFT_dump_screen ; dump the screen contents | |
471 ENDIF | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
472 movlw "r" |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
473 cpfseq RCREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
474 bra $+4 |
604 | 475 bra comm_read_setting ; read a setting (and send via USB) |
80 | 476 movlw "w" |
477 cpfseq RCREG1 | |
478 bra $+4 | |
604 | 479 bra comm_write_setting ; write a setting (into RAM) |
80 | 480 movlw "x" |
481 cpfseq RCREG1 | |
482 bra $+4 | |
604 | 483 bra comm_option_reset_all ; reset all options to factory default |
0 | 484 |
604 | 485 btfss comm_service_enabled ; done for download mode |
486 bra comm_download_mode0 ; loop with timeout reset | |
0 | 487 |
488 movlw 0x20 | |
489 cpfseq RCREG1 | |
490 bra $+4 | |
582 | 491 bra comm_send_range ; send hi:lo:ext_flash_rw bytes starting from ext_flash_address:3 |
0 | 492 movlw 0x22 |
493 cpfseq RCREG1 | |
494 bra $+4 | |
604 | 495 bra comm_reset_logbook_pointers ; reset all logbook pointers and the logbook |
0 | 496 movlw 0x23 |
497 cpfseq RCREG1 | |
498 bra $+4 | |
604 | 499 bra comm_reset_battery_gauge ; reset battery gauge registers |
0 | 500 movlw 0x30 |
501 cpfseq RCREG1 | |
502 bra $+4 | |
604 | 503 bra comm_write_range ; write bytes starting from ext_flash_address:3 (stop when timeout) |
0 | 504 movlw 0x40 |
505 cpfseq RCREG1 | |
506 bra $+4 | |
604 | 507 bra comm_erase_4kb ; erase 4 kB block from ext_flash_address:3 (Warning: no confirmation or built-in security here...) |
0 | 508 movlw 0x42 |
509 cpfseq RCREG1 | |
510 bra $+4 | |
604 | 511 bra comm_erase_range4kb ; erase range in 4 kB steps (get 3 bytes address and 1 byte amount of 4 kB blocks) |
0 | 512 movlw 0x50 |
513 cpfseq RCREG1 | |
514 bra $+4 | |
582 | 515 bra comm_send_firmware ; send firmware to bootloader |
147 | 516 ; movlw "t" |
517 ; cpfseq RCREG1 | |
518 ; bra $+4 | |
604 | 519 ; goto testloop ; start raw-data test loop |
0 | 520 movlw 0xC1 |
521 cpfseq RCREG1 | |
522 bra $+4 | |
604 | 523 bra comm_service_ll_bootloader ; start low-level bootloader |
524 bra comm_download_mode0 ; loop with timeout reset | |
0 | 525 |
526 ;----------------------------------------------------------------------------- | |
527 | |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
528 comm_send_compact_headers: |
560 | 529 movlw "m" ; send echo |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
530 movwf TXREG1 |
604 | 531 ; send 13 bytes/dive (compact header) |
347
7e5772df60cd
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
346
diff
changeset
|
532 ; 1st: 200009h-200016h |
7e5772df60cd
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
346
diff
changeset
|
533 ; 2nd: 201009h-201016h |
7e5772df60cd
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
346
diff
changeset
|
534 ; 3rd: 202009h-202016h |
7e5772df60cd
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
346
diff
changeset
|
535 ; 100: 264009h-264016h |
7e5772df60cd
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
346
diff
changeset
|
536 ; 256: 2FF009h-2FF016h |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
537 movlw 0x1F |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
538 movwf ext_flash_address+2 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
539 movlw 0xF0 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
540 movwf ext_flash_address+1 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
541 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
542 comm_send_compact_headers2: |
347
7e5772df60cd
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
346
diff
changeset
|
543 movlw 0x09 |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
544 movwf ext_flash_address+0 |
604 | 545 ; adjust address for next dive |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
546 movlw 0x10 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
547 addwf ext_flash_address+1 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
548 movlw 0x00 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
549 addwfc ext_flash_address+2 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
550 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
551 movlw 0x30 |
604 | 552 cpfseq ext_flash_address+2 ; all 256 dive send? |
553 bra comm_send_compact_headers4 ; NO - continue | |
554 bra comm_download_mode0 ; done, loop with timeout reset | |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
555 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
556 comm_send_compact_headers4: |
582 | 557 movlw .13 |
604 | 558 movwf lo ; counter |
623 | 559 rcall comm_write_byte ; wait for completion of transmit |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
560 call ext_flash_read_block_start ; 1st byte |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
561 movwf TXREG1 |
604 | 562 bra comm_send_compact_headers3 ; counter 24 bit |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
563 comm_send_compact_headers_loop: |
604 | 564 call ext_flash_read_block ; read one byte |
565 movwf TXREG1 ; start new transmit | |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
566 comm_send_compact_headers3: |
623 | 567 rcall comm_write_byte ; wait for completion of transmit |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
568 decfsz lo,F |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
569 bra comm_send_compact_headers_loop |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
570 call ext_flash_read_block_stop |
347
7e5772df60cd
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
346
diff
changeset
|
571 |
582 | 572 ; Offset to total dive counter |
356
fcf3ae0fee6a
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
354
diff
changeset
|
573 movlw .80 |
fcf3ae0fee6a
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
354
diff
changeset
|
574 movwf ext_flash_address+0 |
582 | 575 call ext_flash_read_block_start ; 1st byte |
576 movwf TXREG1 | |
623 | 577 rcall comm_write_byte ; wait for completion of transmit |
356
fcf3ae0fee6a
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
354
diff
changeset
|
578 call ext_flash_read_block ; 2nd byte |
fcf3ae0fee6a
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
354
diff
changeset
|
579 movwf TXREG1 |
582 | 580 call ext_flash_read_block_stop |
623 | 581 rcall comm_write_byte ; wait for completion of transmit |
356
fcf3ae0fee6a
Changed content for new 0x6F command (Get compact headers)
heinrichsweikamp
parents:
354
diff
changeset
|
582 |
582 | 583 ; Offset to Logbook-Profile version |
391 | 584 movlw .8 |
585 movwf ext_flash_address+0 | |
604 | 586 call ext_flash_byte_read ; get byte |
582 | 587 movwf TXREG1 |
623 | 588 rcall comm_write_byte ; wait for completion of transmit |
560 | 589 bra comm_send_compact_headers2 ; continue |
346
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
590 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
591 |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
592 ;----------------------------------------------------------------------------- |
cf9ce6053dee
New option to download "Compact Headers". Improved BLE support (OSTC 2 and OSTC 3+), updated OSTC interface documentation
heinrichsweikamp
parents:
337
diff
changeset
|
593 |
0 | 594 comm_send_headers: |
560 | 595 movlw "a" ; send echo |
0 | 596 movwf TXREG1 |
597 ; Send 256 bytes/dive (Header) | |
598 ; 1st: 200000h-2000FFh | |
599 ; 2nd: 201000h-2010FFh | |
600 ; 3rd: 202000h-2020FFh | |
601 ; 100: 264000h-2640FFh | |
602 ; 256: 2FF000h-2FF0FFh | |
603 movlw 0x1F | |
604 movwf ext_flash_address+2 | |
605 movlw 0xF0 | |
606 movwf ext_flash_address+1 | |
607 comm_send_headers2: | |
560 | 608 clrf ext_flash_address+0 |
0 | 609 ; Adjust address for next dive |
610 movlw 0x10 | |
611 addwf ext_flash_address+1 | |
612 movlw 0x00 | |
613 addwfc ext_flash_address+2 | |
614 movlw 0x30 | |
604 | 615 cpfseq ext_flash_address+2 ; all 256 dive send? |
616 bra comm_send_headers4 ; NO - continue | |
617 bra comm_download_mode0 ; done, loop with timeout reset | |
0 | 618 comm_send_headers4: |
604 | 619 clrf lo ; counter |
623 | 620 rcall comm_write_byte ; wait for completion of transmit |
0 | 621 call ext_flash_read_block_start ; 1st byte |
622 movwf TXREG1 | |
604 | 623 bra comm_send_headers3 ; counter 24 bit |
0 | 624 comm_send_headers_loop: |
604 | 625 call ext_flash_read_block ; read one byte |
626 movwf TXREG1 ; start new transmit | |
0 | 627 comm_send_headers3: |
623 | 628 rcall comm_write_byte ; wait for completion of transmit |
0 | 629 decfsz lo,F |
630 bra comm_send_headers_loop | |
631 call ext_flash_read_block_stop | |
560 | 632 bra comm_send_headers2 ; continue |
0 | 633 |
634 ;----------------------------------------------------------------------------- | |
80 | 635 |
604 | 636 comm_option_reset_all: ; reset all options to factory default |
560 | 637 movlw "x" ; send echo |
80 | 638 movwf TXREG1 |
582 | 639 call option_reset_all |
604 | 640 bra comm_download_mode0 ; done, back to loop with timeout reset |
80 | 641 |
642 ;----------------------------------------------------------------------------- | |
0 | 643 |
644 comm_set_time: | |
582 | 645 movlw "b" ; send echo |
0 | 646 movwf TXREG1 |
647 | |
623 | 648 rcall comm_write_byte ; wait for completion of transmit |
604 | 649 rcall comm_get_byte |
623 | 650 btfsc rs232_rx_timeout ; got byte? |
604 | 651 bra comm_download_mode0 ; NO - abort |
623 | 652 movff RCREG1, rtc_latched_hour |
604 | 653 rcall comm_get_byte |
623 | 654 btfsc rs232_rx_timeout ; got byte? |
604 | 655 bra comm_download_mode0 ; NO - abort |
623 | 656 movff RCREG1, rtc_latched_mins |
604 | 657 rcall comm_get_byte |
623 | 658 btfsc rs232_rx_timeout ; got byte? |
604 | 659 bra comm_download_mode0 ; NO - abort |
623 | 660 movff RCREG1, rtc_latched_secs |
604 | 661 rcall comm_get_byte |
623 | 662 btfsc rs232_rx_timeout ; got byte? |
604 | 663 bra comm_download_mode0 ; NO - abort |
623 | 664 movff RCREG1, rtc_latched_month |
604 | 665 rcall comm_get_byte |
623 | 666 btfsc rs232_rx_timeout ; got byte? |
604 | 667 bra comm_download_mode0 ; NO - abort |
623 | 668 movff RCREG1, rtc_latched_day |
669 rcall comm_get_byte | |
670 btfsc rs232_rx_timeout ; got byte? | |
671 bra comm_download_mode0 ; NO - abort | |
672 movff RCREG1, rtc_latched_year | |
673 call rtc_set_rtc ; write time and date to RTC module | |
604 | 674 bra comm_download_mode0 ; done, back to loop with timeout reset |
0 | 675 |
676 ;----------------------------------------------------------------------------- | |
604 | 677 ; Set custom text string (opt_name_length ASCII chars) |
0 | 678 ; |
679 | |
680 comm_set_custom_text: | |
582 | 681 movlw "c" ; send echo |
682 movwf TXREG1 | |
623 | 683 rcall comm_write_byte ; wait for completion of transmit |
582 | 684 lfsr FSR2,opt_name |
685 movlw opt_name_length | |
686 movwf lo ; counter | |
0 | 687 comm_set_ctext_loop: |
604 | 688 rcall comm_get_byte |
623 | 689 btfsc rs232_rx_timeout ; got byte? |
604 | 690 bra comm_set_ctext_loop_done ; NO - abort |
691 movff RCREG1,POSTINC2 ; store character | |
582 | 692 decfsz lo,F |
693 bra comm_set_ctext_loop | |
136 | 694 comm_set_ctext_loop_done: |
604 | 695 tstfsz lo ; got opt_name_length bytes? |
696 bra comm_set_ctext_loop_done2 ; NO - clear remaining chars | |
697 bra comm_download_mode0 ; done, loop with timeout reset | |
136 | 698 comm_set_ctext_loop_done2: |
582 | 699 clrf POSTINC2 |
700 decfsz lo,F | |
701 bra comm_set_ctext_loop_done2 | |
604 | 702 bra comm_download_mode0 ; done, loop with timeout reset |
0 | 703 |
704 ;----------------------------------------------------------------------------- | |
604 | 705 ; Reply Serial (2 bytes low:high), firmware (major.minor) and custom text |
0 | 706 ; |
582 | 707 |
0 | 708 comm_identify: |
582 | 709 movlw "i" ; send echo |
710 movwf TXREG1 | |
623 | 711 rcall comm_write_byte ; wait for completion of transmit |
0 | 712 |
582 | 713 ;---- Read serial from internal EEPROM address 0000 |
0 | 714 clrf EEADRH |
604 | 715 clrf EEADR ; get serial number LOW |
582 | 716 call read_eeprom ; read byte |
0 | 717 movff EEDATA,lo |
604 | 718 incf EEADR,F ; get serial number HIGH |
582 | 719 call read_eeprom ; read byte |
0 | 720 movff EEDATA,hi |
721 | |
582 | 722 ;---- Emit serial number |
723 movff lo,TXREG1 | |
623 | 724 rcall comm_write_byte ; wait for completion of transmit |
582 | 725 movff hi,TXREG1 |
623 | 726 rcall comm_write_byte ; wait for completion of transmit |
0 | 727 |
582 | 728 ;---- Emit firmware hi.lo |
729 movlw softwareversion_x | |
730 movwf TXREG1 | |
623 | 731 rcall comm_write_byte ; wait for completion of transmit |
582 | 732 movlw softwareversion_y |
733 movwf TXREG1 | |
623 | 734 rcall comm_write_byte ; wait for completion of transmit |
0 | 735 |
736 ;---- Emit custom text | |
582 | 737 movlw opt_name_length |
738 movwf hi | |
739 lfsr FSR2,opt_name | |
0 | 740 |
741 common_identify_loop: | |
582 | 742 movff POSTINC2,TXREG1 |
623 | 743 rcall comm_write_byte ; wait for completion of transmit |
0 | 744 decfsz hi,F |
745 bra common_identify_loop | |
746 | |
604 | 747 bra comm_download_mode0 ; done |
748 | |
749 ;----------------------------------------------------------------------------- | |
750 | |
751 comm_get_byte: | |
752 goto rs232_get_byte ; ... and return | |
753 | |
623 | 754 comm_write_byte: ; wait for completion of transmit |
604 | 755 goto rs232_wait_tx ; ... and return |
0 | 756 |
623 | 757 |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
758 ;----------------------------------------------------------------------------- |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
759 ; Reply hardware descriptor byte |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
760 ; |
623 | 761 comm_hardware_descriptor: |
762 movlw "j" ; prepare echo | |
763 movwf TXREG1 ; send echo | |
764 rcall comm_write_byte ; wait for completion of transmit | |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
765 |
623 | 766 movf HW_descriptor,W ; get hardware descriptor |
767 bcf WREG,6 ; clear bit 6 for reason of compatibility with 3rd party software | |
768 bcf WREG,7 ; clear bit 7 for reason of compatibility with 3rd party software | |
769 movwf TXREG1 ; send hardware descriptor | |
770 | |
604 | 771 bra comm_download_mode0 ; done |
0 | 772 |
441
360acdcda0d7
+BUGFIX: Compatibility with "hwOS Config" fixed
heinrichsweikamp
parents:
426
diff
changeset
|
773 comm_feature_and_hardware: |
582 | 774 movlw 0x60 ; send echo |
775 movwf TXREG1 | |
623 | 776 rcall comm_write_byte ; wait for completion of transmit |
777 | |
604 | 778 movlw 0x00 ; hardware high byte |
779 movwf TXREG1 | |
623 | 780 rcall comm_write_byte ; wait for completion of transmit |
781 | |
782 movf HW_descriptor,W ; get hardware descriptor | |
783 bcf WREG,6 ; clear bit 6 for reason of compatibility with 3rd party software | |
784 bcf WREG,7 ; clear bit 7 for reason of compatibility with 3rd party software | |
785 movwf TXREG1 ; send hardware descriptor | |
786 rcall comm_write_byte ; wait for completion of transmit | |
787 | |
604 | 788 movlw 0x00 ; feature high Byte |
789 movwf TXREG1 | |
623 | 790 rcall comm_write_byte ; wait for completion of transmit |
791 | |
604 | 792 movlw 0x00 ; feature low Byte |
582 | 793 movwf TXREG1 |
623 | 794 rcall comm_write_byte ; wait for completion of transmit |
795 | |
604 | 796 movlw 0x00 ; model descriptor byte |
797 movwf TXREG1 | |
623 | 798 |
604 | 799 bra comm_download_mode0 ; done |
800 | |
801 ;----------------------------------------------------------------------------- | |
802 | |
0 | 803 comm_send_dive: |
582 | 804 movlw "f"; 0x66 ; send echo |
0 | 805 movwf TXREG1 |
582 | 806 |
604 | 807 rcall comm_get_byte |
623 | 808 btfsc rs232_rx_timeout ; got byte? |
604 | 809 bra comm_download_mode0 ; NO - abort! |
810 movff RCREG1,lo ; store dive number (0-255) | |
0 | 811 ; First, send the header (again) |
604 | 812 ; set ext_flash_address:3 to TOC entry of this dive |
0 | 813 ; 1st: 200000h-200FFFh -> lo=0 |
814 ; 2nd: 201000h-201FFFh -> lo=1 | |
815 ; 3rd: 202000h-202FFFh -> lo=2 | |
816 ; 256: 2FF000h-2FFFFFh -> lo=255 | |
817 clrf ext_flash_address+0 | |
818 clrf ext_flash_address+1 | |
819 movlw 0x20 | |
820 movwf ext_flash_address+2 | |
821 movlw .16 | |
582 | 822 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) |
0 | 823 movf PRODL,W |
824 addwf ext_flash_address+1,F | |
825 movf PRODH,W | |
826 addwfc ext_flash_address+2,F | |
827 | |
604 | 828 incf_ext_flash_address d'2' ; skip 0xFA, 0xFA |
829 call ext_flash_byte_read_plus ; read start address of profile | |
582 | 830 movff ext_flash_rw,ext_flash_log_pointer+0 |
604 | 831 call ext_flash_byte_read_plus ; read start address of profile |
582 | 832 movff ext_flash_rw,ext_flash_log_pointer+1 |
604 | 833 call ext_flash_byte_read_plus ; read start address of profile |
582 | 834 movff ext_flash_rw,ext_flash_log_pointer+2 |
604 | 835 call ext_flash_byte_read_plus ; read end address of profile |
582 | 836 movff ext_flash_rw,ext_flash_end_pointer+0 |
604 | 837 call ext_flash_byte_read_plus ; read end address of profile |
582 | 838 movff ext_flash_rw,ext_flash_end_pointer+1 |
604 | 839 call ext_flash_byte_read_plus ; read end address of profile |
582 | 840 movff ext_flash_rw,ext_flash_end_pointer+2 |
604 | 841 decf_ext_flash_address d'8' ; back again to first 0xFA in header |
0 | 842 |
582 | 843 movf ext_flash_log_pointer+0,W |
604 | 844 cpfseq ext_flash_end_pointer+0 ; equal? |
845 bra comm_send_dive1 ; NO - send header | |
0 | 846 |
582 | 847 movf ext_flash_log_pointer+1,W |
604 | 848 cpfseq ext_flash_end_pointer+1 ; equal? |
849 bra comm_send_dive1 ; NO - send header | |
0 | 850 |
582 | 851 movf ext_flash_log_pointer+2,W |
604 | 852 cpfseq ext_flash_end_pointer+2 ; equal? |
853 bra comm_send_dive1 ; NO - send header | |
0 | 854 |
582 | 855 ; Start=End -> Not good, abort |
604 | 856 bra comm_download_mode0 ; done, loop with timeout reset |
0 | 857 |
858 comm_send_dive1: | |
859 ; Send header | |
604 | 860 clrf hi ; counter |
623 | 861 rcall comm_write_byte ; wait for completion of transmit |
582 | 862 call ext_flash_read_block_start ; 1st byte |
0 | 863 movwf TXREG1 |
582 | 864 bra comm_send_dive_header |
0 | 865 comm_send_dive_header2: |
604 | 866 call ext_flash_read_block ; read one byte |
867 movwf TXREG1 ; start new transmit | |
0 | 868 comm_send_dive_header: |
623 | 869 rcall comm_write_byte ; wait for completion of transmit |
0 | 870 decfsz hi,F |
582 | 871 bra comm_send_dive_header2 |
0 | 872 call ext_flash_read_block_stop |
873 | |
874 ; Set address for profile | |
875 movff ext_flash_log_pointer+0,ext_flash_address+0 | |
876 movff ext_flash_log_pointer+1,ext_flash_address+1 | |
877 movff ext_flash_log_pointer+2,ext_flash_address+2 | |
878 | |
604 | 879 movlw .6 ; skip 6 byte short header in profile - only for internal use |
582 | 880 call incf_ext_flash_address0_0x20 ; increases bytes in ext_flash_address:3 with 0x200000 bank switching |
0 | 881 |
512 | 882 ; Set address for short header/compact header, Byte 0 |
582 | 883 |
0 | 884 comm_send_dive_profile: |
604 | 885 call ext_flash_byte_read_plus_0x20 ; read one byte into ext_flash_rw, takes care of banking at 0x200000 |
623 | 886 rcall comm_write_byte ; wait for completion of transmit |
604 | 887 movff ext_flash_rw,TXREG1 ; send a byte |
582 | 888 |
0 | 889 ; 24bit compare with end address |
582 | 890 movff ext_flash_end_pointer+0,WREG |
0 | 891 cpfseq ext_flash_address+0 |
582 | 892 bra comm_send_dive_profile |
893 movff ext_flash_end_pointer+1,WREG | |
0 | 894 cpfseq ext_flash_address+1 |
582 | 895 bra comm_send_dive_profile |
896 movff ext_flash_end_pointer+2,WREG | |
0 | 897 cpfseq ext_flash_address+2 |
582 | 898 bra comm_send_dive_profile |
899 | |
623 | 900 rcall comm_write_byte ; wait for completion of transmit |
604 | 901 bra comm_download_mode0 ; done, loop with timeout reset |
0 | 902 |
903 ;----------------------------------------------------------------------------- | |
904 | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
905 comm_read_setting: |
582 | 906 movlw "r" |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
907 movwf TXREG1 |
604 | 908 rcall comm_get_byte |
623 | 909 btfsc rs232_rx_timeout ; got byte? |
910 bra comm_read_abort ; NO - abort | |
911 rcall comm_write_byte ; wait for completion of transmit | |
582 | 912 movlw 0x0F |
913 cpfsgt RCREG1 ; 0x00-0x0F: unused | |
914 bra comm_read_abort ; abort! | |
604 | 915 subwf RCREG1,W ; subtract unused commands |
916 | |
917 clrf up ; set gas/dil index to 0 (0 = gas 1) | |
582 | 918 dcfsnz WREG |
604 | 919 bra comm_read_gas_dil ; RCREG1=0x10 |
920 incf up ; increment gas/dil index (1 = gas 2) | |
582 | 921 dcfsnz WREG |
604 | 922 bra comm_read_gas_dil ; RCREG1=0x11 |
923 incf up ; increment gas/dil index (2 = gas 3) | |
582 | 924 dcfsnz WREG |
604 | 925 bra comm_read_gas_dil ; RCREG1=0x12 |
926 incf up ; increment gas/dil index (3 = gas 4) | |
582 | 927 dcfsnz WREG |
604 | 928 bra comm_read_gas_dil ; RCREG1=0x13 |
929 incf up ; increment gas/dil index (4 = gas 5) | |
582 | 930 dcfsnz WREG |
604 | 931 bra comm_read_gas_dil ; RCREG1=0x14 |
932 incf up ; increment gas/dil index (5 = dil 1) | |
933 dcfsnz WREG | |
934 bra comm_read_gas_dil ; RCREG1=0x15 | |
935 incf up ; increment gas/dil index (6 = dil 2) | |
582 | 936 dcfsnz WREG |
604 | 937 bra comm_read_gas_dil ; RCREG1=0x16 |
938 incf up ; increment gas/dil index (7 = dil 3) | |
582 | 939 dcfsnz WREG |
604 | 940 bra comm_read_gas_dil ; RCREG1=0x17 |
941 incf up ; increment gas/dil index (8 = dil 4) | |
582 | 942 dcfsnz WREG |
604 | 943 bra comm_read_gas_dil ; RCREG1=0x18 |
944 incf up ; increment gas/dil index (9 = dil 5) | |
582 | 945 dcfsnz WREG |
604 | 946 bra comm_read_gas_dil ; RCREG1=0x19 |
947 | |
948 clrf up ; set setpoint index to 0 (0 = SP 1) | |
582 | 949 dcfsnz WREG |
604 | 950 bra comm_read_sp ; RCREG1=0x1A |
951 incf up ; increment setpoint index (1 = SP2) | |
582 | 952 dcfsnz WREG |
604 | 953 bra comm_read_sp ; RCREG1=0x1B |
954 incf up ; increment setpoint index (2 = SP3) | |
582 | 955 dcfsnz WREG |
604 | 956 bra comm_read_sp ; RCREG1=0x1C |
957 incf up ; increment setpoint index (3 = SP4) | |
582 | 958 dcfsnz WREG |
604 | 959 bra comm_read_sp ; RCREG1=0x1D |
960 incf up ; increment setpoint index (4 = SP5) | |
582 | 961 dcfsnz WREG |
604 | 962 bra comm_read_sp ; RCREG1=0x1E |
963 | |
582 | 964 dcfsnz WREG |
604 | 965 movff opt_ccr_mode, TXREG1 ; RCREG1=0x1F |
966 dcfsnz WREG | |
967 movff opt_dive_mode, TXREG1 ; RCREG1=0x20 | |
582 | 968 dcfsnz WREG |
604 | 969 movff char_I_deco_model, TXREG1 ; RCREG1=0x21 |
970 dcfsnz WREG | |
623 | 971 movff char_I_ppO2_max_work, TXREG1 ; RCREG1=0x22 |
582 | 972 dcfsnz WREG |
604 | 973 movff char_I_ppO2_min, TXREG1 ; RCREG1=0x23 |
582 | 974 dcfsnz WREG |
604 | 975 movff char_I_extra_time, TXREG1 ; RCREG1=0x24 |
976 dcfsnz WREG | |
977 movff opt_GF_low, TXREG1 ; RCREG1=0x25 | |
582 | 978 dcfsnz WREG |
604 | 979 movff opt_GF_high, TXREG1 ; RCREG1=0x26 |
980 dcfsnz WREG | |
981 movff opt_aGF_low, TXREG1 ; RCREG1=0x27 | |
582 | 982 dcfsnz WREG |
604 | 983 movff opt_aGF_high, TXREG1 ; RCREG1=0x28 |
984 dcfsnz WREG | |
985 movff opt_enable_aGF, TXREG1 ; RCREG1=0x29 | |
582 | 986 dcfsnz WREG |
604 | 987 movff opt_sat_multiplier_non_gf, TXREG1 ; RCREG1=0x2A |
988 dcfsnz WREG | |
989 movff opt_desat_multiplier_non_gf,TXREG1 ; RCREG1=0x2B | |
582 | 990 dcfsnz WREG |
604 | 991 movff opt_last_stop, TXREG1 ; RCREG1=0x2C |
582 | 992 dcfsnz WREG |
604 | 993 movff opt_brightness, TXREG1 ; RCREG1=0x2D |
582 | 994 dcfsnz WREG |
604 | 995 movff opt_units, TXREG1 ; RCREG1=0x2E |
996 dcfsnz WREG | |
997 movff opt_sampling_rate, TXREG1 ; RCREG1=0x2F | |
582 | 998 dcfsnz WREG |
604 | 999 movff opt_salinity, TXREG1 ; RCREG1=0x30 |
1000 dcfsnz WREG | |
1001 movff opt_dive_color_scheme, TXREG1 ; RCREG1=0x31 | |
582 | 1002 dcfsnz WREG |
604 | 1003 movff opt_language, TXREG1 ; RCREG1=0x32 |
1004 dcfsnz WREG | |
1005 movff opt_dateformat, TXREG1 ; RCREG1=0x33 | |
582 | 1006 dcfsnz WREG |
604 | 1007 movff opt_compass_gain, TXREG1 ; RCREG1=0x34 |
582 | 1008 dcfsnz WREG |
604 | 1009 movff opt_pressure_adjust, TXREG1 ; RCREG1=0x35 |
582 | 1010 dcfsnz WREG |
604 | 1011 movff opt_enable_safetystop, TXREG1 ; RCREG1=0x36 |
1012 dcfsnz WREG | |
1013 movff opt_calibration_O2_ratio, TXREG1 ; RCREG1=0x37 | |
582 | 1014 dcfsnz WREG |
604 | 1015 clrf TXREG1 ; RCREG1=0x38 NOT USED ANYMORE (ex opt_sensor_fallback) |
1016 dcfsnz WREG | |
1017 movff opt_flip_screen, TXREG1 ; RCREG1=0x39 | |
582 | 1018 dcfsnz WREG |
604 | 1019 movff opt_cR_button_left, TXREG1 ; RCREG1=0x3A |
1020 dcfsnz WREG | |
1021 movff opt_cR_button_right, TXREG1 ; RCREG1=0x3B | |
582 | 1022 dcfsnz WREG |
623 | 1023 movff char_I_SAC_work, TXREG1 ; RCREG1=0x3C |
582 | 1024 dcfsnz WREG |
623 | 1025 movff char_I_SAC_deco, TXREG1 ; RCREG1=0x3D |
582 | 1026 dcfsnz WREG |
604 | 1027 movff opt_modwarning, TXREG1 ; RCREG1=0x3E |
1028 dcfsnz WREG | |
1029 movff opt_vsitextv2, TXREG1 ; RCREG1=0x3F | |
582 | 1030 dcfsnz WREG |
604 | 1031 movff opt_vsigraph, TXREG1 ; RCREG1=0x40 |
1032 dcfsnz WREG | |
623 | 1033 movff opt_showppo2, TXREG1 ; RCREG1=0x41, always show ppO2 |
582 | 1034 dcfsnz WREG |
604 | 1035 movff opt_temperature_adjust, TXREG1 ; RCREG1=0x42 |
1036 dcfsnz WREG | |
1037 movff opt_safety_stop_length, TXREG1 ; RCREG1=0x43 | |
582 | 1038 dcfsnz WREG |
604 | 1039 movff opt_safety_stop_start, TXREG1 ; RCREG1=0x44 |
582 | 1040 dcfsnz WREG |
604 | 1041 movff opt_safety_stop_end, TXREG1 ; RCREG1=0x45 |
582 | 1042 dcfsnz WREG |
604 | 1043 movff opt_safety_stop_reset, TXREG1 ; RCREG1=0x46 |
1044 dcfsnz WREG | |
1045 clrf TXREG1 ; RCREG1=0x47, ignore conservatism in hwOS tech firmware | |
582 | 1046 dcfsnz WREG |
604 | 1047 movff opt_diveTimeout, TXREG1 ; RCREG1=0x48 |
1048 dcfsnz WREG | |
1049 movff button_polarity, TXREG1 ; RCREG1=0x49 | |
582 | 1050 dcfsnz WREG |
604 | 1051 movff char_I_PSCR_drop, TXREG1 ; RCREG1=0x4A |
1052 dcfsnz WREG | |
1053 movff char_I_PSCR_lungratio, TXREG1 ; RCREG1=0x4B | |
582 | 1054 dcfsnz WREG |
604 | 1055 movff char_I_ppO2_max_deco, TXREG1 ; RCREG1=0x4C |
582 | 1056 dcfsnz WREG |
604 | 1057 movff char_I_ppO2_min_loop, TXREG1 ; RCREG1=0x4D |
582 | 1058 dcfsnz WREG |
623 | 1059 movff char_I_gas_avail_size+0, TXREG1 ; RCREG1=0x4E |
604 | 1060 dcfsnz WREG |
623 | 1061 movff char_I_gas_avail_size+1, TXREG1 ; RCREG1=0x4F |
582 | 1062 dcfsnz WREG |
623 | 1063 movff char_I_gas_avail_size+2, TXREG1 ; RCREG1=0x50 |
604 | 1064 dcfsnz WREG |
623 | 1065 movff char_I_gas_avail_size+3, TXREG1 ; RCREG1=0x51 |
582 | 1066 dcfsnz WREG |
623 | 1067 movff char_I_gas_avail_size+4, TXREG1 ; RCREG1=0x52 |
604 | 1068 dcfsnz WREG |
623 | 1069 movff char_I_gas_avail_pres+0, TXREG1 ; RCREG1=0x53 |
582 | 1070 dcfsnz WREG |
623 | 1071 movff char_I_gas_avail_pres+1, TXREG1 ; RCREG1=0x54 |
582 | 1072 dcfsnz WREG |
623 | 1073 movff char_I_gas_avail_pres+2, TXREG1 ; RCREG1=0x55 |
582 | 1074 dcfsnz WREG |
623 | 1075 movff char_I_gas_avail_pres+3, TXREG1 ; RCREG1=0x56 |
604 | 1076 dcfsnz WREG |
623 | 1077 movff char_I_gas_avail_pres+4, TXREG1 ; RCREG1=0x57 |
582 | 1078 dcfsnz WREG |
623 | 1079 movff char_I_CC_max_frac_O2, TXREG1 ; RCREG1=0x58 |
604 | 1080 dcfsnz WREG |
1081 movff opt_sim_setpoint_number, TXREG1 ; RCREG1=0x59 | |
582 | 1082 dcfsnz WREG |
604 | 1083 movff opt_calc_asc_gasvolume, TXREG1 ; RCREG1=0x5A |
1084 dcfsnz WREG | |
1085 movff opt_sim_use_aGF, TXREG1 ; RCREG1=0x5B | |
582 | 1086 dcfsnz WREG |
604 | 1087 movff char_I_altitude_wait, TXREG1 ; RCREG1=0x5C |
582 | 1088 dcfsnz WREG |
604 | 1089 movff opt_enable_IBCD, TXREG1 ; RCREG1=0x5D |
582 | 1090 dcfsnz WREG |
604 | 1091 movff opt_sat_multiplier_gf, TXREG1 ; RCREG1=0x5E |
1092 dcfsnz WREG | |
1093 movff opt_desat_multiplier_gf, TXREG1 ; RCREG1=0x5F | |
582 | 1094 dcfsnz WREG |
604 | 1095 movff opt_transmitter_id_1+0, TXREG1 ; RCREG1=0x60 |
1096 dcfsnz WREG | |
1097 movff opt_transmitter_id_1+1, TXREG1 ; RCREG1=0x61 | |
582 | 1098 dcfsnz WREG |
604 | 1099 movff opt_transmitter_id_2+0, TXREG1 ; RCREG1=0x62 |
1100 dcfsnz WREG | |
1101 movff opt_transmitter_id_2+1, TXREG1 ; RCREG1=0x63 | |
582 | 1102 dcfsnz WREG |
604 | 1103 movff opt_transmitter_id_3+0, TXREG1 ; RCREG1=0x64 |
582 | 1104 dcfsnz WREG |
604 | 1105 movff opt_transmitter_id_3+1, TXREG1 ; RCREG1=0x65 |
582 | 1106 dcfsnz WREG |
604 | 1107 movff opt_transmitter_id_4+0, TXREG1 ; RCREG1=0x66 |
1108 dcfsnz WREG | |
1109 movff opt_transmitter_id_4+1, TXREG1 ; RCREG1=0x67 | |
582 | 1110 dcfsnz WREG |
604 | 1111 movff opt_transmitter_id_5+0, TXREG1 ; RCREG1=0x68 |
1112 dcfsnz WREG | |
1113 movff opt_transmitter_id_5+1, TXREG1 ; RCREG1=0x69 | |
582 | 1114 dcfsnz WREG |
604 | 1115 movff opt_transmitter_id_6+0, TXREG1 ; RCREG1=0x6A |
1116 dcfsnz WREG | |
1117 movff opt_transmitter_id_6+1, TXREG1 ; RCREG1=0x6B | |
582 | 1118 dcfsnz WREG |
604 | 1119 movff opt_transmitter_id_7+0, TXREG1 ; RCREG1=0x6C |
582 | 1120 dcfsnz WREG |
604 | 1121 movff opt_transmitter_id_7+1, TXREG1 ; RCREG1=0x6D |
582 | 1122 dcfsnz WREG |
604 | 1123 movff opt_transmitter_id_8+0, TXREG1 ; RCREG1=0x6E |
1124 dcfsnz WREG | |
1125 movff opt_transmitter_id_8+1, TXREG1 ; RCREG1=0x6F | |
582 | 1126 dcfsnz WREG |
604 | 1127 movff opt_transmitter_id_9+0, TXREG1 ; RCREG1=0x70 |
1128 dcfsnz WREG | |
1129 movff opt_transmitter_id_9+1, TXREG1 ; RCREG1=0x71 | |
582 | 1130 dcfsnz WREG |
604 | 1131 movff opt_transmitter_id_10+0, TXREG1 ; RCREG1=0x72 |
1132 dcfsnz WREG | |
1133 movff opt_transmitter_id_10+1, TXREG1 ; RCREG1=0x73 | |
582 | 1134 dcfsnz WREG |
623 | 1135 movff char_I_gas_avail_size+5, TXREG1 ; RCREG1=0x74 |
582 | 1136 dcfsnz WREG |
623 | 1137 movff char_I_gas_avail_size+6, TXREG1 ; RCREG1=0x75 |
582 | 1138 dcfsnz WREG |
623 | 1139 movff char_I_gas_avail_size+7, TXREG1 ; RCREG1=0x76 |
604 | 1140 dcfsnz WREG |
623 | 1141 movff char_I_gas_avail_size+8, TXREG1 ; RCREG1=0x77 |
582 | 1142 dcfsnz WREG |
623 | 1143 movff char_I_gas_avail_size+9, TXREG1 ; RCREG1=0x78 |
604 | 1144 dcfsnz WREG |
623 | 1145 movff char_I_gas_avail_pres+5, TXREG1 ; RCREG1=0x79 |
582 | 1146 dcfsnz WREG |
623 | 1147 movff char_I_gas_avail_pres+6, TXREG1 ; RCREG1=0x7A |
604 | 1148 dcfsnz WREG |
623 | 1149 movff char_I_gas_avail_pres+7, TXREG1 ; RCREG1=0x7B |
582 | 1150 dcfsnz WREG |
623 | 1151 movff char_I_gas_avail_pres+8, TXREG1 ; RCREG1=0x7C |
582 | 1152 dcfsnz WREG |
623 | 1153 movff char_I_gas_avail_pres+9, TXREG1 ; RCREG1=0x7D |
582 | 1154 dcfsnz WREG |
604 | 1155 movff opt_TR_mode, TXREG1 ; RCREG1=0x7E |
1156 dcfsnz WREG | |
1157 movff opt_TR_1st_pres, TXREG1 ; RCREG1=0x7F | |
582 | 1158 dcfsnz WREG |
604 | 1159 movff opt_TR_2nd_pres, TXREG1 ; RCREG1=0x80 |
582 | 1160 dcfsnz WREG |
604 | 1161 movff opt_TR_Bail_pres, TXREG1 ; RCREG1=0x81 |
582 | 1162 dcfsnz WREG |
604 | 1163 movff char_I_max_pres_diff, TXREG1 ; RCREG1=0x82 |
1164 dcfsnz WREG | |
1165 movff opt_ZfactorUse, TXREG1 ; RCREG1=0x83 | |
582 | 1166 dcfsnz WREG |
604 | 1167 movff opt_ZfactorTemp, TXREG1 ; RCREG1=0x84 |
582 | 1168 dcfsnz WREG |
604 | 1169 movff opt_2ndDepthDisp, TXREG1 ; RCREG1=0x85 |
623 | 1170 dcfsnz WREG |
1171 movff opt_max_depth, TXREG1 ; RCREG1=0x86 | |
1172 dcfsnz WREG | |
1173 movff char_I_descent_speed, TXREG1 ; RCREG1=0x87 | |
1174 dcfsnz WREG | |
1175 movff opt_store_apnoe_dive, TXREG1 ; RCREG1=0x88 | |
1176 dcfsnz WREG | |
1177 movff opt_tissue_graphics, TXREG1 ; RCREG1=0x89 | |
1178 dcfsnz WREG | |
1179 movff opt_layout, TXREG1 ; RCREG1=0x90 | |
1180 dcfsnz WREG | |
1181 movff opt_extended_stops, TXREG1 ; RCREG1=0x91 | |
582 | 1182 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1183 comm_read_abort: |
255 | 1184 comm_read_done: |
604 | 1185 bra comm_download_mode0 ; done, loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1186 |
604 | 1187 ;----------------------------------------------------------------------------- |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1188 |
604 | 1189 ; Memory map is as follows: |
1190 ; ------------------------- | |
1191 ; opt_gas_O2_ratio res 5 ; O2 ratios of OC/bailout gases | |
1192 ; opt_dil_O2_ratio res 5 ; O2 ratios of diluents | |
1193 ; opt_gas_He_ratio res 5 ; He ratios of OC/bailout gases | |
1194 ; opt_dil_He_ratio res 5 ; He ratios of diluents | |
1195 ; opt_gas_type res 5 ; OC/bailout gas type | |
1196 ; opt_dil_type res 5 ; dil type | |
1197 ; opt_gas_change res 5 ; change depths for OC/Bailout gases | |
1198 ; opt_dil_change res 5 ; change depths for diluents | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1199 |
604 | 1200 comm_read_gas_dil: |
1201 lfsr FSR0,opt_gas_O2_ratio ; load base address of gas data arrays | |
1202 movf up,W ; load index (0-9) of gas/dil into WREG, addressing O2 ratio | |
1203 movff PLUSW0, TXREG1 ; transmit O2 ratio | |
623 | 1204 rcall comm_write_byte ; wait for completion of transmit |
604 | 1205 addlw .10 ; increment index by 10, addressing He ratio now |
1206 movff PLUSW0, TXREG1 ; transmit He ratio | |
623 | 1207 rcall comm_write_byte ; wait for completion of transmit |
604 | 1208 addlw .10 ; increment index by 10, addressing gas/dil type now |
1209 movff PLUSW0, TXREG1 ; transmit gas/dil type | |
623 | 1210 rcall comm_write_byte ; wait for completion of transmit |
604 | 1211 addlw .10 ; increment index by 10, addressing change depth now |
1212 movff PLUSW0,TXREG1 ; transmit change depth | |
1213 bra comm_read_done ; done, wait for UART and loop with timeout reset | |
110 | 1214 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1215 |
604 | 1216 ; Memory map is as follows: |
1217 ; ------------------------- | |
623 | 1218 ; opt_setpoint_cbar res 5 ; setpoints in cbar |
1219 ; opt_setpoint_change res 5 ; change depth for the setpoints in meter | |
604 | 1220 |
1221 comm_read_sp: | |
623 | 1222 lfsr FSR0,opt_setpoint_cbar ; load base address of setpoint cbar values |
604 | 1223 movf up,W ; load index (0-4) of setpoint into WREG, addressing cbar value |
1224 movff PLUSW0, TXREG1 ; transmit setpoint cbar value | |
623 | 1225 rcall comm_write_byte ; wait for completion of transmit |
604 | 1226 addlw .5 ; increment index by 5, addressing change depth now |
1227 movff PLUSW0, TXREG1 ; transmit change depth | |
1228 bra comm_read_done ; done, wait for UART and loop with timeout reset | |
1229 | |
80 | 1230 ;----------------------------------------------------------------------------- |
1231 | |
1232 comm_write_setting: | |
582 | 1233 movlw "w" |
80 | 1234 movwf TXREG1 |
604 | 1235 rcall comm_get_byte ; "Byte 2" |
623 | 1236 btfsc rs232_rx_timeout ; got a byte? |
1237 bra comm_write_abort ; NO - abort | |
604 | 1238 movff RCREG1,lo ; copy |
1239 rcall comm_get_byte ; "Byte 3" | |
623 | 1240 rcall comm_write_byte ; wait for completion of transmit |
582 | 1241 movlw 0x0F |
1242 cpfsgt lo ; 0x00-0x0F: unused | |
1243 bra comm_write_abort ; abort! | |
604 | 1244 subwf lo,W ; subtract unused commands |
1245 | |
1246 clrf up ; set gas/dil index to 0 (0 = gas 1) | |
582 | 1247 dcfsnz WREG |
604 | 1248 bra comm_write_gas_dil ; RCREG1=0x10 |
1249 incf up ; increment gas/dil index (1 = gas 2) | |
582 | 1250 dcfsnz WREG |
604 | 1251 bra comm_write_gas_dil ; RCREG1=0x11 |
1252 incf up ; increment gas/dil index (2 = gas 3) | |
582 | 1253 dcfsnz WREG |
604 | 1254 bra comm_write_gas_dil ; RCREG1=0x12 |
1255 incf up ; increment gas/dil index (3 = gas 4) | |
582 | 1256 dcfsnz WREG |
604 | 1257 bra comm_write_gas_dil ; RCREG1=0x13 |
1258 incf up ; increment gas/dil index (4 = gas 5) | |
582 | 1259 dcfsnz WREG |
604 | 1260 bra comm_write_gas_dil ; RCREG1=0x14 |
1261 incf up ; increment gas/dil index (5 = dil 1) | |
582 | 1262 dcfsnz WREG |
604 | 1263 bra comm_write_gas_dil ; RCREG1=0x15 |
1264 incf up ; increment gas/dil index (6 = dil 2) | |
1265 dcfsnz WREG | |
1266 bra comm_write_gas_dil ; RCREG1=0x16 | |
1267 incf up ; increment gas/dil index (7 = dil 3) | |
582 | 1268 dcfsnz WREG |
604 | 1269 bra comm_write_gas_dil ; RCREG1=0x17 |
1270 incf up ; increment gas/dil index (8 = dil 4) | |
582 | 1271 dcfsnz WREG |
604 | 1272 bra comm_write_gas_dil ; RCREG1=0x18 |
1273 incf up ; increment gas/dil index (9 = dil 5) | |
582 | 1274 dcfsnz WREG |
604 | 1275 bra comm_write_gas_dil ; RCREG1=0x19 |
1276 | |
1277 clrf up ; set setpoint index to 0 (0 = SP 1) | |
582 | 1278 dcfsnz WREG |
604 | 1279 bra comm_write_sp ; RCREG1=0x1A |
1280 incf up ; increment setpoint index (1 = SP2) | |
582 | 1281 dcfsnz WREG |
604 | 1282 bra comm_write_sp ; RCREG1=0x1B |
1283 incf up ; increment setpoint index (2 = SP3) | |
582 | 1284 dcfsnz WREG |
604 | 1285 bra comm_write_sp ; RCREG1=0x1C |
1286 incf up ; increment setpoint index (3 = SP4) | |
582 | 1287 dcfsnz WREG |
604 | 1288 bra comm_write_sp ; RCREG1=0x1D |
1289 incf up ; increment setpoint index (4 = SP5) | |
1290 dcfsnz WREG | |
1291 bra comm_write_sp ; RCREG1=0x1E | |
1292 | |
582 | 1293 dcfsnz WREG |
1294 movff RCREG1, opt_ccr_mode ; RCREG1=0x1F | |
1295 dcfsnz WREG | |
1296 movff RCREG1, opt_dive_mode ; RCREG1=0x20 | |
1297 dcfsnz WREG | |
1298 movff RCREG1, char_I_deco_model ; RCREG1=0x21 | |
1299 dcfsnz WREG | |
623 | 1300 movff RCREG1, char_I_ppO2_max_work ; RCREG1=0x22 |
582 | 1301 dcfsnz WREG |
1302 movff RCREG1, char_I_ppO2_min ; RCREG1=0x23 | |
1303 dcfsnz WREG | |
1304 movff RCREG1, char_I_extra_time ; RCREG1=0x24 | |
1305 dcfsnz WREG | |
1306 movff RCREG1, opt_GF_low ; RCREG1=0x25 | |
1307 dcfsnz WREG | |
1308 movff RCREG1, opt_GF_high ; RCREG1=0x26 | |
1309 dcfsnz WREG | |
1310 movff RCREG1, opt_aGF_low ; RCREG1=0x27 | |
1311 dcfsnz WREG | |
1312 movff RCREG1, opt_aGF_high ; RCREG1=0x28 | |
1313 dcfsnz WREG | |
1314 movff RCREG1, opt_enable_aGF ; RCREG1=0x29 | |
1315 dcfsnz WREG | |
1316 movff RCREG1, opt_sat_multiplier_non_gf ; RCREG1=0x2A | |
1317 dcfsnz WREG | |
1318 movff RCREG1, opt_desat_multiplier_non_gf ; RCREG1=0x2B | |
1319 dcfsnz WREG | |
1320 movff RCREG1, opt_last_stop ; RCREG1=0x2C | |
1321 dcfsnz WREG | |
1322 movff RCREG1, opt_brightness ; RCREG1=0x2D | |
1323 dcfsnz WREG | |
1324 movff RCREG1, opt_units ; RCREG1=0x2E | |
1325 dcfsnz WREG | |
1326 movff RCREG1, opt_sampling_rate ; RCREG1=0x2F | |
1327 dcfsnz WREG | |
1328 movff RCREG1, opt_salinity ; RCREG1=0x30 | |
1329 dcfsnz WREG | |
1330 movff RCREG1, opt_dive_color_scheme ; RCREG1=0x31 | |
1331 dcfsnz WREG | |
1332 movff RCREG1, opt_language ; RCREG1=0x32 | |
1333 dcfsnz WREG | |
1334 movff RCREG1, opt_dateformat ; RCREG1=0x33 | |
1335 dcfsnz WREG | |
1336 movff RCREG1, opt_compass_gain ; RCREG1=0x34 | |
1337 dcfsnz WREG | |
1338 movff RCREG1, opt_pressure_adjust ; RCREG1=0x35 | |
1339 dcfsnz WREG | |
1340 movff RCREG1, opt_enable_safetystop ; RCREG1=0x36 | |
1341 dcfsnz WREG | |
1342 movff RCREG1, opt_calibration_O2_ratio; RCREG1=0x37 | |
1343 dcfsnz WREG | |
604 | 1344 nop ; RCREG1=0x38 NOT USED ANYMORE (ex opt_sensor_fallback) |
582 | 1345 dcfsnz WREG |
1346 movff RCREG1, opt_flip_screen ; RCREG1=0x39 | |
1347 dcfsnz WREG | |
1348 movff RCREG1, opt_cR_button_left ; RCREG1=0x3A | |
1349 dcfsnz WREG | |
1350 movff RCREG1, opt_cR_button_right ; RCREG1=0x3B | |
1351 dcfsnz WREG | |
623 | 1352 movff RCREG1, char_I_SAC_work ; RCREG1=0x3C |
582 | 1353 dcfsnz WREG |
623 | 1354 movff RCREG1, char_I_SAC_deco ; RCREG1=0x3D |
582 | 1355 dcfsnz WREG |
1356 movff RCREG1, opt_modwarning ; RCREG1=0x3E | |
1357 dcfsnz WREG | |
1358 movff RCREG1, opt_vsitextv2 ; RCREG1=0x3F | |
1359 dcfsnz WREG | |
1360 movff RCREG1, opt_vsigraph ; RCREG1=0x40 | |
1361 dcfsnz WREG | |
623 | 1362 movff RCREG1, opt_showppo2 ; RCREG1=0x41, always show ppO2 |
582 | 1363 dcfsnz WREG |
1364 movff RCREG1, opt_temperature_adjust ; RCREG1=0x42 | |
1365 dcfsnz WREG | |
1366 movff RCREG1, opt_safety_stop_length ; RCREG1=0x43 | |
1367 dcfsnz WREG | |
1368 movff RCREG1, opt_safety_stop_start ; RCREG1=0x44 | |
1369 dcfsnz WREG | |
1370 movff RCREG1, opt_safety_stop_end ; RCREG1=0x45 | |
1371 dcfsnz WREG | |
1372 movff RCREG1, opt_safety_stop_reset ; RCREG1=0x46 | |
1373 dcfsnz WREG | |
1374 nop ; RCREG1=0x47, ignore conservatism for standard hwOS | |
1375 dcfsnz WREG | |
1376 movff RCREG1, opt_diveTimeout ; RCREG1=0x48 | |
1377 dcfsnz WREG | |
1378 bra comm_write_button_polarity ; RCREG1=0x49 | |
1379 dcfsnz WREG | |
1380 movff RCREG1, char_I_PSCR_drop ; RCREG1=0x4A | |
1381 dcfsnz WREG | |
1382 movff RCREG1, char_I_PSCR_lungratio ; RCREG1=0x4B | |
1383 dcfsnz WREG | |
1384 movff RCREG1, char_I_ppO2_max_deco ; RCREG1=0x4C | |
1385 dcfsnz WREG | |
1386 movff RCREG1, char_I_ppO2_min_loop ; RCREG1=0x4D | |
1387 dcfsnz WREG | |
623 | 1388 movff RCREG1, char_I_gas_avail_size+0 ; RCREG1=0x4E |
582 | 1389 dcfsnz WREG |
623 | 1390 movff RCREG1, char_I_gas_avail_size+1 ; RCREG1=0x4F |
582 | 1391 dcfsnz WREG |
623 | 1392 movff RCREG1, char_I_gas_avail_size+2 ; RCREG1=0x50 |
582 | 1393 dcfsnz WREG |
623 | 1394 movff RCREG1, char_I_gas_avail_size+3 ; RCREG1=0x51 |
582 | 1395 dcfsnz WREG |
623 | 1396 movff RCREG1, char_I_gas_avail_size+4 ; RCREG1=0x52 |
582 | 1397 dcfsnz WREG |
623 | 1398 movff RCREG1, char_I_gas_avail_pres+0 ; RCREG1=0x53 |
582 | 1399 dcfsnz WREG |
623 | 1400 movff RCREG1, char_I_gas_avail_pres+1 ; RCREG1=0x54 |
582 | 1401 dcfsnz WREG |
623 | 1402 movff RCREG1, char_I_gas_avail_pres+2 ; RCREG1=0x55 |
582 | 1403 dcfsnz WREG |
623 | 1404 movff RCREG1, char_I_gas_avail_pres+3 ; RCREG1=0x56 |
582 | 1405 dcfsnz WREG |
623 | 1406 movff RCREG1, char_I_gas_avail_pres+4 ; RCREG1=0x57 |
582 | 1407 dcfsnz WREG |
623 | 1408 movff RCREG1, char_I_CC_max_frac_O2 ; RCREG1=0x58 |
582 | 1409 dcfsnz WREG |
1410 movff RCREG1, opt_sim_setpoint_number ; RCREG1=0x59 | |
1411 dcfsnz WREG | |
1412 movff RCREG1, opt_calc_asc_gasvolume ; RCREG1=0x5A | |
1413 dcfsnz WREG | |
1414 movff RCREG1, opt_sim_use_aGF ; RCREG1=0x5B | |
1415 dcfsnz WREG | |
1416 movff RCREG1, char_I_altitude_wait ; RCREG1=0x5C | |
1417 dcfsnz WREG | |
1418 movff RCREG1, opt_enable_IBCD ; RCREG1=0x5D | |
1419 dcfsnz WREG | |
1420 movff RCREG1, opt_sat_multiplier_gf ; RCREG1=0x5E | |
1421 dcfsnz WREG | |
1422 movff RCREG1, opt_desat_multiplier_gf ; RCREG1=0x5F | |
604 | 1423 dcfsnz WREG |
1424 movff RCREG1, opt_transmitter_id_1+0 ; RCREG1=0x60 | |
1425 dcfsnz WREG | |
1426 movff RCREG1, opt_transmitter_id_1+1 ; RCREG1=0x61 | |
1427 dcfsnz WREG | |
1428 movff RCREG1, opt_transmitter_id_2+0 ; RCREG1=0x62 | |
1429 dcfsnz WREG | |
1430 movff RCREG1, opt_transmitter_id_2+1 ; RCREG1=0x63 | |
1431 dcfsnz WREG | |
1432 movff RCREG1, opt_transmitter_id_3+0 ; RCREG1=0x64 | |
1433 dcfsnz WREG | |
1434 movff RCREG1, opt_transmitter_id_3+1 ; RCREG1=0x65 | |
1435 dcfsnz WREG | |
1436 movff RCREG1, opt_transmitter_id_4+0 ; RCREG1=0x66 | |
1437 dcfsnz WREG | |
1438 movff RCREG1, opt_transmitter_id_4+1 ; RCREG1=0x67 | |
1439 dcfsnz WREG | |
1440 movff RCREG1, opt_transmitter_id_5+0 ; RCREG1=0x68 | |
1441 dcfsnz WREG | |
1442 movff RCREG1, opt_transmitter_id_5+1 ; RCREG1=0x69 | |
1443 dcfsnz WREG | |
1444 movff RCREG1, opt_transmitter_id_6+0 ; RCREG1=0x6A | |
1445 dcfsnz WREG | |
1446 movff RCREG1, opt_transmitter_id_6+1 ; RCREG1=0x6B | |
1447 dcfsnz WREG | |
1448 movff RCREG1, opt_transmitter_id_7+0 ; RCREG1=0x6C | |
1449 dcfsnz WREG | |
1450 movff RCREG1, opt_transmitter_id_7+1 ; RCREG1=0x6D | |
1451 dcfsnz WREG | |
1452 movff RCREG1, opt_transmitter_id_8+0 ; RCREG1=0x6E | |
1453 dcfsnz WREG | |
1454 movff RCREG1, opt_transmitter_id_8+1 ; RCREG1=0x6F | |
1455 dcfsnz WREG | |
1456 movff RCREG1, opt_transmitter_id_9+0 ; RCREG1=0x70 | |
1457 dcfsnz WREG | |
1458 movff RCREG1, opt_transmitter_id_9+1 ; RCREG1=0x71 | |
1459 dcfsnz WREG | |
1460 movff RCREG1, opt_transmitter_id_10+0 ; RCREG1=0x72 | |
1461 dcfsnz WREG | |
1462 movff RCREG1, opt_transmitter_id_10+1 ; RCREG1=0x73 | |
1463 dcfsnz WREG | |
623 | 1464 movff RCREG1, char_I_gas_avail_size+5 ; RCREG1=0x74 |
604 | 1465 dcfsnz WREG |
623 | 1466 movff RCREG1, char_I_gas_avail_size+6 ; RCREG1=0x75 |
604 | 1467 dcfsnz WREG |
623 | 1468 movff RCREG1, char_I_gas_avail_size+7 ; RCREG1=0x76 |
604 | 1469 dcfsnz WREG |
623 | 1470 movff RCREG1, char_I_gas_avail_size+8 ; RCREG1=0x77 |
604 | 1471 dcfsnz WREG |
623 | 1472 movff RCREG1, char_I_gas_avail_size+9 ; RCREG1=0x78 |
604 | 1473 dcfsnz WREG |
623 | 1474 movff RCREG1, char_I_gas_avail_pres+5 ; RCREG1=0x79 |
604 | 1475 dcfsnz WREG |
623 | 1476 movff RCREG1, char_I_gas_avail_pres+6 ; RCREG1=0x7A |
604 | 1477 dcfsnz WREG |
623 | 1478 movff RCREG1, char_I_gas_avail_pres+7 ; RCREG1=0x7B |
604 | 1479 dcfsnz WREG |
623 | 1480 movff RCREG1, char_I_gas_avail_pres+8 ; RCREG1=0x7C |
604 | 1481 dcfsnz WREG |
623 | 1482 movff RCREG1, char_I_gas_avail_pres+9 ; RCREG1=0x7D |
604 | 1483 dcfsnz WREG |
1484 movff RCREG1, opt_TR_mode ; RCREG1=0x7E | |
1485 dcfsnz WREG | |
1486 movff RCREG1, opt_TR_1st_pres ; RCREG1=0x7F | |
1487 dcfsnz WREG | |
1488 movff RCREG1, opt_TR_2nd_pres ; RCREG1=0x80 | |
1489 dcfsnz WREG | |
1490 movff RCREG1, opt_TR_Bail_pres ; RCREG1=0x81 | |
1491 dcfsnz WREG | |
1492 movff RCREG1, char_I_max_pres_diff ; RCREG1=0x82 | |
1493 dcfsnz WREG | |
1494 movff RCREG1, opt_ZfactorUse ; RCREG1=0x83 | |
1495 dcfsnz WREG | |
1496 movff RCREG1, opt_ZfactorTemp ; RCREG1=0x84 | |
1497 dcfsnz WREG | |
1498 movff RCREG1, opt_2ndDepthDisp ; RCREG1=0x85 | |
623 | 1499 dcfsnz WREG |
1500 movff RCREG1, opt_max_depth ; RCREG1=0x86 | |
1501 dcfsnz WREG | |
1502 movff RCREG1, char_I_descent_speed ; RCREG1=0x87 | |
1503 dcfsnz WREG | |
1504 movff RCREG1, opt_store_apnoe_dive ; RCREG1=0x88 | |
1505 dcfsnz WREG | |
1506 movff RCREG1, opt_tissue_graphics ; RCREG1=0x89 | |
1507 dcfsnz WREG | |
1508 movff RCREG1, opt_layout ; RCREG1=0x90 | |
1509 dcfsnz WREG | |
1510 movff RCREG1, opt_extended_stops ; RCREG1=0x91 | |
1511 | |
562
8b7ea27ea1fa
seperate desat and sat multipliers for GF and Non-GF modes. Set to 100/100 as default in GF mode
heinrichsweikamp
parents:
560
diff
changeset
|
1512 |
80 | 1513 comm_write_abort: |
604 | 1514 comm_write_done: |
1515 ; check options, gases and diluents | |
1516 call option_check_all ; check all options (and reset if not within their min/max boundaries) | |
1517 goto comm_download_mode0 ; done, loop with timeout reset | |
1518 | |
1519 ;----------------------------------------------------------------------------- | |
1520 | |
1521 ; Memory map is as follows: | |
1522 ; ------------------------- | |
1523 ; opt_gas_O2_ratio res 5 ; O2 ratios of OC/bailout gases | |
1524 ; opt_dil_O2_ratio res 5 ; O2 ratios of diluents | |
1525 ; opt_gas_He_ratio res 5 ; He ratios of OC/bailout gases | |
1526 ; opt_dil_He_ratio res 5 ; He ratios of diluents | |
1527 ; opt_gas_type res 5 ; OC/bailout gas type | |
1528 ; opt_dil_type res 5 ; dil type | |
1529 ; opt_gas_change res 5 ; change depths for OC/Bailout gases | |
1530 ; opt_dil_change res 5 ; change depths for diluents | |
80 | 1531 |
604 | 1532 comm_write_gas_dil: |
1533 lfsr FSR0,opt_gas_O2_ratio ; load base address of gas data arrays | |
1534 movf up,W ; load index (0-9) of gas/dil into WREG, addressing O2 ratio | |
1535 movff RCREG1,PLUSW0 ; receive O2 ratio | |
1536 rcall comm_get_byte ; wait for UART | |
1537 addlw .10 ; increment index by 10, addressing He ratio now | |
1538 movff RCREG1,PLUSW0 ; receive He ratio | |
1539 rcall comm_get_byte ; wait for UART | |
1540 addlw .10 ; increment index by 10, addressing gas/dil type now | |
1541 movff RCREG1,PLUSW0 ; receive gas/dil type | |
1542 rcall comm_get_byte ; wait for UART | |
1543 addlw .10 ; increment index by 10, addressing change depth now | |
1544 movff RCREG1,PLUSW0 ; receive change depth | |
1545 bra comm_write_done ; done, loop with timeout reset | |
80 | 1546 |
604 | 1547 |
1548 ; Memory map is as follows: | |
1549 ; ------------------------- | |
623 | 1550 ; opt_setpoint_cbar res 5 ; setpoints in cbar |
1551 ; opt_setpoint_change res 5 ; change depth for the setpoints in meter | |
604 | 1552 |
1553 comm_write_sp: | |
623 | 1554 lfsr FSR0,opt_setpoint_cbar ; load base address of setpoint cbar values |
604 | 1555 movf up,W ; load index (0-4) of setpoint into WREG, addressing cbar value |
1556 movff RCREG1,PLUSW0 ; receive setpoint cbar value | |
1557 rcall comm_get_byte ; wait for UART | |
1558 addlw .5 ; increment index by 5, addressing change depth now | |
1559 movff RCREG1,PLUSW0 ; receive change depth | |
1560 bra comm_write_done ; done, loop with timeout reset | |
80 | 1561 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1562 ;----------------------------------------------------------------------------- |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1563 |
0 | 1564 comm_send_string: |
604 | 1565 movlw "n" ; send echo |
0 | 1566 movwf TXREG1 |
623 | 1567 call comm_write_byte ; wait for completion of transmit |
582 | 1568 WIN_SMALL comm_string_column, comm_string_row |
0 | 1569 movlw .16 |
604 | 1570 movwf lo ; counter |
0 | 1571 comm_send_string_loop: |
604 | 1572 call comm_get_byte |
623 | 1573 btfsc rs232_rx_timeout ; got a byte? |
1574 bra comm_send_string_abort ; NO - abort | |
604 | 1575 movff RCREG1,POSTINC2 ; store character |
0 | 1576 decfsz lo,F |
1577 bra comm_send_string_loop | |
1578 comm_send_string_abort: | |
604 | 1579 STRCAT_PRINT "" ; show the text |
1580 goto comm_download_mode0 ; done, loop with timeout reset | |
0 | 1581 |
1582 ;----------------------------------------------------------------------------- | |
1583 | |
475 | 1584 comm_write_button_polarity: |
604 | 1585 ; store RCREG1 into EEPROM .897 |
582 | 1586 movlw LOW .897 |
475 | 1587 movwf EEADR |
582 | 1588 movlw HIGH .897 |
475 | 1589 movwf EEADRH |
1590 movff RCREG1,EEDATA | |
604 | 1591 movff EEDATA,button_polarity ; 0xFF (both normal), 0x00 (both inverted), 0x01 (left inverted only), 0x02 (right inverted only) |
1592 call write_eeprom ; EEDATA into EEPROM@EEADR | |
1593 clrf EEADRH ; reset EEADRH | |
1594 goto comm_download_mode0 ; done, loop with timeout reset | |
582 | 1595 |
0 | 1596 ;---------------------------------------------------------------------------- |
582 | 1597 END |