Mercurial > public > hwos_code
annotate src/comm.asm @ 271:d316d44530a3
Update digital ppO2 data automatically
author | heinrichsweikamp |
---|---|
date | Tue, 28 Apr 2015 16:39:28 +0200 |
parents | 1207cf9a9408 |
children | 12ee30cbced9 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File comm.asm | |
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 | |
11 ; 2012-02-11 : [jDG] Added "c" set custom text, and "i" identify. | |
12 | |
13 #include "ostc3.inc" | |
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" | |
24 | |
147 | 25 extern new_battery_menu,restart,option_reset_all |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
26 extern char_I_dil_change, char_I_setpoint_cbar, char_I_setpoint_change |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
27 extern char_I_deco_model, char_I_extra_time, char_I_saturation_multiplier, char_I_desaturation_multiplier |
81
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
28 extern option_check_all, gaslist_cleanup_list, get_first_gas_to_WREG, get_first_dil_to_WREG |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
159
diff
changeset
|
29 extern vault_decodata_into_eeprom |
0 | 30 |
31 #DEFINE timeout_comm_pre_mode .120 ; Pre-loop | |
32 #DEFINE timeout_comm_mode .120 ; Download mode | |
33 #DEFINE timeout_service_mode .120 ; Service mode | |
34 | |
35 #DEFINE comm_title_row .0 | |
269
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
36 #DEFINE comm_title_column_usb .50 |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
37 #DEFINE comm_title_column_ble .25 |
0 | 38 |
39 #DEFINE comm_string_row .30 | |
40 #DEFINE comm_string_column .40 | |
41 | |
42 | |
43 #DEFINE comm_status1_row .70 | |
44 #DEFINE comm_status1_column .10 | |
45 #DEFINE comm_status2_row .100 | |
46 #DEFINE comm_status2_column comm_status1_column | |
47 #DEFINE comm_status3_row .130 | |
48 #DEFINE comm_status3_column comm_status1_column | |
49 | |
50 #DEFINE comm_warning_row .160 | |
51 #DEFINE comm_warning_column .65 | |
52 | |
53 comm code | |
54 | |
55 ; test for comm | |
218 | 56 global comm_mode, comm_mode0 |
0 | 57 comm_mode: |
113 | 58 WAITMS d'1' |
59 btfss vusb_in ; USB plugged in? | |
60 return ; No, it was only a glitch | |
61 WAITMS d'1' | |
62 btfss vusb_in ; USB plugged in? | |
63 return ; No, it was only a glitch | |
218 | 64 comm_mode0: |
0 | 65 call TFT_ClearScreen |
66 WIN_COLOR color_greenish | |
269
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
67 btfsc ble_available ; ble available |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
68 bra comm_mode0_ble |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
69 WIN_SMALL comm_title_column_usb, comm_title_row |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
70 STRCPY_TEXT_PRINT tUsbTitle ; USB Mode |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
71 bra comm_mode0_common |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
72 comm_mode0_ble: |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
73 WIN_SMALL comm_title_column_ble, comm_title_row |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
74 STRCPY_TEXT_PRINT tBleTitle ; BLE Mode |
1207cf9a9408
adjust menu for different hardware versions
heinrichsweikamp
parents:
255
diff
changeset
|
75 comm_mode0_common: |
0 | 76 call TFT_standard_color |
77 WIN_TOP .10 | |
78 WIN_LEFT .1 | |
79 movlw 0xDE | |
80 movwf TBLPTRL | |
81 movlw 0xEE | |
82 movwf TBLPTRH | |
83 movlw 0x01 | |
84 movwf TBLPTRU | |
251
3fec179a6220
some cleanup, temporaly disable dive_warning.inc
heinrichsweikamp
parents:
245
diff
changeset
|
85 extern color_image |
0 | 86 call color_image ; Show usb logo |
87 WIN_SMALL comm_status1_column, comm_status1_row | |
88 STRCPY_TEXT_PRINT tUsbStarting ; Starting... | |
89 call TFT_serial ; Show serial and firmware version | |
90 bcf enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
91 bcf switch_right | |
92 bcf comm_service_enabled | |
93 bsf menubit | |
94 bcf battery_removed_in_usb ; =1: The battery has been removed in USB | |
95 movlw timeout_comm_pre_mode | |
96 movwf timeout_counter | |
97 WIN_SMALL comm_status1_column+.80, comm_status1_row | |
98 STRCPY_TEXT_PRINT tUsbStartDone ; Done... | |
99 call enable_rs232 ; Also sets to speed_normal ... | |
100 comm_mode1: | |
101 bcf onesecupdate | |
102 bcf LEDr | |
103 dcfsnz timeout_counter,F | |
104 bra comm_service_exit ; Timeout -> Exit | |
105 comm_mode2: | |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
106 btfsc rechargeable |
150 | 107 bra comm_mode4 ; Skip |
108 | |
0 | 109 call get_battery_voltage ; gets battery voltage |
110 movlw .3 | |
111 cpfslt batt_voltage+1 ; Batt Voltage less then 3*256mV? | |
112 bra comm_mode3 ; No | |
113 ; Set flag | |
114 bsf battery_removed_in_usb ; =1: The battery has been removed in USB | |
115 bra comm_mode4 | |
116 | |
117 comm_mode3: | |
118 ; Voltage ok. Do we have a new battery now? | |
119 btfsc battery_removed_in_usb ; =1: The battery has been removed in USB | |
120 goto new_battery_menu ; show "New battery dialog" | |
121 | |
122 comm_mode4: | |
123 call rs232_get_byte | |
124 | |
125 btfss vusb_in ; USB plugged in? | |
69 | 126 bra comm_service_exit_nousb_delay ; Disconnected -> Exit |
127 comm_mode4a: | |
0 | 128 |
129 btfsc switch_right ; Abort with right | |
130 bra comm_service_exit | |
131 | |
132 btfsc onesecupdate | |
133 bra comm_mode1 | |
134 | |
135 movlw 0xAA ; start byte=0xAA? | |
136 cpfseq RCREG1 | |
137 bra comm_mode2a | |
138 bra comm_mode2b ; Startbyte for service mode found | |
139 comm_mode2a: | |
140 movlw 0xBB ; start byte=0xBB? | |
141 cpfseq RCREG1 | |
142 bra comm_mode2 ; Cycle | |
143 bra comm_download_mode ; Startbyte for download mode found | |
144 | |
145 comm_mode2b: | |
146 ; Startbyte found | |
147 call rs232_wait_tx ; Wait for UART | |
148 movlw 0x4B | |
149 movwf TXREG1 ; Send Answer | |
150 ; Now, check comm command | |
151 | |
152 call rs232_get_byte ; first byte | |
153 call rs232_wait_tx ; Wait for UART | |
154 movff RCREG1,TXREG1 ; Echo | |
155 movlw UPPER comm_service_key | |
156 cpfseq RCREG1 | |
157 bra comm_mode1 ; Wrong -> Restart | |
158 call rs232_get_byte ; second byte | |
159 call rs232_wait_tx ; Wait for UART | |
160 movff RCREG1,TXREG1 ; Echo | |
161 movlw HIGH (comm_service_key & 0xFFFF) | |
162 cpfseq RCREG1 | |
163 bra comm_mode1 ; Wrong -> Restart | |
164 call rs232_get_byte ; third byte | |
165 call rs232_wait_tx ; Wait for UART | |
166 movff RCREG1,TXREG1 ; Echo | |
167 movlw LOW comm_service_key | |
168 cpfseq RCREG1 | |
169 bra comm_mode1 ; Wrong -> Restart | |
170 | |
171 ; Enable comm service mode | |
172 WIN_SMALL comm_status2_column, comm_status2_row | |
173 STRCPY_TEXT_PRINT tUsbServiceMode ; Service mode enabled | |
174 bsf comm_service_enabled | |
175 bra comm_download_mode0 ; Startbyte for download mode found | |
176 | |
69 | 177 |
178 comm_service_exit_nousb_delay: | |
179 WAITMS d'200' | |
180 btfss vusb_in ; USB plugged in? | |
181 bra comm_service_exit_nousb ; Disconnected -> Exit | |
182 bra comm_mode4a ; (Still) connected, return | |
183 | |
0 | 184 comm_service_exit_nousb: ; Disconnected -> Exit |
185 WIN_SMALL comm_status3_column, comm_status3_row | |
186 STRCPY_TEXT_PRINT tUsbClosed ; Port closed | |
187 bra comm_service_exit_common | |
188 | |
189 comm_service_exit: | |
190 WIN_SMALL comm_status3_column, comm_status3_row | |
191 STRCPY_TEXT_PRINT tUsbExit ; Exited | |
192 | |
193 comm_service_exit_common: | |
194 call rs232_wait_tx ; Wait for UART | |
195 movlw 0xFF ; Reply FF | |
196 movwf TXREG1 ; Send Answer | |
197 | |
198 ; Wait 1 second | |
199 bcf onesecupdate | |
200 btfss onesecupdate | |
201 bra $-2 | |
202 ; Wait 1 second | |
203 bcf onesecupdate | |
204 btfss onesecupdate | |
205 bra $-2 | |
206 | |
207 call disable_rs232 | |
208 goto restart | |
209 | |
210 ;----------------------------------------------------------------------------- | |
211 | |
212 comm_service_ll_bootloader: | |
213 bsf LEDr | |
214 WIN_SMALL comm_status3_column, comm_status3_row | |
215 STRCPY_TEXT_PRINT tUsbLlBld ; Low Level Bootloader started | |
216 WIN_TOP comm_warning_row | |
217 WIN_LEFT comm_warning_column | |
252 | 218 TFT_WRITE_PROM_IMAGE dive_warning2_block ; Show Warning icon |
0 | 219 goto 0x1FF0C |
220 | |
221 ;----------------------------------------------------------------------------- | |
222 ; Sends external flash from 0x3E0000 to 0x3FD000 (118784bytes) via comm | |
223 ; | |
224 comm_send_firmware: | |
225 movlw 0x50 ; send echo | |
226 movwf TXREG1 | |
227 call rs232_wait_tx ; Wait for UART | |
228 | |
229 ; Read 5 bytes into buffer. | |
230 lfsr FSR2,buffer | |
231 movlw .5 ; counter | |
232 movwf lo | |
233 movlw 0x55 ; 5'ft byte checksum. | |
234 movwf hi | |
235 | |
236 comm_send_firmware_loop: | |
237 call rs232_get_byte | |
238 btfsc rs232_recieve_overflow ; Got byte? | |
239 bra comm_send_firmware_abort ; No, abort! | |
240 movf RCREG1,W | |
241 movwf POSTINC2 ; Store checksum byte. | |
242 xorwf hi,F ; Also xor into checksum | |
243 rlncf hi,F ; And rotate it. | |
244 decfsz lo,F | |
245 bra comm_send_firmware_loop | |
246 | |
247 ; Check that 5ft byte checksum's checksum | |
248 movf hi,W | |
249 bnz comm_send_firmware_failed | |
250 | |
251 movlw 0x4C ; send OK | |
252 movwf TXREG1 | |
253 call rs232_wait_tx ; Wait for UART | |
254 | |
255 ; Passed: goto second stage verification. | |
256 ; NOTE: Bootloader is Bank0. With buffer at address 0x200. | |
162
95d05cc14736
NEW: Safe tissue data, date and time during firmware update
heinrichsweikamp
parents:
159
diff
changeset
|
257 call vault_decodata_into_eeprom ; Store last deco data (And Time/Date) into EEPROM |
0 | 258 goto 0x1FDF0 ; And pray... |
259 | |
260 comm_send_firmware_failed: | |
261 WIN_SMALL comm_string_column, comm_string_row | |
50 | 262 call TFT_warnings_color |
0 | 263 STRCPY_PRINT "Checksum failed" |
264 | |
265 comm_send_firmware_abort: | |
266 | |
267 movlw 0xFF ; send ABORTED byte. | |
268 movwf TXREG1 | |
269 bra comm_download_mode0 ; Done. | |
270 | |
271 ;----------------------------------------------------------------------------- | |
272 ; Reset to Dive 1 in logbook | |
273 | |
274 comm_reset_logbook_pointers: | |
275 clrf EEADRH ; Make sure to select eeprom bank 0 | |
276 clrf EEDATA | |
277 write_int_eeprom .4 | |
278 write_int_eeprom .5 | |
279 write_int_eeprom .6 | |
280 write_int_eeprom .2 ; Also, delete total dive counter | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
281 write_int_eeprom .3 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
282 write_int_eeprom .15 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
283 write_int_eeprom .16 ; And the backup counter, too |
0 | 284 call ext_flash_erase_logbook ; And complete logbook (!) |
285 bra comm_download_mode0 ; Done. | |
286 | |
287 ;----------------------------------------------------------------------------- | |
288 comm_reset_battery_gauge: ; Resets battery gauge registers | |
289 call reset_battery_pointer ; Resets battery pointer 0x07-0x0C and battery_gauge:5 | |
290 bra comm_download_mode0 ; Done. | |
291 | |
292 ;----------------------------------------------------------------------------- | |
293 ; erases range in 4kB steps | |
294 | |
295 comm_erase_range4kb: | |
296 movlw 0x42 ; send echo | |
297 movwf TXREG1 | |
298 call rs232_wait_tx ; Wait for UART | |
299 | |
300 bcf INTCON,GIE ; All interrups off! | |
301 | |
302 rcall comm_get_flash_address ; Get three bytes address or return | |
303 btfsc rs232_recieve_overflow ; Got Data? | |
304 bra comm_download_mode0 ; No, Done. | |
305 | |
306 call rs232_get_byte | |
307 btfsc rs232_recieve_overflow ; Got byte? | |
308 bra comm_download_mode0 ; No, Done. | |
309 movff RCREG1,lo | |
310 ; Got 4bytes: 3bytes address and 1 bytes (lo) amount of 4kB blocks | |
311 | |
312 comm_erase_range4kb1: | |
313 call ext_flash_erase4kB ; Erase block! | |
314 | |
315 movlw 0x10 | |
316 addwf ext_flash_address+1,F | |
317 movlw .0 | |
318 addwfc ext_flash_address+2,F ; Increase address by .4096, or 0x1000 | |
319 decfsz lo,F | |
320 bra comm_erase_range4kb1 ; Loop until lo=zero | |
321 | |
322 bra comm_download_mode0 ; Done (Sends the 4C OK too). | |
323 | |
324 ;----------------------------------------------------------------------------- | |
325 | |
326 comm_erase_4kb: ; Get 3 bytes start address | |
327 bcf INTCON,GIE ; All interrups off! | |
328 | |
329 rcall comm_get_flash_address ; Get three bytes address or return | |
330 btfsc rs232_recieve_overflow ; Got Data? | |
331 bra comm_download_mode0 ; No, Done. | |
332 | |
333 call ext_flash_erase4kB ; Erase one block | |
334 bra comm_download_mode0 ; Done. | |
335 | |
336 ;----------------------------------------------------------------------------- | |
337 | |
338 comm_write_range: ; Get 3 bytes start address | |
339 movlw 0x30 ; send echo | |
340 movwf TXREG1 | |
341 call rs232_wait_tx ; Wait for UART | |
342 | |
343 bcf INTCON,GIE ; All interrups off! | |
344 | |
345 rcall comm_get_flash_address ; Get three bytes address or return | |
346 btfsc rs232_recieve_overflow ; Got Data? | |
347 bra comm_download_mode0 ; No, Done. | |
348 | |
349 comm_write_range_loop: | |
350 call rs232_get_byte | |
351 btfsc rs232_recieve_overflow ; Got byte? | |
352 bra comm_download_mode0 ; No, Done (and send OK byte too). | |
353 movf RCREG1,W | |
354 call ext_flash_byte_write ; write one byte | |
355 call incf_ext_flash_address_p1 ; increase address+1 | |
356 bra comm_write_range_loop | |
357 | |
358 ;----------------------------------------------------------------------------- | |
359 | |
360 comm_send_range: ; Get 3 bytes start address and 3 bytes amount | |
361 movlw 0x20 ; send echo | |
362 movwf TXREG1 | |
363 call rs232_wait_tx ; Wait for UART | |
364 | |
365 bcf INTCON,GIE ; All interrups off! | |
366 | |
367 rcall comm_get_flash_address ; Get three bytes address or return | |
368 btfsc rs232_recieve_overflow ; Got Data? | |
369 bra comm_download_mode0 ; No, Done. | |
370 | |
371 call rs232_get_byte | |
372 btfsc rs232_recieve_overflow ; Got byte? | |
373 bra comm_download_mode0 ; No, Done. | |
374 movff RCREG1,up | |
375 call rs232_get_byte | |
376 btfsc rs232_recieve_overflow ; Got byte? | |
377 bra comm_download_mode0 ; No, Done. | |
378 movff RCREG1,hi | |
379 call rs232_get_byte | |
380 btfsc rs232_recieve_overflow ; Got byte? | |
381 bra comm_download_mode0 ; No, Done. | |
382 movff RCREG1,lo | |
383 | |
384 ; If lo==0, we must precondition hi because there is to many bytes send ! | |
385 movf lo,W | |
386 bnz $+4 | |
387 decf hi,F | |
388 | |
389 ; 6bytes received, send data | |
390 comm_send_range2: ; needs ext_flash_address:3 start address and up:hi:lo amount | |
391 call ext_flash_read_block_start | |
392 movwf TXREG1 | |
393 | |
394 bra comm_send_range24 ; counter 24bit | |
395 comm_send_range24_loop: | |
396 call ext_flash_read_block ; Read one byte | |
397 movwf TXREG1 ; Start new transmit | |
398 comm_send_range24: | |
399 call rs232_wait_tx ; Wait for UART | |
400 decfsz lo,F | |
401 bra comm_send_range24_loop | |
402 decf hi,F | |
403 movlw 0xFF | |
404 cpfseq hi | |
405 bra comm_send_range24_loop | |
406 decf up,F | |
407 movlw 0xFF | |
408 cpfseq up | |
409 bra comm_send_range24_loop | |
410 call ext_flash_read_block_stop | |
411 | |
412 bra comm_download_mode0 ; Done. | |
413 | |
414 ;----------------------------------------------------------------------------- | |
415 | |
416 comm_get_flash_address: | |
417 call rs232_get_byte | |
418 btfsc rs232_recieve_overflow ; Got byte? | |
419 return ; No, return | |
420 movff RCREG1,ext_flash_address+2 | |
421 call rs232_get_byte | |
422 btfsc rs232_recieve_overflow ; Got byte? | |
423 return ; No, return | |
424 movff RCREG1,ext_flash_address+1 | |
425 call rs232_get_byte | |
426 btfsc rs232_recieve_overflow ; Got byte? | |
427 return ; No, return | |
428 movff RCREG1,ext_flash_address+0 | |
429 return | |
430 | |
431 ;----------------------------------------------------------------------------- | |
432 | |
433 comm_download_mode: | |
434 ; Enable comm download mode | |
435 WIN_SMALL comm_status2_column, comm_status2_row | |
436 STRCPY_TEXT_PRINT tUsbDownloadMode; Download mode enabled | |
437 bsf INTCON,GIE ; All interrups on | |
438 call rs232_wait_tx ; Wait for UART | |
439 movlw 0xBB ; Command Echo | |
440 movwf TXREG1 ; Send Answer | |
441 comm_download_mode0: | |
442 bsf INTCON,GIE ; All interrups on | |
443 call rs232_wait_tx ; Wait for UART | |
444 movlw 0x4C ; 4C in service mode | |
445 btfss comm_service_enabled | |
446 movlw 0x4D ; 4D in download mode | |
447 movwf TXREG1 ; Send Answer | |
448 movlw timeout_service_mode | |
449 movwf timeout_counter ; Timeout | |
450 bcf switch_right | |
451 comm_download_mode1: | |
452 bcf onesecupdate | |
453 dcfsnz timeout_counter,F | |
454 bra comm_service_exit ; Timeout -> Exit | |
455 comm_download_mode2: | |
456 call rs232_get_byte ; Check for a byte | |
457 btfsc comm_service_enabled | |
458 btg LEDr ; Blink in Service mode | |
459 btfss vusb_in ; USB plugged in? | |
460 bra comm_service_exit_nousb ; Disconnected -> Exit | |
461 btfsc switch_right ; Abort with right | |
462 bra comm_service_exit | |
463 btfsc onesecupdate | |
464 bra comm_download_mode1 | |
465 btfsc rs232_recieve_overflow | |
466 bra comm_download_mode2 ; Wait for command byte | |
467 | |
468 ; command received! | |
469 bcf LEDr | |
470 movlw 0xFF | |
471 cpfseq RCREG1 | |
472 bra $+4 | |
473 bra comm_service_exit ; exit | |
474 movlw "a" | |
475 cpfseq RCREG1 | |
476 bra $+4 | |
477 bra comm_send_headers ; Send all 256 dive headers | |
478 movlw "b" | |
479 cpfseq RCREG1 | |
480 bra $+4 | |
481 bra comm_set_time ; Read time and date from the PC and set clock | |
482 movlw "c" | |
483 cpfseq RCREG1 | |
484 bra $+4 | |
485 bra comm_set_custom_text ; Send a opt_name_length byte string of custom text. | |
486 movlw "f" | |
487 cpfseq RCREG1 | |
488 bra $+4 | |
489 bra comm_send_dive ; Send header and profile for one dive | |
490 movlw "i" | |
491 cpfseq RCREG1 | |
492 bra $+4 | |
493 bra comm_identify ; Send firmware, serial, etc. | |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
494 movlw "j" |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
495 cpfseq RCREG1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
496 bra $+4 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
497 bra comm_hardware_descriptor ; Send hardware descriptor byte |
0 | 498 movlw "n" |
499 cpfseq RCREG1 | |
500 bra $+4 | |
80 | 501 goto comm_send_string ; Send a 15byte string to the screen |
0 | 502 movlw "l" |
503 cpfseq RCREG1 | |
504 bra $+4 | |
505 call TFT_dump_screen ; Dump the screen contents | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
506 movlw "r" |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
507 cpfseq RCREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
508 bra $+4 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
509 bra comm_read_setting ; Read a setting (And send via USB) |
80 | 510 movlw "w" |
511 cpfseq RCREG1 | |
512 bra $+4 | |
513 bra comm_write_setting ; Write a setting (Into RAM) | |
514 movlw "x" | |
515 cpfseq RCREG1 | |
516 bra $+4 | |
517 bra comm_option_reset_all ; Reset all options to factory default. | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
518 |
0 | 519 |
520 btfss comm_service_enabled ; Done for Download mode | |
521 bra comm_download_mode0 ; Loop with timeout reset | |
522 | |
523 movlw 0x20 | |
524 cpfseq RCREG1 | |
525 bra $+4 | |
526 bra comm_send_range ; send hi:lo:temp1 bytes starting from ext_flash_address:3 | |
527 movlw 0x22 | |
528 cpfseq RCREG1 | |
529 bra $+4 | |
530 bra comm_reset_logbook_pointers ; Resets all logbook pointers and the logbook (!) | |
531 movlw 0x23 | |
532 cpfseq RCREG1 | |
533 bra $+4 | |
534 bra comm_reset_battery_gauge ; Resets battery gauge registers | |
535 movlw 0x30 | |
536 cpfseq RCREG1 | |
537 bra $+4 | |
538 bra comm_write_range ; write bytes starting from ext_flash_address:3 (Stop when timeout) | |
539 movlw 0x40 | |
540 cpfseq RCREG1 | |
541 bra $+4 | |
542 bra comm_erase_4kb ; erases 4kB block from ext_flash_address:3 (Warning: No confirmation or built-in security here...) | |
543 movlw 0x42 | |
544 cpfseq RCREG1 | |
545 bra $+4 | |
546 bra comm_erase_range4kb ; erases range in 4kB steps (Get 3 bytes address and 1byte amount of 4kB blocks) | |
547 movlw 0x50 | |
548 cpfseq RCREG1 | |
549 bra $+4 | |
550 bra comm_send_firmware ; sends firmware from external flash from 0x3E0000 to 0x3FD000 (118784bytes) via comm | |
147 | 551 ; movlw "t" |
552 ; cpfseq RCREG1 | |
553 ; bra $+4 | |
554 ; goto testloop ; Start raw-data testloop | |
0 | 555 movlw 0xC1 |
556 cpfseq RCREG1 | |
557 bra $+4 | |
558 bra comm_service_ll_bootloader ; Start low-level bootloader | |
559 bra comm_download_mode0 ; Loop with timeout reset | |
560 | |
561 ;----------------------------------------------------------------------------- | |
562 | |
563 comm_send_headers: | |
564 movlw "a" ; send echo | |
565 movwf TXREG1 | |
566 ; Send 256 bytes/dive (Header) | |
567 ; 1st: 200000h-2000FFh | |
568 ; 2nd: 201000h-2010FFh | |
569 ; 3rd: 202000h-2020FFh | |
570 ; 100: 264000h-2640FFh | |
571 ; 256: 2FF000h-2FF0FFh | |
572 movlw 0x1F | |
573 movwf ext_flash_address+2 | |
574 movlw 0xF0 | |
575 movwf ext_flash_address+1 | |
576 | |
577 comm_send_headers2: | |
578 movlw 0x00 | |
579 movwf ext_flash_address+0 | |
580 ; Adjust address for next dive | |
581 movlw 0x10 | |
582 addwf ext_flash_address+1 | |
583 movlw 0x00 | |
584 addwfc ext_flash_address+2 | |
585 | |
586 movlw 0x30 | |
587 cpfseq ext_flash_address+2 ; All 256 dive send? | |
588 bra comm_send_headers4 ; No, continue | |
589 bra comm_download_mode0 ; Done. Loop with timeout reset | |
590 | |
591 comm_send_headers4: | |
592 clrf lo ; Counter | |
593 call rs232_wait_tx ; Wait for UART | |
594 call ext_flash_read_block_start ; 1st byte | |
595 movwf TXREG1 | |
596 bra comm_send_headers3 ; counter 24bit | |
597 comm_send_headers_loop: | |
598 call ext_flash_read_block ; Read one byte | |
599 movwf TXREG1 ; Start new transmit | |
600 comm_send_headers3: | |
601 call rs232_wait_tx ; Wait for UART | |
602 decfsz lo,F | |
603 bra comm_send_headers_loop | |
604 call ext_flash_read_block_stop | |
605 bra comm_send_headers2 ; continue | |
606 | |
607 ;----------------------------------------------------------------------------- | |
80 | 608 |
609 comm_option_reset_all: ; Reset all options to factory default. | |
610 movlw "x" ; send echo | |
611 movwf TXREG1 | |
612 call option_reset_all | |
613 bra comm_download_mode0 ; Done. back to loop with timeout reset | |
614 | |
615 ;----------------------------------------------------------------------------- | |
0 | 616 |
617 comm_set_time: | |
618 movlw "b" ; send echo | |
619 movwf TXREG1 | |
620 | |
621 call rs232_wait_tx ; wait for UART | |
622 call rs232_get_byte | |
623 btfsc rs232_recieve_overflow ; Got byte? | |
128
bd74161c4292
catch timeout during set time/date command
heinrichsweikamp
parents:
124
diff
changeset
|
624 bra comm_download_mode0 ; No, abort |
0 | 625 movff RCREG1, hours |
626 movlw d'24' | |
627 cpfslt hours | |
628 clrf hours | |
629 call rs232_get_byte | |
630 btfsc rs232_recieve_overflow ; Got byte? | |
128
bd74161c4292
catch timeout during set time/date command
heinrichsweikamp
parents:
124
diff
changeset
|
631 bra comm_download_mode0 ; No, abort |
0 | 632 movff RCREG1, mins |
633 movlw d'60' | |
634 cpfslt mins | |
635 clrf mins | |
636 call rs232_get_byte | |
637 btfsc rs232_recieve_overflow ; Got byte? | |
128
bd74161c4292
catch timeout during set time/date command
heinrichsweikamp
parents:
124
diff
changeset
|
638 bra comm_download_mode0 ; No, abort |
0 | 639 movff RCREG1, secs |
640 movlw d'60' | |
641 cpfslt secs | |
642 clrf secs | |
643 call rs232_get_byte | |
644 btfsc rs232_recieve_overflow ; Got byte? | |
128
bd74161c4292
catch timeout during set time/date command
heinrichsweikamp
parents:
124
diff
changeset
|
645 bra comm_download_mode0 ; No, abort |
0 | 646 movff RCREG1, month |
647 movlw d'13' | |
648 cpfslt month | |
649 movwf month | |
650 call rs232_get_byte | |
651 btfsc rs232_recieve_overflow ; Got byte? | |
128
bd74161c4292
catch timeout during set time/date command
heinrichsweikamp
parents:
124
diff
changeset
|
652 bra comm_download_mode0 ; No, abort |
92
7ca1105751c7
add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents:
81
diff
changeset
|
653 call comm_check_day ; Check day |
0 | 654 call rs232_get_byte |
655 btfsc rs232_recieve_overflow ; Got byte? | |
128
bd74161c4292
catch timeout during set time/date command
heinrichsweikamp
parents:
124
diff
changeset
|
656 bra comm_download_mode0 ; No, abort |
0 | 657 movff RCREG1, year |
658 movlw d'100' | |
659 cpfslt year | |
660 clrf year | |
661 ; All ok, set RTCC | |
662 call rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module | |
663 bra comm_download_mode0 ; Done. back to loop with timeout reset | |
664 | |
665 ;----------------------------------------------------------------------------- | |
666 ; Set OSTC3 custom text string (opt_name_length ascii chars). | |
667 ; | |
668 | |
669 comm_set_custom_text: | |
670 movlw "c" ; send echo | |
671 movwf TXREG1 | |
672 call rs232_wait_tx ; wait for UART | |
673 lfsr FSR2,opt_name | |
674 movlw opt_name_length | |
675 movwf lo ; counter | |
676 comm_set_ctext_loop: | |
677 call rs232_get_byte | |
678 btfsc rs232_recieve_overflow ; Got byte? | |
136 | 679 bra comm_set_ctext_loop_done ; no, abort |
7 | 680 movff RCREG1,POSTINC2 ; Store character |
0 | 681 decfsz lo,F |
682 bra comm_set_ctext_loop | |
136 | 683 comm_set_ctext_loop_done: |
684 tstfsz lo ; Got opt_name_length bytes? | |
685 bra comm_set_ctext_loop_done2 ; no, clear remaining chars | |
686 bra comm_download_mode0 ; Done. Loop with timeout reset | |
687 comm_set_ctext_loop_done2: | |
688 clrf POSTINC2 | |
689 decfsz lo,F | |
690 bra comm_set_ctext_loop_done2 | |
7 | 691 bra comm_download_mode0 ; Done. Loop with timeout reset |
0 | 692 |
693 ;----------------------------------------------------------------------------- | |
694 ; Reply Serial (2 bytes low:high), firmware (major.minor) and custom text. | |
695 ; | |
696 | |
697 comm_identify: | |
698 movlw "i" ; send echo | |
699 movwf TXREG1 | |
700 call rs232_wait_tx ; wait for UART | |
701 | |
702 ;---- Read serial from internal EEPROM address 0000 | |
703 clrf EEADRH | |
704 clrf EEADR ; Get Serial number LOW | |
705 call read_eeprom ; read byte | |
706 movff EEDATA,lo | |
707 incf EEADR,F ; Get Serial number HIGH | |
708 call read_eeprom ; read byte | |
709 movff EEDATA,hi | |
710 | |
711 ;---- Emit serial number | |
712 movff lo,TXREG1 | |
713 call rs232_wait_tx | |
714 movff hi,TXREG1 | |
715 call rs232_wait_tx | |
716 | |
717 ;---- Emit fiwmware hi.lo | |
718 movlw softwareversion_x | |
719 movwf TXREG1 | |
720 call rs232_wait_tx | |
721 movlw softwareversion_y | |
722 movwf TXREG1 | |
723 call rs232_wait_tx | |
724 | |
725 ;---- Emit custom text | |
726 movlw opt_name_length | |
727 movwf hi | |
728 lfsr FSR2,opt_name | |
729 | |
730 common_identify_loop: | |
731 movff POSTINC2,TXREG1 | |
732 call rs232_wait_tx | |
733 decfsz hi,F | |
734 bra common_identify_loop | |
735 | |
736 bra comm_download_mode0 ; Done. | |
737 | |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
738 ;----------------------------------------------------------------------------- |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
739 ; Reply hardware descriptor byte |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
740 ; |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
741 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
742 comm_hardware_descriptor: |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
743 movlw "j" ; send echo |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
744 movwf TXREG1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
745 call rs232_wait_tx ; wait for UART |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
746 movff hardware_flag,TXREG1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
747 bra comm_download_mode0 ; Done. |
0 | 748 |
749 ;----------------------------------------------------------------------------- | |
750 | |
751 comm_send_dive: | |
752 movlw "f" ; send echo | |
753 movwf TXREG1 | |
754 | |
755 call rs232_get_byte | |
756 btfsc rs232_recieve_overflow ; Got byte? | |
757 bra comm_download_mode0 ; No, abort! | |
758 movff RCREG1,lo ; Store dive number (0-255) | |
759 ; First, send the header (again) | |
760 ; Set ext_flash_address:3 to TOC entry of this dive | |
761 ; 1st: 200000h-200FFFh -> lo=0 | |
762 ; 2nd: 201000h-201FFFh -> lo=1 | |
763 ; 3rd: 202000h-202FFFh -> lo=2 | |
764 ; 256: 2FF000h-2FFFFFh -> lo=255 | |
765 clrf ext_flash_address+0 | |
766 clrf ext_flash_address+1 | |
767 movlw 0x20 | |
768 movwf ext_flash_address+2 | |
769 movlw .16 | |
770 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
771 movf PRODL,W | |
772 addwf ext_flash_address+1,F | |
773 movf PRODH,W | |
774 addwfc ext_flash_address+2,F | |
775 | |
776 incf_ext_flash_address d'2' ; Skip 0xFA, 0xFA | |
777 call ext_flash_byte_read_plus ; Read start address of profile | |
778 movff temp1,ext_flash_log_pointer+0 | |
779 call ext_flash_byte_read_plus ; Read start address of profile | |
780 movff temp1,ext_flash_log_pointer+1 | |
781 call ext_flash_byte_read_plus ; Read start address of profile | |
782 movff temp1,ext_flash_log_pointer+2 | |
783 call ext_flash_byte_read_plus ; Read end address of profile | |
784 movff temp1,convert_value_temp+0 | |
785 call ext_flash_byte_read_plus ; Read end address of profile | |
786 movff temp1,convert_value_temp+1 | |
787 call ext_flash_byte_read_plus ; Read end address of profile | |
788 movff temp1,convert_value_temp+2 | |
789 decf_ext_flash_address d'8' ; Back again to first 0xFA in header | |
790 | |
791 movf ext_flash_log_pointer+0,W | |
792 cpfseq convert_value_temp+0 ; Equal? | |
793 bra comm_send_dive1 ; No, Send header | |
794 | |
795 movf ext_flash_log_pointer+1,W | |
796 cpfseq convert_value_temp+1 ; Equal? | |
797 bra comm_send_dive1 ; No, Send header | |
798 | |
799 movf ext_flash_log_pointer+2,W | |
800 cpfseq convert_value_temp+2 ; Equal? | |
801 bra comm_send_dive1 ; No, Send header | |
802 | |
803 ; Start=End -> Not good, abort | |
804 bra comm_download_mode0 ; Done. Loop with timeout reset | |
805 | |
806 comm_send_dive1: | |
807 ; Send header | |
808 clrf hi ; Counter | |
809 call rs232_wait_tx ; Wait for UART | |
810 call ext_flash_read_block_start ; 1st byte | |
811 movwf TXREG1 | |
812 bra comm_send_dive_header | |
813 comm_send_dive_header2: | |
814 call ext_flash_read_block ; Read one byte | |
815 movwf TXREG1 ; Start new transmit | |
816 comm_send_dive_header: | |
817 call rs232_wait_tx ; Wait for UART | |
818 decfsz hi,F | |
819 bra comm_send_dive_header2 | |
820 call ext_flash_read_block_stop | |
821 | |
822 ; Set address for profile | |
823 movff ext_flash_log_pointer+0,ext_flash_address+0 | |
824 movff ext_flash_log_pointer+1,ext_flash_address+1 | |
825 movff ext_flash_log_pointer+2,ext_flash_address+2 | |
826 | |
827 movlw .6 ; Skip 6byte short header in profile - only for internal use | |
828 call incf_ext_flash_address0_0x20 ; increases bytes in ext_flash_address:3 with 0x200000 bank switching | |
829 | |
830 comm_send_dive_profile: | |
831 call ext_flash_byte_read_plus_0x20 ; Read one byte into temp1, takes care of banking at 0x200000 | |
832 call rs232_wait_tx ; Wait for UART | |
833 movff temp1,TXREG1 ; Send a byte | |
834 | |
835 ; 24bit compare with end address | |
836 movff convert_value_temp+0,WREG | |
837 cpfseq ext_flash_address+0 | |
838 bra comm_send_dive_profile | |
839 movff convert_value_temp+1,WREG | |
840 cpfseq ext_flash_address+1 | |
841 bra comm_send_dive_profile | |
842 movff convert_value_temp+2,WREG | |
843 cpfseq ext_flash_address+2 | |
844 bra comm_send_dive_profile | |
845 | |
238 | 846 rcall comm_read_setting_wait ; Wait for UART |
0 | 847 bra comm_download_mode0 ; Done. Loop with timeout reset |
848 | |
849 ;----------------------------------------------------------------------------- | |
850 | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
851 comm_read_setting: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
852 movlw "r" |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
853 movwf TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
854 call rs232_get_byte |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
855 btfsc rs232_recieve_overflow ; Got byte? |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
856 bra comm_read_abort ; No, abort! |
238 | 857 rcall comm_read_setting_wait ; Wait for UART |
858 movlw 0x0F | |
859 cpfsgt RCREG1 ; 0x00-0x0F: unused | |
860 bra comm_read_abort ; abort! | |
861 subwf RCREG1,W ; Subtract unused commands | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
862 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
863 bra comm_read_gas1 ; RCREG1=0x10 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
864 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
865 bra comm_read_gas2 ; RCREG1=0x11 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
866 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
867 bra comm_read_gas3 ; RCREG1=0x12 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
868 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
869 bra comm_read_gas4 ; RCREG1=0x13 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
870 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
871 bra comm_read_gas5 ; RCREG1=0x14 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
872 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
873 bra comm_read_dil1 ; RCREG1=0x15 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
874 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
875 bra comm_read_dil2 ; RCREG1=0x16 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
876 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
877 bra comm_read_dil3 ; RCREG1=0x17 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
878 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
879 bra comm_read_dil4 ; RCREG1=0x18 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
880 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
881 bra comm_read_dil5 ; RCREG1=0x19 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
882 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
883 bra comm_read_sp1 ; RCREG1=0x1A |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
884 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
885 bra comm_read_sp2 ; RCREG1=0x1B |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
886 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
887 bra comm_read_sp3 ; RCREG1=0x1C |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
888 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
889 bra comm_read_sp4 ; RCREG1=0x1D |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
890 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
891 bra comm_read_sp5 ; RCREG1=0x1E |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
892 dcfsnz WREG |
159 | 893 movff opt_ccr_mode, TXREG1 ; RCREG1=0x1F |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
894 dcfsnz WREG |
159 | 895 movff opt_dive_mode, TXREG1 ; RCREG1=0x20 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
896 dcfsnz WREG |
159 | 897 movff char_I_deco_model, TXREG1 ; RCREG1=0x21 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
898 dcfsnz WREG |
159 | 899 movff opt_ppO2_max, TXREG1 ; RCREG1=0x22 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
900 dcfsnz WREG |
159 | 901 movff opt_ppO2_min, TXREG1 ; RCREG1=0x23 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
902 dcfsnz WREG |
159 | 903 movff char_I_extra_time, TXREG1 ; RCREG1=0x24 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
904 dcfsnz WREG |
159 | 905 movff opt_GF_low, TXREG1 ; RCREG1=0x25 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
906 dcfsnz WREG |
159 | 907 movff opt_GF_high, TXREG1 ; RCREG1=0x26 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
908 dcfsnz WREG |
159 | 909 movff opt_aGF_low, TXREG1 ; RCREG1=0x27 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
910 dcfsnz WREG |
159 | 911 movff opt_aGF_high, TXREG1 ; RCREG1=0x28 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
912 dcfsnz WREG |
159 | 913 movff opt_enable_aGF, TXREG1 ; RCREG1=0x29 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
914 dcfsnz WREG |
159 | 915 movff char_I_saturation_multiplier, TXREG1; RCREG1=0x2A |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
916 dcfsnz WREG |
159 | 917 movff char_I_desaturation_multiplier, TXREG1; RCREG1=0x2B |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
918 dcfsnz WREG |
159 | 919 movff opt_last_stop, TXREG1 ; RCREG1=0x2C |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
920 dcfsnz WREG |
159 | 921 movff opt_brightness, TXREG1 ; RCREG1=0x2D |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
922 dcfsnz WREG |
159 | 923 movff opt_units, TXREG1 ; RCREG1=0x2E |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
924 dcfsnz WREG |
159 | 925 movff opt_sampling_rate, TXREG1 ; RCREG1=0x2F |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
926 dcfsnz WREG |
159 | 927 movff opt_salinity, TXREG1 ; RCREG1=0x30 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
928 dcfsnz WREG |
159 | 929 movff opt_dive_color_scheme, TXREG1 ; RCREG1=0x31 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
930 dcfsnz WREG |
159 | 931 movff opt_language, TXREG1 ; RCREG1=0x32 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
932 dcfsnz WREG |
159 | 933 movff opt_dateformat, TXREG1 ; RCREG1=0x33 |
92
7ca1105751c7
add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents:
81
diff
changeset
|
934 dcfsnz WREG |
159 | 935 movff opt_compass_gain, TXREG1 ; RCREG1=0x34 |
110 | 936 dcfsnz WREG |
159 | 937 movff opt_pressure_adjust, TXREG1 ; RCREG1=0x35 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
938 dcfsnz WREG |
159 | 939 movff opt_enable_safetystop, TXREG1 ; RCREG1=0x36 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
940 dcfsnz WREG |
159 | 941 movff opt_calibration_O2_ratio, TXREG1; RCREG1=0x37 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
942 dcfsnz WREG |
159 | 943 movff opt_sensor_fallback, TXREG1 ; RCREG1=0x38 |
944 dcfsnz WREG | |
945 movff opt_flip_screen, TXREG1 ; RCREG1=0x39 | |
223 | 946 dcfsnz WREG |
947 movff opt_cR_button_left, TXREG1 ; RCREG1=0x3A | |
948 dcfsnz WREG | |
949 movff opt_cR_button_right, TXREG1 ; RCREG1=0x3B | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
950 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
951 comm_read_abort: |
255 | 952 comm_read_done: |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
953 bra comm_download_mode0 ; Done. Loop with timeout reset |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
954 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
955 comm_read_setting_wait: |
255 | 956 goto rs232_wait_tx ; Wait for UART (and return!) |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
957 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
958 comm_read_gas1: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
959 movff opt_gas_O2_ratio+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
960 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
961 movff opt_gas_He_ratio+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
962 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
963 movff opt_gas_type+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
964 rcall comm_read_setting_wait ; Wait for UART |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
965 movff opt_OC_bail_gas_change+0,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
966 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
967 comm_read_gas2: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
968 movff opt_gas_O2_ratio+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
969 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
970 movff opt_gas_He_ratio+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
971 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
972 movff opt_gas_type+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
973 rcall comm_read_setting_wait ; Wait for UART |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
974 movff opt_OC_bail_gas_change+1,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
975 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
976 comm_read_gas3: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
977 movff opt_gas_O2_ratio+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
978 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
979 movff opt_gas_He_ratio+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
980 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
981 movff opt_gas_type+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
982 rcall comm_read_setting_wait ; Wait for UART |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
983 movff opt_OC_bail_gas_change+2,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
984 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
985 comm_read_gas4: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
986 movff opt_gas_O2_ratio+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
987 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
988 movff opt_gas_He_ratio+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
989 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
990 movff opt_gas_type+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
991 rcall comm_read_setting_wait ; Wait for UART |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
992 movff opt_OC_bail_gas_change+3,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
993 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
994 comm_read_gas5: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
995 movff opt_gas_O2_ratio+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
996 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
997 movff opt_gas_He_ratio+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
998 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
999 movff opt_gas_type+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1000 rcall comm_read_setting_wait ; Wait for UART |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
1001 movff opt_OC_bail_gas_change+4,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1002 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1003 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1004 comm_read_dil1: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1005 movff opt_dil_O2_ratio+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1006 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1007 movff opt_dil_He_ratio+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1008 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1009 movff opt_dil_type+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1010 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1011 movff char_I_dil_change+0,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1012 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1013 comm_read_dil2: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1014 movff opt_dil_O2_ratio+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1015 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1016 movff opt_dil_He_ratio+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1017 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1018 movff opt_dil_type+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1019 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1020 movff char_I_dil_change+1,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1021 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1022 comm_read_dil3: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1023 movff opt_dil_O2_ratio+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1024 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1025 movff opt_dil_He_ratio+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1026 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1027 movff opt_dil_type+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1028 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1029 movff char_I_dil_change+2,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1030 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1031 comm_read_dil4: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1032 movff opt_dil_O2_ratio+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1033 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1034 movff opt_dil_He_ratio+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1035 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1036 movff opt_dil_type+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1037 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1038 movff char_I_dil_change+3,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1039 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1040 comm_read_dil5: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1041 movff opt_dil_O2_ratio+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1042 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1043 movff opt_dil_He_ratio+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1044 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1045 movff opt_dil_type+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1046 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1047 movff char_I_dil_change+4,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1048 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1049 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1050 comm_read_sp1: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1051 movff char_I_setpoint_cbar+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1052 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1053 movff char_I_setpoint_change+0, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1054 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1055 comm_read_sp2: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1056 movff char_I_setpoint_cbar+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1057 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1058 movff char_I_setpoint_change+1, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1059 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1060 comm_read_sp3: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1061 movff char_I_setpoint_cbar+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1062 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1063 movff char_I_setpoint_change+2, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1064 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1065 comm_read_sp4: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1066 movff char_I_setpoint_cbar+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1067 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1068 movff char_I_setpoint_change+3, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1069 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1070 comm_read_sp5: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1071 movff char_I_setpoint_cbar+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1072 rcall comm_read_setting_wait ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1073 movff char_I_setpoint_change+4, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1074 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
110 | 1075 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1076 |
80 | 1077 ;----------------------------------------------------------------------------- |
238 | 1078 comm_write_gas1: |
1079 movff RCREG1,opt_gas_O2_ratio+0 | |
1080 rcall comm_write_get_byte | |
1081 movff RCREG1,opt_gas_He_ratio+0 | |
1082 rcall comm_write_get_byte | |
1083 movff RCREG1,opt_gas_type+0 | |
1084 rcall comm_write_get_byte | |
1085 movff RCREG1,opt_OC_bail_gas_change+0 | |
1086 bra comm_write_abort ; Done. Loop with timeout reset | |
1087 comm_write_gas2: | |
1088 movff RCREG1,opt_gas_O2_ratio+1 | |
1089 rcall comm_write_get_byte | |
1090 movff RCREG1,opt_gas_He_ratio+1 | |
1091 rcall comm_write_get_byte | |
1092 movff RCREG1,opt_gas_type+1 | |
1093 rcall comm_write_get_byte | |
1094 movff RCREG1,opt_OC_bail_gas_change+1 | |
1095 bra comm_write_abort ; Done. Loop with timeout reset | |
1096 comm_write_gas3: | |
1097 movff RCREG1,opt_gas_O2_ratio+2 | |
1098 rcall comm_write_get_byte | |
1099 movff RCREG1,opt_gas_He_ratio+2 | |
1100 rcall comm_write_get_byte | |
1101 movff RCREG1,opt_gas_type+2 | |
1102 rcall comm_write_get_byte | |
1103 movff RCREG1,opt_OC_bail_gas_change+2 | |
1104 bra comm_write_abort ; Done. Loop with timeout reset | |
1105 comm_write_gas4: | |
1106 movff RCREG1,opt_gas_O2_ratio+3 | |
1107 rcall comm_write_get_byte | |
1108 movff RCREG1,opt_gas_He_ratio+3 | |
1109 rcall comm_write_get_byte | |
1110 movff RCREG1,opt_gas_type+3 | |
1111 rcall comm_write_get_byte | |
1112 movff RCREG1,opt_OC_bail_gas_change+3 | |
1113 bra comm_write_abort ; Done. Loop with timeout reset | |
1114 comm_write_gas5: | |
1115 movff RCREG1,opt_gas_O2_ratio+4 | |
1116 rcall comm_write_get_byte | |
1117 movff RCREG1,opt_gas_He_ratio+4 | |
1118 rcall comm_write_get_byte | |
1119 movff RCREG1,opt_gas_type+4 | |
1120 rcall comm_write_get_byte | |
1121 movff RCREG1,opt_OC_bail_gas_change+4 | |
1122 bra comm_write_abort ; Done. Loop with timeout reset | |
80 | 1123 |
1124 | |
1125 comm_write_setting: | |
1126 movlw "w" | |
1127 movwf TXREG1 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1128 rcall comm_write_get_byte ; "Byte 2" |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1129 btfsc rs232_recieve_overflow ; Got byte? |
80 | 1130 bra comm_write_abort ; No, abort! |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1131 movff RCREG1,temp1 ; Copy |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1132 rcall comm_write_get_byte ; "Byte 3" |
238 | 1133 rcall comm_read_setting_wait ; Wait for UART |
1134 movlw 0x0F | |
1135 cpfsgt temp1 ; 0x00-0x0F: unused | |
1136 bra comm_write_abort ; abort! | |
1137 subwf temp1,W ; Subtract unused commands | |
80 | 1138 dcfsnz WREG |
1139 bra comm_write_gas1 ; RCREG1=0x10 | |
1140 dcfsnz WREG | |
1141 bra comm_write_gas2 ; RCREG1=0x11 | |
1142 dcfsnz WREG | |
1143 bra comm_write_gas3 ; RCREG1=0x12 | |
1144 dcfsnz WREG | |
1145 bra comm_write_gas4 ; RCREG1=0x13 | |
1146 dcfsnz WREG | |
1147 bra comm_write_gas5 ; RCREG1=0x14 | |
1148 dcfsnz WREG | |
1149 bra comm_write_dil1 ; RCREG1=0x15 | |
1150 dcfsnz WREG | |
1151 bra comm_write_dil2 ; RCREG1=0x16 | |
1152 dcfsnz WREG | |
1153 bra comm_write_dil3 ; RCREG1=0x17 | |
1154 dcfsnz WREG | |
1155 bra comm_write_dil4 ; RCREG1=0x18 | |
1156 dcfsnz WREG | |
1157 bra comm_write_dil5 ; RCREG1=0x19 | |
1158 dcfsnz WREG | |
1159 bra comm_write_sp1 ; RCREG1=0x1A | |
1160 dcfsnz WREG | |
1161 bra comm_write_sp2 ; RCREG1=0x1B | |
1162 dcfsnz WREG | |
1163 bra comm_write_sp3 ; RCREG1=0x1C | |
1164 dcfsnz WREG | |
1165 bra comm_write_sp4 ; RCREG1=0x1D | |
1166 dcfsnz WREG | |
1167 bra comm_write_sp5 ; RCREG1=0x1E | |
1168 dcfsnz WREG | |
159 | 1169 movff RCREG1, opt_ccr_mode ; RCREG1=0x1F |
80 | 1170 dcfsnz WREG |
159 | 1171 movff RCREG1, opt_dive_mode ; RCREG1=0x20 |
80 | 1172 dcfsnz WREG |
159 | 1173 movff RCREG1, char_I_deco_model ; RCREG1=0x21 |
80 | 1174 dcfsnz WREG |
159 | 1175 movff RCREG1, opt_ppO2_max ; RCREG1=0x22 |
80 | 1176 dcfsnz WREG |
159 | 1177 movff RCREG1, opt_ppO2_min ; RCREG1=0x23 |
80 | 1178 dcfsnz WREG |
159 | 1179 movff RCREG1, char_I_extra_time ; RCREG1=0x24 |
80 | 1180 dcfsnz WREG |
159 | 1181 movff RCREG1, opt_GF_low ; RCREG1=0x25 |
80 | 1182 dcfsnz WREG |
159 | 1183 movff RCREG1, opt_GF_high ; RCREG1=0x26 |
80 | 1184 dcfsnz WREG |
159 | 1185 movff RCREG1, opt_aGF_low ; RCREG1=0x27 |
80 | 1186 dcfsnz WREG |
159 | 1187 movff RCREG1, opt_aGF_high ; RCREG1=0x28 |
80 | 1188 dcfsnz WREG |
159 | 1189 movff RCREG1, opt_enable_aGF ; RCREG1=0x29 |
80 | 1190 dcfsnz WREG |
159 | 1191 movff RCREG1, char_I_saturation_multiplier; RCREG1=0x2A |
80 | 1192 dcfsnz WREG |
159 | 1193 movff RCREG1, char_I_desaturation_multiplier; RCREG1=0x2B |
80 | 1194 dcfsnz WREG |
159 | 1195 movff RCREG1, opt_last_stop ; RCREG1=0x2C |
80 | 1196 dcfsnz WREG |
159 | 1197 movff RCREG1, opt_brightness ; RCREG1=0x2D |
80 | 1198 dcfsnz WREG |
159 | 1199 movff RCREG1, opt_units ; RCREG1=0x2E |
80 | 1200 dcfsnz WREG |
159 | 1201 movff RCREG1, opt_sampling_rate ; RCREG1=0x2F |
80 | 1202 dcfsnz WREG |
159 | 1203 movff RCREG1, opt_salinity ; RCREG1=0x30 |
80 | 1204 dcfsnz WREG |
159 | 1205 movff RCREG1, opt_dive_color_scheme ; RCREG1=0x31 |
80 | 1206 dcfsnz WREG |
159 | 1207 movff RCREG1, opt_language ; RCREG1=0x32 |
80 | 1208 dcfsnz WREG |
159 | 1209 movff RCREG1, opt_dateformat ; RCREG1=0x33 |
92
7ca1105751c7
add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents:
81
diff
changeset
|
1210 dcfsnz WREG |
159 | 1211 movff RCREG1, opt_compass_gain ; RCREG1=0x34 |
110 | 1212 dcfsnz WREG |
159 | 1213 movff RCREG1, opt_pressure_adjust ; RCREG1=0x35 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1214 dcfsnz WREG |
159 | 1215 movff RCREG1, opt_enable_safetystop ; RCREG1=0x36 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1216 dcfsnz WREG |
159 | 1217 movff RCREG1, opt_calibration_O2_ratio; RCREG1=0x37 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1218 dcfsnz WREG |
159 | 1219 movff RCREG1, opt_sensor_fallback ; RCREG1=0x38 |
1220 dcfsnz WREG | |
1221 movff RCREG1, opt_flip_screen ; RCREG1=0x39 | |
223 | 1222 dcfsnz WREG |
1223 movff RCREG1, opt_cR_button_left ; RCREG1=0x3A | |
1224 dcfsnz WREG | |
1225 movff RCREG1, opt_cR_button_right ; RCREG1=0x3B | |
80 | 1226 |
1227 comm_write_abort: | |
81
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
1228 ; Check Options, gases and diluents |
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
1229 call option_check_all ; Check all options (and reset if not within their min/max boundaries) |
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
1230 bsf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
1231 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth |
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
1232 bcf ccr_diluent_setup ; =1: Setting up Diluents ("Gas6-10") |
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
1233 call gaslist_cleanup_list ; Takes care that only one gas can be first and first has 0m change depth |
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
1234 call get_first_gas_to_WREG ; Makes sure at least one Gas is "First" |
8e13866b5496
add some extra safety checks when settings were altered from the PC software
mh@mh-THINK.localdomain
parents:
80
diff
changeset
|
1235 call get_first_dil_to_WREG ; Makes sure at least one Diluent is "First" |
80 | 1236 bra comm_download_mode0 ; Done. Loop with timeout reset |
1237 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1238 comm_write_get_byte: |
80 | 1239 call rs232_get_byte |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1240 return |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1241 |
80 | 1242 comm_write_dil1: |
1243 movff RCREG1,opt_dil_O2_ratio+0 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1244 rcall comm_write_get_byte |
80 | 1245 movff RCREG1,opt_dil_He_ratio+0 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1246 rcall comm_write_get_byte |
80 | 1247 movff RCREG1,opt_dil_type+0 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1248 rcall comm_write_get_byte |
80 | 1249 movff RCREG1,char_I_dil_change+0 |
1250 bra comm_write_abort ; Done. Loop with timeout reset | |
1251 comm_write_dil2: | |
1252 movff RCREG1,opt_dil_O2_ratio+1 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1253 rcall comm_write_get_byte |
80 | 1254 movff RCREG1,opt_dil_He_ratio+1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1255 rcall comm_write_get_byte |
80 | 1256 movff RCREG1,opt_dil_type+1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1257 rcall comm_write_get_byte |
80 | 1258 movff RCREG1,char_I_dil_change+1 |
1259 bra comm_write_abort ; Done. Loop with timeout reset | |
1260 comm_write_dil3: | |
1261 movff RCREG1,opt_dil_O2_ratio+2 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1262 rcall comm_write_get_byte |
80 | 1263 movff RCREG1,opt_dil_He_ratio+2 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1264 rcall comm_write_get_byte |
80 | 1265 movff RCREG1,opt_dil_type+2 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1266 rcall comm_write_get_byte |
80 | 1267 movff RCREG1,char_I_dil_change+2 |
1268 bra comm_write_abort ; Done. Loop with timeout reset | |
1269 comm_write_dil4: | |
1270 movff RCREG1,opt_dil_O2_ratio+3 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1271 rcall comm_write_get_byte |
80 | 1272 movff RCREG1,opt_dil_He_ratio+3 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1273 rcall comm_write_get_byte |
80 | 1274 movff RCREG1,opt_dil_type+3 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1275 rcall comm_write_get_byte |
80 | 1276 movff RCREG1,char_I_dil_change+3 |
1277 bra comm_write_abort ; Done. Loop with timeout reset | |
1278 comm_write_dil5: | |
1279 movff RCREG1,opt_dil_O2_ratio+4 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1280 rcall comm_write_get_byte |
80 | 1281 movff RCREG1,opt_dil_He_ratio+4 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1282 rcall comm_write_get_byte |
80 | 1283 movff RCREG1,opt_dil_type+4 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1284 rcall comm_write_get_byte |
80 | 1285 movff RCREG1,char_I_dil_change+4 |
1286 bra comm_write_abort ; Done. Loop with timeout reset | |
1287 | |
1288 comm_write_sp1: | |
1289 movff RCREG1,char_I_setpoint_cbar+0 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1290 rcall comm_write_get_byte |
80 | 1291 movff RCREG1,char_I_setpoint_change+0 |
1292 bra comm_write_abort ; Done. Loop with timeout reset | |
1293 comm_write_sp2: | |
1294 movff RCREG1,char_I_setpoint_cbar+1 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1295 rcall comm_write_get_byte |
80 | 1296 movff RCREG1,char_I_setpoint_change+1 |
1297 bra comm_write_abort ; Done. Loop with timeout reset | |
1298 comm_write_sp3: | |
1299 movff RCREG1,char_I_setpoint_cbar+2 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1300 rcall comm_write_get_byte |
80 | 1301 movff RCREG1,char_I_setpoint_change+2 |
1302 bra comm_write_abort ; Done. Loop with timeout reset | |
1303 comm_write_sp4: | |
1304 movff RCREG1,char_I_setpoint_cbar+3 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1305 rcall comm_write_get_byte |
80 | 1306 movff RCREG1,char_I_setpoint_change+3 |
1307 bra comm_write_abort ; Done. Loop with timeout reset | |
1308 comm_write_sp5: | |
1309 movff RCREG1,char_I_setpoint_cbar+4 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1310 rcall comm_write_get_byte |
80 | 1311 movff RCREG1,char_I_setpoint_change+4 |
1312 bra comm_write_abort ; Done. Loop with timeout reset | |
1313 | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1314 ;----------------------------------------------------------------------------- |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1315 |
0 | 1316 comm_send_string: |
1317 movlw "n" ; send echo | |
1318 movwf TXREG1 | |
1319 call rs232_wait_tx ; Wait for UART | |
1320 WIN_SMALL comm_string_column, comm_string_row | |
1321 movlw .16 | |
1322 movwf lo ; counter | |
1323 comm_send_string_loop: | |
1324 call rs232_get_byte | |
1325 btfsc rs232_recieve_overflow ; Got byte? | |
1326 bra comm_send_string_abort ; No, abort! | |
1327 movff RCREG1,POSTINC2 ; Store character | |
1328 decfsz lo,F | |
1329 bra comm_send_string_loop | |
1330 comm_send_string_abort: | |
1331 STRCAT_PRINT "" ; Show the text | |
80 | 1332 goto comm_download_mode0 ; Done. Loop with timeout reset |
0 | 1333 |
1334 ;----------------------------------------------------------------------------- | |
1335 | |
1336 comm_check_day: | |
1337 movff RCREG1, day | |
1338 movff month,lo ; new month | |
1339 dcfsnz lo,F | |
1340 movlw .31 | |
1341 dcfsnz lo,F | |
1342 movlw .28 | |
1343 dcfsnz lo,F | |
1344 movlw .31 | |
1345 dcfsnz lo,F | |
1346 movlw .30 | |
1347 dcfsnz lo,F | |
1348 movlw .31 | |
1349 dcfsnz lo,F | |
1350 movlw .30 | |
1351 dcfsnz lo,F | |
1352 movlw .31 | |
1353 dcfsnz lo,F | |
1354 movlw .31 | |
1355 dcfsnz lo,F | |
1356 movlw .30 | |
1357 dcfsnz lo,F | |
1358 movlw .31 | |
1359 dcfsnz lo,F | |
1360 movlw .30 | |
1361 dcfsnz lo,F | |
1362 movlw .31 | |
1363 cpfsgt day ; day ok? | |
1364 return ; OK | |
1365 movlw .1 ; not OK, set to 1st | |
1366 movwf day | |
1367 return | |
1368 | |
1369 ;---------------------------------------------------------------------------- | |
1370 END |