Mercurial > public > hwos_code
annotate src/comm.asm @ 235:23311219dacc
under construction: new hardware_flag to configure different hardware versions
author | heinrichsweikamp |
---|---|
date | Wed, 25 Feb 2015 16:49:59 +0100 |
parents | 940155e9aefb |
children | 49512af55afc |
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 | |
218 | 55 global comm_mode, comm_mode0 |
0 | 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 | |
218 | 63 comm_mode0: |
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: | |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
97 btfsc rechargeable |
150 | 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. | |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
487 movlw "j" |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
488 cpfseq RCREG1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
489 bra $+4 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
490 bra comm_hardware_descriptor ; Send hardware descriptor byte |
0 | 491 movlw "n" |
492 cpfseq RCREG1 | |
493 bra $+4 | |
80 | 494 goto comm_send_string ; Send a 15byte string to the screen |
0 | 495 movlw "l" |
496 cpfseq RCREG1 | |
497 bra $+4 | |
498 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
|
499 movlw "r" |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
500 cpfseq RCREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
501 bra $+4 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
502 bra comm_read_setting ; Read a setting (And send via USB) |
80 | 503 movlw "w" |
504 cpfseq RCREG1 | |
505 bra $+4 | |
506 bra comm_write_setting ; Write a setting (Into RAM) | |
507 movlw "x" | |
508 cpfseq RCREG1 | |
509 bra $+4 | |
510 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
|
511 |
0 | 512 |
513 btfss comm_service_enabled ; Done for Download mode | |
514 bra comm_download_mode0 ; Loop with timeout reset | |
515 | |
516 movlw 0x20 | |
517 cpfseq RCREG1 | |
518 bra $+4 | |
519 bra comm_send_range ; send hi:lo:temp1 bytes starting from ext_flash_address:3 | |
520 movlw 0x22 | |
521 cpfseq RCREG1 | |
522 bra $+4 | |
523 bra comm_reset_logbook_pointers ; Resets all logbook pointers and the logbook (!) | |
524 movlw 0x23 | |
525 cpfseq RCREG1 | |
526 bra $+4 | |
527 bra comm_reset_battery_gauge ; Resets battery gauge registers | |
528 movlw 0x30 | |
529 cpfseq RCREG1 | |
530 bra $+4 | |
531 bra comm_write_range ; write bytes starting from ext_flash_address:3 (Stop when timeout) | |
532 movlw 0x40 | |
533 cpfseq RCREG1 | |
534 bra $+4 | |
535 bra comm_erase_4kb ; erases 4kB block from ext_flash_address:3 (Warning: No confirmation or built-in security here...) | |
536 movlw 0x42 | |
537 cpfseq RCREG1 | |
538 bra $+4 | |
539 bra comm_erase_range4kb ; erases range in 4kB steps (Get 3 bytes address and 1byte amount of 4kB blocks) | |
540 movlw 0x50 | |
541 cpfseq RCREG1 | |
542 bra $+4 | |
543 bra comm_send_firmware ; sends firmware from external flash from 0x3E0000 to 0x3FD000 (118784bytes) via comm | |
147 | 544 ; movlw "t" |
545 ; cpfseq RCREG1 | |
546 ; bra $+4 | |
547 ; goto testloop ; Start raw-data testloop | |
0 | 548 movlw 0xC1 |
549 cpfseq RCREG1 | |
550 bra $+4 | |
551 bra comm_service_ll_bootloader ; Start low-level bootloader | |
552 bra comm_download_mode0 ; Loop with timeout reset | |
553 | |
554 ;----------------------------------------------------------------------------- | |
555 | |
556 comm_send_headers: | |
557 movlw "a" ; send echo | |
558 movwf TXREG1 | |
559 ; Send 256 bytes/dive (Header) | |
560 ; 1st: 200000h-2000FFh | |
561 ; 2nd: 201000h-2010FFh | |
562 ; 3rd: 202000h-2020FFh | |
563 ; 100: 264000h-2640FFh | |
564 ; 256: 2FF000h-2FF0FFh | |
565 movlw 0x1F | |
566 movwf ext_flash_address+2 | |
567 movlw 0xF0 | |
568 movwf ext_flash_address+1 | |
569 | |
570 comm_send_headers2: | |
571 movlw 0x00 | |
572 movwf ext_flash_address+0 | |
573 ; Adjust address for next dive | |
574 movlw 0x10 | |
575 addwf ext_flash_address+1 | |
576 movlw 0x00 | |
577 addwfc ext_flash_address+2 | |
578 | |
579 movlw 0x30 | |
580 cpfseq ext_flash_address+2 ; All 256 dive send? | |
581 bra comm_send_headers4 ; No, continue | |
582 bra comm_download_mode0 ; Done. Loop with timeout reset | |
583 | |
584 comm_send_headers4: | |
585 clrf lo ; Counter | |
586 call rs232_wait_tx ; Wait for UART | |
587 call ext_flash_read_block_start ; 1st byte | |
588 movwf TXREG1 | |
589 bra comm_send_headers3 ; counter 24bit | |
590 comm_send_headers_loop: | |
591 call ext_flash_read_block ; Read one byte | |
592 movwf TXREG1 ; Start new transmit | |
593 comm_send_headers3: | |
594 call rs232_wait_tx ; Wait for UART | |
595 decfsz lo,F | |
596 bra comm_send_headers_loop | |
597 call ext_flash_read_block_stop | |
598 bra comm_send_headers2 ; continue | |
599 | |
600 ;----------------------------------------------------------------------------- | |
80 | 601 |
602 comm_option_reset_all: ; Reset all options to factory default. | |
603 movlw "x" ; send echo | |
604 movwf TXREG1 | |
605 call option_reset_all | |
606 bra comm_download_mode0 ; Done. back to loop with timeout reset | |
607 | |
608 ;----------------------------------------------------------------------------- | |
0 | 609 |
610 comm_set_time: | |
611 movlw "b" ; send echo | |
612 movwf TXREG1 | |
613 | |
614 call rs232_wait_tx ; wait for UART | |
615 call rs232_get_byte | |
616 btfsc rs232_recieve_overflow ; Got byte? | |
128
bd74161c4292
catch timeout during set time/date command
heinrichsweikamp
parents:
124
diff
changeset
|
617 bra comm_download_mode0 ; No, abort |
0 | 618 movff RCREG1, hours |
619 movlw d'24' | |
620 cpfslt hours | |
621 clrf hours | |
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, mins |
626 movlw d'60' | |
627 cpfslt mins | |
628 clrf mins | |
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, secs |
633 movlw d'60' | |
634 cpfslt secs | |
635 clrf secs | |
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, month |
640 movlw d'13' | |
641 cpfslt month | |
642 movwf month | |
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 |
92
7ca1105751c7
add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents:
81
diff
changeset
|
646 call comm_check_day ; Check day |
0 | 647 call rs232_get_byte |
648 btfsc rs232_recieve_overflow ; Got byte? | |
128
bd74161c4292
catch timeout during set time/date command
heinrichsweikamp
parents:
124
diff
changeset
|
649 bra comm_download_mode0 ; No, abort |
0 | 650 movff RCREG1, year |
651 movlw d'100' | |
652 cpfslt year | |
653 clrf year | |
654 ; All ok, set RTCC | |
655 call rtc_set_rtc ; writes mins,sec,hours,day,month and year to rtc module | |
656 bra comm_download_mode0 ; Done. back to loop with timeout reset | |
657 | |
658 ;----------------------------------------------------------------------------- | |
659 ; Set OSTC3 custom text string (opt_name_length ascii chars). | |
660 ; | |
661 | |
662 comm_set_custom_text: | |
663 movlw "c" ; send echo | |
664 movwf TXREG1 | |
665 call rs232_wait_tx ; wait for UART | |
666 lfsr FSR2,opt_name | |
667 movlw opt_name_length | |
668 movwf lo ; counter | |
669 comm_set_ctext_loop: | |
670 call rs232_get_byte | |
671 btfsc rs232_recieve_overflow ; Got byte? | |
136 | 672 bra comm_set_ctext_loop_done ; no, abort |
7 | 673 movff RCREG1,POSTINC2 ; Store character |
0 | 674 decfsz lo,F |
675 bra comm_set_ctext_loop | |
136 | 676 comm_set_ctext_loop_done: |
677 tstfsz lo ; Got opt_name_length bytes? | |
678 bra comm_set_ctext_loop_done2 ; no, clear remaining chars | |
679 bra comm_download_mode0 ; Done. Loop with timeout reset | |
680 comm_set_ctext_loop_done2: | |
681 clrf POSTINC2 | |
682 decfsz lo,F | |
683 bra comm_set_ctext_loop_done2 | |
7 | 684 bra comm_download_mode0 ; Done. Loop with timeout reset |
0 | 685 |
686 ;----------------------------------------------------------------------------- | |
687 ; Reply Serial (2 bytes low:high), firmware (major.minor) and custom text. | |
688 ; | |
689 | |
690 comm_identify: | |
691 movlw "i" ; send echo | |
692 movwf TXREG1 | |
693 call rs232_wait_tx ; wait for UART | |
694 | |
695 ;---- Read serial from internal EEPROM address 0000 | |
696 clrf EEADRH | |
697 clrf EEADR ; Get Serial number LOW | |
698 call read_eeprom ; read byte | |
699 movff EEDATA,lo | |
700 incf EEADR,F ; Get Serial number HIGH | |
701 call read_eeprom ; read byte | |
702 movff EEDATA,hi | |
703 | |
704 ;---- Emit serial number | |
705 movff lo,TXREG1 | |
706 call rs232_wait_tx | |
707 movff hi,TXREG1 | |
708 call rs232_wait_tx | |
709 | |
710 ;---- Emit fiwmware hi.lo | |
711 movlw softwareversion_x | |
712 movwf TXREG1 | |
713 call rs232_wait_tx | |
714 movlw softwareversion_y | |
715 movwf TXREG1 | |
716 call rs232_wait_tx | |
717 | |
718 ;---- Emit custom text | |
719 movlw opt_name_length | |
720 movwf hi | |
721 lfsr FSR2,opt_name | |
722 | |
723 common_identify_loop: | |
724 movff POSTINC2,TXREG1 | |
725 call rs232_wait_tx | |
726 decfsz hi,F | |
727 bra common_identify_loop | |
728 | |
729 bra comm_download_mode0 ; Done. | |
730 | |
235
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
731 ;----------------------------------------------------------------------------- |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
732 ; Reply hardware descriptor byte |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
733 ; |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
734 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
735 comm_hardware_descriptor: |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
736 movlw "j" ; send echo |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
737 movwf TXREG1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
738 call rs232_wait_tx ; wait for UART |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
739 movff hardware_flag,TXREG1 |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
740 call rs232_wait_tx ; wait for UART |
23311219dacc
under construction: new hardware_flag to configure different hardware versions
heinrichsweikamp
parents:
223
diff
changeset
|
741 bra comm_download_mode0 ; Done. |
0 | 742 |
743 ;----------------------------------------------------------------------------- | |
744 | |
745 comm_send_dive: | |
746 movlw "f" ; send echo | |
747 movwf TXREG1 | |
748 | |
749 call rs232_get_byte | |
750 btfsc rs232_recieve_overflow ; Got byte? | |
751 bra comm_download_mode0 ; No, abort! | |
752 movff RCREG1,lo ; Store dive number (0-255) | |
753 ; First, send the header (again) | |
754 ; Set ext_flash_address:3 to TOC entry of this dive | |
755 ; 1st: 200000h-200FFFh -> lo=0 | |
756 ; 2nd: 201000h-201FFFh -> lo=1 | |
757 ; 3rd: 202000h-202FFFh -> lo=2 | |
758 ; 256: 2FF000h-2FFFFFh -> lo=255 | |
759 clrf ext_flash_address+0 | |
760 clrf ext_flash_address+1 | |
761 movlw 0x20 | |
762 movwf ext_flash_address+2 | |
763 movlw .16 | |
764 mulwf lo ; lo*16 = offset to 0x2000 (up:hi) | |
765 movf PRODL,W | |
766 addwf ext_flash_address+1,F | |
767 movf PRODH,W | |
768 addwfc ext_flash_address+2,F | |
769 | |
770 incf_ext_flash_address d'2' ; Skip 0xFA, 0xFA | |
771 call ext_flash_byte_read_plus ; Read start address of profile | |
772 movff temp1,ext_flash_log_pointer+0 | |
773 call ext_flash_byte_read_plus ; Read start address of profile | |
774 movff temp1,ext_flash_log_pointer+1 | |
775 call ext_flash_byte_read_plus ; Read start address of profile | |
776 movff temp1,ext_flash_log_pointer+2 | |
777 call ext_flash_byte_read_plus ; Read end address of profile | |
778 movff temp1,convert_value_temp+0 | |
779 call ext_flash_byte_read_plus ; Read end address of profile | |
780 movff temp1,convert_value_temp+1 | |
781 call ext_flash_byte_read_plus ; Read end address of profile | |
782 movff temp1,convert_value_temp+2 | |
783 decf_ext_flash_address d'8' ; Back again to first 0xFA in header | |
784 | |
785 movf ext_flash_log_pointer+0,W | |
786 cpfseq convert_value_temp+0 ; Equal? | |
787 bra comm_send_dive1 ; No, Send header | |
788 | |
789 movf ext_flash_log_pointer+1,W | |
790 cpfseq convert_value_temp+1 ; Equal? | |
791 bra comm_send_dive1 ; No, Send header | |
792 | |
793 movf ext_flash_log_pointer+2,W | |
794 cpfseq convert_value_temp+2 ; Equal? | |
795 bra comm_send_dive1 ; No, Send header | |
796 | |
797 ; Start=End -> Not good, abort | |
798 bra comm_download_mode0 ; Done. Loop with timeout reset | |
799 | |
800 comm_send_dive1: | |
801 ; Send header | |
802 clrf hi ; Counter | |
803 call rs232_wait_tx ; Wait for UART | |
804 call ext_flash_read_block_start ; 1st byte | |
805 movwf TXREG1 | |
806 bra comm_send_dive_header | |
807 comm_send_dive_header2: | |
808 call ext_flash_read_block ; Read one byte | |
809 movwf TXREG1 ; Start new transmit | |
810 comm_send_dive_header: | |
811 call rs232_wait_tx ; Wait for UART | |
812 decfsz hi,F | |
813 bra comm_send_dive_header2 | |
814 call ext_flash_read_block_stop | |
815 | |
816 ; Set address for profile | |
817 movff ext_flash_log_pointer+0,ext_flash_address+0 | |
818 movff ext_flash_log_pointer+1,ext_flash_address+1 | |
819 movff ext_flash_log_pointer+2,ext_flash_address+2 | |
820 | |
821 movlw .6 ; Skip 6byte short header in profile - only for internal use | |
822 call incf_ext_flash_address0_0x20 ; increases bytes in ext_flash_address:3 with 0x200000 bank switching | |
823 | |
824 comm_send_dive_profile: | |
825 call ext_flash_byte_read_plus_0x20 ; Read one byte into temp1, takes care of banking at 0x200000 | |
826 call rs232_wait_tx ; Wait for UART | |
827 movff temp1,TXREG1 ; Send a byte | |
828 | |
829 ; 24bit compare with end address | |
830 movff convert_value_temp+0,WREG | |
831 cpfseq ext_flash_address+0 | |
832 bra comm_send_dive_profile | |
833 movff convert_value_temp+1,WREG | |
834 cpfseq ext_flash_address+1 | |
835 bra comm_send_dive_profile | |
836 movff convert_value_temp+2,WREG | |
837 cpfseq ext_flash_address+2 | |
838 bra comm_send_dive_profile | |
839 | |
840 call rs232_wait_tx ; Wait for UART | |
841 bra comm_download_mode0 ; Done. Loop with timeout reset | |
842 | |
843 ;----------------------------------------------------------------------------- | |
844 | |
159 | 845 comm_read_unused: |
846 bra comm_download_mode0 ; Done. Loop with timeout reset | |
847 | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
848 comm_read_setting: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
849 movlw "r" |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
850 movwf TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
851 call rs232_get_byte |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
852 btfsc rs232_recieve_overflow ; Got byte? |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
853 bra comm_read_abort ; No, abort! |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
854 call rs232_wait_tx ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
855 movf RCREG1,W ; Copy |
159 | 856 bz comm_read_unused ; RCREG1=0x00 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
857 dcfsnz WREG |
159 | 858 bra comm_read_unused ; RCREG1=0x01 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
859 dcfsnz WREG |
159 | 860 bra comm_read_unused ; RCREG1=0x02 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
861 dcfsnz WREG |
159 | 862 bra comm_read_unused ; RCREG1=0x03 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
863 dcfsnz WREG |
159 | 864 bra comm_read_unused ; RCREG1=0x04 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
865 dcfsnz WREG |
159 | 866 bra comm_read_unused ; RCREG1=0x05 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
867 dcfsnz WREG |
159 | 868 bra comm_read_unused ; RCREG1=0x06 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
869 dcfsnz WREG |
159 | 870 bra comm_read_unused ; RCREG1=0x07 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
871 dcfsnz WREG |
159 | 872 bra comm_read_unused ; RCREG1=0x08 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
873 dcfsnz WREG |
159 | 874 bra comm_read_unused ; RCREG1=0x09 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
875 dcfsnz WREG |
159 | 876 bra comm_read_unused ; RCREG1=0x0A |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
877 dcfsnz WREG |
159 | 878 bra comm_read_unused ; RCREG1=0x0B |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
879 dcfsnz WREG |
159 | 880 bra comm_read_unused ; RCREG1=0x0C |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
881 dcfsnz WREG |
159 | 882 bra comm_read_unused ; RCREG1=0x0D |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
883 dcfsnz WREG |
159 | 884 bra comm_read_unused ; RCREG1=0x0E |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
885 dcfsnz WREG |
159 | 886 bra comm_read_unused ; RCREG1=0x0F |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
887 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
888 bra comm_read_gas1 ; RCREG1=0x10 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
889 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
890 bra comm_read_gas2 ; RCREG1=0x11 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
891 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
892 bra comm_read_gas3 ; RCREG1=0x12 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
893 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
894 bra comm_read_gas4 ; RCREG1=0x13 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
895 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
896 bra comm_read_gas5 ; RCREG1=0x14 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
897 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
898 bra comm_read_dil1 ; RCREG1=0x15 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
899 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
900 bra comm_read_dil2 ; RCREG1=0x16 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
901 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
902 bra comm_read_dil3 ; RCREG1=0x17 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
903 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
904 bra comm_read_dil4 ; RCREG1=0x18 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
905 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
906 bra comm_read_dil5 ; RCREG1=0x19 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
907 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
908 bra comm_read_sp1 ; RCREG1=0x1A |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
909 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
910 bra comm_read_sp2 ; RCREG1=0x1B |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
911 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
912 bra comm_read_sp3 ; RCREG1=0x1C |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
913 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
914 bra comm_read_sp4 ; RCREG1=0x1D |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
915 dcfsnz WREG |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
916 bra comm_read_sp5 ; RCREG1=0x1E |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
917 dcfsnz WREG |
159 | 918 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
|
919 dcfsnz WREG |
159 | 920 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
|
921 dcfsnz WREG |
159 | 922 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
|
923 dcfsnz WREG |
159 | 924 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
|
925 dcfsnz WREG |
159 | 926 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
|
927 dcfsnz WREG |
159 | 928 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
|
929 dcfsnz WREG |
159 | 930 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
|
931 dcfsnz WREG |
159 | 932 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
|
933 dcfsnz WREG |
159 | 934 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
|
935 dcfsnz WREG |
159 | 936 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
|
937 dcfsnz WREG |
159 | 938 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
|
939 dcfsnz WREG |
159 | 940 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
|
941 dcfsnz WREG |
159 | 942 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
|
943 dcfsnz WREG |
159 | 944 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
|
945 dcfsnz WREG |
159 | 946 movff opt_brightness, TXREG1 ; RCREG1=0x2D |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
947 dcfsnz WREG |
159 | 948 movff opt_units, TXREG1 ; RCREG1=0x2E |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
949 dcfsnz WREG |
159 | 950 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
|
951 dcfsnz WREG |
159 | 952 movff opt_salinity, TXREG1 ; RCREG1=0x30 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
953 dcfsnz WREG |
159 | 954 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
|
955 dcfsnz WREG |
159 | 956 movff opt_language, TXREG1 ; RCREG1=0x32 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
957 dcfsnz WREG |
159 | 958 movff opt_dateformat, TXREG1 ; RCREG1=0x33 |
92
7ca1105751c7
add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents:
81
diff
changeset
|
959 dcfsnz WREG |
159 | 960 movff opt_compass_gain, TXREG1 ; RCREG1=0x34 |
110 | 961 dcfsnz WREG |
159 | 962 movff opt_pressure_adjust, TXREG1 ; RCREG1=0x35 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
963 dcfsnz WREG |
159 | 964 movff opt_enable_safetystop, TXREG1 ; RCREG1=0x36 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
965 dcfsnz WREG |
159 | 966 movff opt_calibration_O2_ratio, TXREG1; RCREG1=0x37 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
967 dcfsnz WREG |
159 | 968 movff opt_sensor_fallback, TXREG1 ; RCREG1=0x38 |
969 dcfsnz WREG | |
970 movff opt_flip_screen, TXREG1 ; RCREG1=0x39 | |
223 | 971 dcfsnz WREG |
972 movff opt_cR_button_left, TXREG1 ; RCREG1=0x3A | |
973 dcfsnz WREG | |
974 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
|
975 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
976 comm_read_abort: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
977 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
|
978 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
979 comm_read_setting_wait: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
980 call rs232_wait_tx ; Wait for UART |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
981 return |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
982 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
983 comm_read_done: |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
984 call rs232_wait_tx ; Wait for UART |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
985 bra comm_download_mode0 ; Done. Loop with timeout reset |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
986 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
987 comm_read_gas1: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
988 movff opt_gas_O2_ratio+0, 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_He_ratio+0, 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 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
992 movff opt_gas_type+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
993 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
|
994 movff opt_OC_bail_gas_change+0,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
995 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
|
996 comm_read_gas2: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
997 movff opt_gas_O2_ratio+1, 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_He_ratio+1, 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 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1001 movff opt_gas_type+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1002 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
|
1003 movff opt_OC_bail_gas_change+1,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1004 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
|
1005 comm_read_gas3: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1006 movff opt_gas_O2_ratio+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1007 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
|
1008 movff opt_gas_He_ratio+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1009 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
|
1010 movff opt_gas_type+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1011 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
|
1012 movff opt_OC_bail_gas_change+2,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1013 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
|
1014 comm_read_gas4: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1015 movff opt_gas_O2_ratio+3, 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_gas_He_ratio+3, 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_gas_type+3, 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 |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
1021 movff opt_OC_bail_gas_change+3,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_gas5: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1024 movff opt_gas_O2_ratio+4, 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_gas_He_ratio+4, 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_gas_type+4, 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 |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
1030 movff opt_OC_bail_gas_change+4,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 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1033 comm_read_dil1: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1034 movff opt_dil_O2_ratio+0, 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_He_ratio+0, 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 opt_dil_type+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1039 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
|
1040 movff char_I_dil_change+0,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1041 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
|
1042 comm_read_dil2: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1043 movff opt_dil_O2_ratio+1, 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_He_ratio+1, 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 opt_dil_type+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1048 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
|
1049 movff char_I_dil_change+1,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1050 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
|
1051 comm_read_dil3: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1052 movff opt_dil_O2_ratio+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1053 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
|
1054 movff opt_dil_He_ratio+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1055 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
|
1056 movff opt_dil_type+2, 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_dil_change+2,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_dil4: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1061 movff opt_dil_O2_ratio+3, 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 opt_dil_He_ratio+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1064 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
|
1065 movff opt_dil_type+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1066 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
|
1067 movff char_I_dil_change+3,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1068 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
|
1069 comm_read_dil5: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1070 movff opt_dil_O2_ratio+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1071 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
|
1072 movff opt_dil_He_ratio+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1073 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
|
1074 movff opt_dil_type+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1075 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
|
1076 movff char_I_dil_change+4,TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1077 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
|
1078 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1079 comm_read_sp1: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1080 movff char_I_setpoint_cbar+0, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1081 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
|
1082 movff char_I_setpoint_change+0, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1083 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
|
1084 comm_read_sp2: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1085 movff char_I_setpoint_cbar+1, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1086 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
|
1087 movff char_I_setpoint_change+1, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1088 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
|
1089 comm_read_sp3: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1090 movff char_I_setpoint_cbar+2, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1091 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
|
1092 movff char_I_setpoint_change+2, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1093 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
|
1094 comm_read_sp4: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1095 movff char_I_setpoint_cbar+3, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1096 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
|
1097 movff char_I_setpoint_change+3, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1098 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
|
1099 comm_read_sp5: |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1100 movff char_I_setpoint_cbar+4, TXREG1 |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1101 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
|
1102 movff char_I_setpoint_change+4, TXREG1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1103 bra comm_read_done ; Done. Wait for UART and loop with timeout reset |
110 | 1104 |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1105 |
80 | 1106 ;----------------------------------------------------------------------------- |
1107 | |
159 | 1108 comm_write_unused: |
1109 goto comm_write_abort | |
80 | 1110 |
1111 comm_write_setting: | |
1112 movlw "w" | |
1113 movwf TXREG1 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1114 rcall comm_write_get_byte ; "Byte 2" |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1115 btfsc rs232_recieve_overflow ; Got byte? |
80 | 1116 bra comm_write_abort ; No, abort! |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1117 movff RCREG1,temp1 ; Copy |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1118 rcall comm_write_get_byte ; "Byte 3" |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1119 call rs232_wait_tx ; Wait for UART |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1120 movf temp1,W |
159 | 1121 bz comm_write_unused ; RCREG1=0x00 |
80 | 1122 dcfsnz WREG |
159 | 1123 bra comm_write_unused ; RCREG1=0x01 |
80 | 1124 dcfsnz WREG |
159 | 1125 bra comm_write_unused ; RCREG1=0x02 |
80 | 1126 dcfsnz WREG |
159 | 1127 bra comm_write_unused ; RCREG1=0x03 |
80 | 1128 dcfsnz WREG |
159 | 1129 bra comm_write_unused ; RCREG1=0x04 |
80 | 1130 dcfsnz WREG |
159 | 1131 bra comm_write_unused ; RCREG1=0x05 |
80 | 1132 dcfsnz WREG |
159 | 1133 bra comm_write_unused ; RCREG1=0x06 |
80 | 1134 dcfsnz WREG |
159 | 1135 bra comm_write_unused ; RCREG1=0x07 |
80 | 1136 dcfsnz WREG |
159 | 1137 bra comm_write_unused ; RCREG1=0x08 |
80 | 1138 dcfsnz WREG |
159 | 1139 bra comm_write_unused ; RCREG1=0x09 |
80 | 1140 dcfsnz WREG |
159 | 1141 bra comm_write_unused ; RCREG1=0x0A |
80 | 1142 dcfsnz WREG |
159 | 1143 bra comm_write_unused ; RCREG1=0x0B |
80 | 1144 dcfsnz WREG |
159 | 1145 bra comm_write_unused ; RCREG1=0x0C |
80 | 1146 dcfsnz WREG |
159 | 1147 bra comm_write_unused ; RCREG1=0x0D |
80 | 1148 dcfsnz WREG |
159 | 1149 bra comm_write_unused ; RCREG1=0x0E |
80 | 1150 dcfsnz WREG |
159 | 1151 bra comm_write_unused ; RCREG1=0x0F |
80 | 1152 dcfsnz WREG |
1153 bra comm_write_gas1 ; RCREG1=0x10 | |
1154 dcfsnz WREG | |
1155 bra comm_write_gas2 ; RCREG1=0x11 | |
1156 dcfsnz WREG | |
1157 bra comm_write_gas3 ; RCREG1=0x12 | |
1158 dcfsnz WREG | |
1159 bra comm_write_gas4 ; RCREG1=0x13 | |
1160 dcfsnz WREG | |
1161 bra comm_write_gas5 ; RCREG1=0x14 | |
1162 dcfsnz WREG | |
1163 bra comm_write_dil1 ; RCREG1=0x15 | |
1164 dcfsnz WREG | |
1165 bra comm_write_dil2 ; RCREG1=0x16 | |
1166 dcfsnz WREG | |
1167 bra comm_write_dil3 ; RCREG1=0x17 | |
1168 dcfsnz WREG | |
1169 bra comm_write_dil4 ; RCREG1=0x18 | |
1170 dcfsnz WREG | |
1171 bra comm_write_dil5 ; RCREG1=0x19 | |
1172 dcfsnz WREG | |
1173 bra comm_write_sp1 ; RCREG1=0x1A | |
1174 dcfsnz WREG | |
1175 bra comm_write_sp2 ; RCREG1=0x1B | |
1176 dcfsnz WREG | |
1177 bra comm_write_sp3 ; RCREG1=0x1C | |
1178 dcfsnz WREG | |
1179 bra comm_write_sp4 ; RCREG1=0x1D | |
1180 dcfsnz WREG | |
1181 bra comm_write_sp5 ; RCREG1=0x1E | |
1182 dcfsnz WREG | |
159 | 1183 movff RCREG1, opt_ccr_mode ; RCREG1=0x1F |
80 | 1184 dcfsnz WREG |
159 | 1185 movff RCREG1, opt_dive_mode ; RCREG1=0x20 |
80 | 1186 dcfsnz WREG |
159 | 1187 movff RCREG1, char_I_deco_model ; RCREG1=0x21 |
80 | 1188 dcfsnz WREG |
159 | 1189 movff RCREG1, opt_ppO2_max ; RCREG1=0x22 |
80 | 1190 dcfsnz WREG |
159 | 1191 movff RCREG1, opt_ppO2_min ; RCREG1=0x23 |
80 | 1192 dcfsnz WREG |
159 | 1193 movff RCREG1, char_I_extra_time ; RCREG1=0x24 |
80 | 1194 dcfsnz WREG |
159 | 1195 movff RCREG1, opt_GF_low ; RCREG1=0x25 |
80 | 1196 dcfsnz WREG |
159 | 1197 movff RCREG1, opt_GF_high ; RCREG1=0x26 |
80 | 1198 dcfsnz WREG |
159 | 1199 movff RCREG1, opt_aGF_low ; RCREG1=0x27 |
80 | 1200 dcfsnz WREG |
159 | 1201 movff RCREG1, opt_aGF_high ; RCREG1=0x28 |
80 | 1202 dcfsnz WREG |
159 | 1203 movff RCREG1, opt_enable_aGF ; RCREG1=0x29 |
80 | 1204 dcfsnz WREG |
159 | 1205 movff RCREG1, char_I_saturation_multiplier; RCREG1=0x2A |
80 | 1206 dcfsnz WREG |
159 | 1207 movff RCREG1, char_I_desaturation_multiplier; RCREG1=0x2B |
80 | 1208 dcfsnz WREG |
159 | 1209 movff RCREG1, opt_last_stop ; RCREG1=0x2C |
80 | 1210 dcfsnz WREG |
159 | 1211 movff RCREG1, opt_brightness ; RCREG1=0x2D |
80 | 1212 dcfsnz WREG |
159 | 1213 movff RCREG1, opt_units ; RCREG1=0x2E |
80 | 1214 dcfsnz WREG |
159 | 1215 movff RCREG1, opt_sampling_rate ; RCREG1=0x2F |
80 | 1216 dcfsnz WREG |
159 | 1217 movff RCREG1, opt_salinity ; RCREG1=0x30 |
80 | 1218 dcfsnz WREG |
159 | 1219 movff RCREG1, opt_dive_color_scheme ; RCREG1=0x31 |
80 | 1220 dcfsnz WREG |
159 | 1221 movff RCREG1, opt_language ; RCREG1=0x32 |
80 | 1222 dcfsnz WREG |
159 | 1223 movff RCREG1, opt_dateformat ; RCREG1=0x33 |
92
7ca1105751c7
add sensor calibration option (PC only), some cleanup
heinrichsweikamp
parents:
81
diff
changeset
|
1224 dcfsnz WREG |
159 | 1225 movff RCREG1, opt_compass_gain ; RCREG1=0x34 |
110 | 1226 dcfsnz WREG |
159 | 1227 movff RCREG1, opt_pressure_adjust ; RCREG1=0x35 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1228 dcfsnz WREG |
159 | 1229 movff RCREG1, opt_enable_safetystop ; RCREG1=0x36 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1230 dcfsnz WREG |
159 | 1231 movff RCREG1, opt_calibration_O2_ratio; RCREG1=0x37 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1232 dcfsnz WREG |
159 | 1233 movff RCREG1, opt_sensor_fallback ; RCREG1=0x38 |
1234 dcfsnz WREG | |
1235 movff RCREG1, opt_flip_screen ; RCREG1=0x39 | |
223 | 1236 dcfsnz WREG |
1237 movff RCREG1, opt_cR_button_left ; RCREG1=0x3A | |
1238 dcfsnz WREG | |
1239 movff RCREG1, opt_cR_button_right ; RCREG1=0x3B | |
80 | 1240 |
1241 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
|
1242 ; 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
|
1243 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
|
1244 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
|
1245 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
|
1246 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
|
1247 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
|
1248 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
|
1249 call get_first_dil_to_WREG ; Makes sure at least one Diluent is "First" |
80 | 1250 bra comm_download_mode0 ; Done. Loop with timeout reset |
1251 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1252 comm_write_get_byte: |
80 | 1253 call rs232_get_byte |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1254 return |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1255 |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1256 comm_write_gas1: |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1257 movff RCREG1,opt_gas_O2_ratio+0 |
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1258 rcall comm_write_get_byte |
80 | 1259 movff RCREG1,opt_gas_He_ratio+0 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1260 rcall comm_write_get_byte |
80 | 1261 movff RCREG1,opt_gas_type+0 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1262 rcall comm_write_get_byte |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
1263 movff RCREG1,opt_OC_bail_gas_change+0 |
80 | 1264 bra comm_write_abort ; Done. Loop with timeout reset |
1265 comm_write_gas2: | |
1266 movff RCREG1,opt_gas_O2_ratio+1 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1267 rcall comm_write_get_byte |
80 | 1268 movff RCREG1,opt_gas_He_ratio+1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1269 rcall comm_write_get_byte |
80 | 1270 movff RCREG1,opt_gas_type+1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1271 rcall comm_write_get_byte |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
1272 movff RCREG1,opt_OC_bail_gas_change+1 |
80 | 1273 bra comm_write_abort ; Done. Loop with timeout reset |
1274 comm_write_gas3: | |
1275 movff RCREG1,opt_gas_O2_ratio+2 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1276 rcall comm_write_get_byte |
80 | 1277 movff RCREG1,opt_gas_He_ratio+2 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1278 rcall comm_write_get_byte |
80 | 1279 movff RCREG1,opt_gas_type+2 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1280 rcall comm_write_get_byte |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
1281 movff RCREG1,opt_OC_bail_gas_change+2 |
80 | 1282 bra comm_write_abort ; Done. Loop with timeout reset |
1283 comm_write_gas4: | |
1284 movff RCREG1,opt_gas_O2_ratio+3 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1285 rcall comm_write_get_byte |
80 | 1286 movff RCREG1,opt_gas_He_ratio+3 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1287 rcall comm_write_get_byte |
80 | 1288 movff RCREG1,opt_gas_type+3 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1289 rcall comm_write_get_byte |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
1290 movff RCREG1,opt_OC_bail_gas_change+3 |
80 | 1291 bra comm_write_abort ; Done. Loop with timeout reset |
1292 comm_write_gas5: | |
1293 movff RCREG1,opt_gas_O2_ratio+4 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1294 rcall comm_write_get_byte |
80 | 1295 movff RCREG1,opt_gas_He_ratio+4 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1296 rcall comm_write_get_byte |
80 | 1297 movff RCREG1,opt_gas_type+4 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1298 rcall comm_write_get_byte |
97
53a99a2dc6a1
CHANGE: Always compute bailout plan based on all active gases
heinrichsweikamp
parents:
92
diff
changeset
|
1299 movff RCREG1,opt_OC_bail_gas_change+4 |
80 | 1300 bra comm_write_abort ; Done. Loop with timeout reset |
1301 | |
1302 comm_write_dil1: | |
1303 movff RCREG1,opt_dil_O2_ratio+0 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1304 rcall comm_write_get_byte |
80 | 1305 movff RCREG1,opt_dil_He_ratio+0 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1306 rcall comm_write_get_byte |
80 | 1307 movff RCREG1,opt_dil_type+0 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1308 rcall comm_write_get_byte |
80 | 1309 movff RCREG1,char_I_dil_change+0 |
1310 bra comm_write_abort ; Done. Loop with timeout reset | |
1311 comm_write_dil2: | |
1312 movff RCREG1,opt_dil_O2_ratio+1 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1313 rcall comm_write_get_byte |
80 | 1314 movff RCREG1,opt_dil_He_ratio+1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1315 rcall comm_write_get_byte |
80 | 1316 movff RCREG1,opt_dil_type+1 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1317 rcall comm_write_get_byte |
80 | 1318 movff RCREG1,char_I_dil_change+1 |
1319 bra comm_write_abort ; Done. Loop with timeout reset | |
1320 comm_write_dil3: | |
1321 movff RCREG1,opt_dil_O2_ratio+2 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1322 rcall comm_write_get_byte |
80 | 1323 movff RCREG1,opt_dil_He_ratio+2 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1324 rcall comm_write_get_byte |
80 | 1325 movff RCREG1,opt_dil_type+2 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1326 rcall comm_write_get_byte |
80 | 1327 movff RCREG1,char_I_dil_change+2 |
1328 bra comm_write_abort ; Done. Loop with timeout reset | |
1329 comm_write_dil4: | |
1330 movff RCREG1,opt_dil_O2_ratio+3 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1331 rcall comm_write_get_byte |
80 | 1332 movff RCREG1,opt_dil_He_ratio+3 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1333 rcall comm_write_get_byte |
80 | 1334 movff RCREG1,opt_dil_type+3 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1335 rcall comm_write_get_byte |
80 | 1336 movff RCREG1,char_I_dil_change+3 |
1337 bra comm_write_abort ; Done. Loop with timeout reset | |
1338 comm_write_dil5: | |
1339 movff RCREG1,opt_dil_O2_ratio+4 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1340 rcall comm_write_get_byte |
80 | 1341 movff RCREG1,opt_dil_He_ratio+4 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1342 rcall comm_write_get_byte |
80 | 1343 movff RCREG1,opt_dil_type+4 |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1344 rcall comm_write_get_byte |
80 | 1345 movff RCREG1,char_I_dil_change+4 |
1346 bra comm_write_abort ; Done. Loop with timeout reset | |
1347 | |
1348 comm_write_sp1: | |
1349 movff RCREG1,char_I_setpoint_cbar+0 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1350 rcall comm_write_get_byte |
80 | 1351 movff RCREG1,char_I_setpoint_change+0 |
1352 bra comm_write_abort ; Done. Loop with timeout reset | |
1353 comm_write_sp2: | |
1354 movff RCREG1,char_I_setpoint_cbar+1 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1355 rcall comm_write_get_byte |
80 | 1356 movff RCREG1,char_I_setpoint_change+1 |
1357 bra comm_write_abort ; Done. Loop with timeout reset | |
1358 comm_write_sp3: | |
1359 movff RCREG1,char_I_setpoint_cbar+2 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1360 rcall comm_write_get_byte |
80 | 1361 movff RCREG1,char_I_setpoint_change+2 |
1362 bra comm_write_abort ; Done. Loop with timeout reset | |
1363 comm_write_sp4: | |
1364 movff RCREG1,char_I_setpoint_cbar+3 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1365 rcall comm_write_get_byte |
80 | 1366 movff RCREG1,char_I_setpoint_change+3 |
1367 bra comm_write_abort ; Done. Loop with timeout reset | |
1368 comm_write_sp5: | |
1369 movff RCREG1,char_I_setpoint_cbar+4 | |
157
5ee76921e359
make new parameters configurable through pc
heinrichsweikamp
parents:
150
diff
changeset
|
1370 rcall comm_write_get_byte |
80 | 1371 movff RCREG1,char_I_setpoint_change+4 |
1372 bra comm_write_abort ; Done. Loop with timeout reset | |
1373 | |
79
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1374 ;----------------------------------------------------------------------------- |
0fc8113ddf6d
new command in download mode: "r" - read setting
mh@mh-THINK.localdomain
parents:
69
diff
changeset
|
1375 |
0 | 1376 comm_send_string: |
1377 movlw "n" ; send echo | |
1378 movwf TXREG1 | |
1379 call rs232_wait_tx ; Wait for UART | |
1380 WIN_SMALL comm_string_column, comm_string_row | |
1381 movlw .16 | |
1382 movwf lo ; counter | |
1383 comm_send_string_loop: | |
1384 call rs232_get_byte | |
1385 btfsc rs232_recieve_overflow ; Got byte? | |
1386 bra comm_send_string_abort ; No, abort! | |
1387 movff RCREG1,POSTINC2 ; Store character | |
1388 decfsz lo,F | |
1389 bra comm_send_string_loop | |
1390 comm_send_string_abort: | |
1391 STRCAT_PRINT "" ; Show the text | |
80 | 1392 goto comm_download_mode0 ; Done. Loop with timeout reset |
0 | 1393 |
1394 ;----------------------------------------------------------------------------- | |
1395 | |
1396 comm_check_day: | |
1397 movff RCREG1, day | |
1398 movff month,lo ; new month | |
1399 dcfsnz lo,F | |
1400 movlw .31 | |
1401 dcfsnz lo,F | |
1402 movlw .28 | |
1403 dcfsnz lo,F | |
1404 movlw .31 | |
1405 dcfsnz lo,F | |
1406 movlw .30 | |
1407 dcfsnz lo,F | |
1408 movlw .31 | |
1409 dcfsnz lo,F | |
1410 movlw .30 | |
1411 dcfsnz lo,F | |
1412 movlw .31 | |
1413 dcfsnz lo,F | |
1414 movlw .31 | |
1415 dcfsnz lo,F | |
1416 movlw .30 | |
1417 dcfsnz lo,F | |
1418 movlw .31 | |
1419 dcfsnz lo,F | |
1420 movlw .30 | |
1421 dcfsnz lo,F | |
1422 movlw .31 | |
1423 cpfsgt day ; day ok? | |
1424 return ; OK | |
1425 movlw .1 ; not OK, set to 1st | |
1426 movwf day | |
1427 return | |
1428 | |
1429 ;---------------------------------------------------------------------------- | |
1430 END |