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