comparison src/surfmode.asm @ 631:185ba2f91f59

3.09 beta 1 release
author heinrichsweikamp
date Fri, 28 Feb 2020 15:45:07 +0100
parents 237931377539
children 4050675965ea
comparison
equal deleted inserted replaced
630:4cd81bdbf15c 631:185ba2f91f59
1 ;============================================================================= 1 ;=============================================================================
2 ; 2 ;
3 ; File surfmode.asm next combined generation V3.04.3 3 ; File surfmode.asm next combined generation V3.08.8
4 ; 4 ;
5 ; Surface Mode 5 ; Surface Mode
6 ; 6 ;
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved.
8 ;============================================================================= 8 ;=============================================================================
109 bsf trigger_pres_cur_changed; set flag to have pressure written to display on first round of surface loop 109 bsf trigger_pres_cur_changed; set flag to have pressure written to display on first round of surface loop
110 bsf trigger_temp_changed ; set flag to have temperature written to display on first round of surface loop 110 bsf trigger_temp_changed ; set flag to have temperature written to display on first round of surface loop
111 111
112 call I2C_sleep_compass ; shut down compass 112 call I2C_sleep_compass ; shut down compass
113 113
114 clrf ext_flash_address+0 114 CLRT ext_flash_address
115 clrf ext_flash_address+1 115
116 clrf ext_flash_address+2
117 116
118 IFDEF _ccr_pscr 117 IFDEF _ccr_pscr
119 movlw surface_sp ; load default surface setpoint (in cbar) 118 movlw surface_sp ; load default surface setpoint (in cbar)
120 movff WREG,char_I_const_ppO2 ; store it as current setpoint 119 movff WREG,char_I_const_ppO2 ; store it as current setpoint
121 ENDIF 120 ENDIF
124 call transmit_setpoint ; transmit current setpoint (in cbar) via S8 digital interface (currently disabled) 123 call transmit_setpoint ; transmit current setpoint (in cbar) via S8 digital interface (currently disabled)
125 ENDIF 124 ENDIF
126 125
127 bcf surfmode_menu ; not in surface menu (any more) 126 bcf surfmode_menu ; not in surface menu (any more)
128 bcf compass_menu ; not in "set bearing" selection (any more) 127 bcf compass_menu ; not in "set bearing" selection (any more)
129 bcf bailout_mode ; not in bailout menu (any more)
130 128
131 bcf switch_left ; clear intermediate button event since start/restart 129 bcf switch_left ; clear intermediate button event since start/restart
132 bcf switch_right ; clear intermediate button event since start/restart 130 bcf switch_right ; clear intermediate button event since start/restart
133 131
134 btfsc restart_fast ; shall make a fast restart? 132 btfsc restart_fast ; shall make a fast restart?
190 call TFT_decotype_surface ; display deco mode 188 call TFT_decotype_surface ; display deco mode
191 189
192 TSTOSS opt_dive_mode ; in OC? (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR) 190 TSTOSS opt_dive_mode ; in OC? (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR)
193 call TFT_show_OC_startgas_surface ; YES - show first gas and "OSTC2-like" active gases 191 call TFT_show_OC_startgas_surface ; YES - show first gas and "OSTC2-like" active gases
194 192
193 ; configure tissue graphics
194 bcf tissue_graphic_mode ; select surface mode
195 bsf tissue_graphic_cns ; show CNS value
196
197 bsf tissue_graphic_layout ; default to N2+He
198 TSTOSS opt_tissue_graphics ; shall show press+sat?
199 bcf tissue_graphic_layout ; YES - show press+sat
200
201 bcf tissue_graphic_gf ; default to none-GF
202 TSTOSC char_I_model ; GF factors enabled?
203 bsf tissue_graphic_gf ; YES - show GF lines
204
195 movff customview_surfmode,active_customview ; reload last custom view 205 movff customview_surfmode,active_customview ; reload last custom view
196 call surf_customview_mask ; redraw last custom view 206 call surf_customview_mask ; redraw last custom view
197 207
198 call TFT_Display_FadeIn ; display resulting surface screen 208 call TFT_Display_FadeIn ; display resulting surface screen
199 209
303 bra test_switches_surfmode3 ; YES 313 bra test_switches_surfmode3 ; YES
304 return ; NO to both - done 314 return ; NO to both - done
305 315
306 test_switches_surfmode2: ; right button pressed 316 test_switches_surfmode2: ; right button pressed
307 bcf switch_right ; clear button event 317 bcf switch_right ; clear button event
308 rcall reset_timeout_surfmode ; reset timeout 318 rcall reset_timeout_surfmode ; set up timeout
309 IFDEF _compass 319 IFDEF _compass
310 movlw .6 ; coding for surface custom compass view 320 movlw .6 ; coding for surface custom compass view
311 cpfseq active_customview ; in compass view? 321 cpfseq active_customview ; in compass view?
312 bra test_switches_surfmode2a ; NO 322 bra test_switches_surfmode2a ; NO
313 btfss compass_menu ; "set course" selection shown? 323 btfss compass_menu ; "set course" selection shown?
321 bcf compass_menu ; "set course" selection not shown anymore 331 bcf compass_menu ; "set course" selection not shown anymore
322 return 332 return
323 333
324 test_switches_surfmode3: ; left button pressed 334 test_switches_surfmode3: ; left button pressed
325 bcf switch_left ; clear button event 335 bcf switch_left ; clear button event
326 rcall reset_timeout_surfmode ; reset timeout 336 rcall reset_timeout_surfmode ; set up timeout
327 IFDEF _compass 337 IFDEF _compass
328 movlw .6 ; coding for surface custom view compass 338 movlw .6 ; coding for surface custom view compass
329 cpfseq active_customview ; in compass view? 339 cpfseq active_customview ; in compass view?
330 bra test_switches_surfmode3a ; NO 340 bra test_switches_surfmode3a ; NO
331 btfsc compass_menu ; YES - "set course" selection already shown? 341 btfsc compass_menu ; YES - "set course" selection already shown?
484 494
485 btfsc simulatormode ; currently in simulator (deco calculator) mode? 495 btfsc simulatormode ; currently in simulator (deco calculator) mode?
486 return ; YES - suppress COMM mode to not jeopardize backup/restore of tissue data 496 return ; YES - suppress COMM mode to not jeopardize backup/restore of tissue data
487 497
488 btfss vusb_in ; USB plugged in? 498 btfss vusb_in ; USB plugged in?
489 return ; NO - done 499 return ; NO - done
490 IFDEF _screendump 500 IFDEF _screendump
491 btfsc screen_dump_avail ; YES - screen dump enabled? 501 btfsc screen_dump_avail ; YES - screen dump enabled?
492 return ; YES - no COMM mode to be able to make screen shots of the menu and simulator mode 502 return ; YES - no COMM mode to be able to make screen shots of the menu and simulator mode
493 ENDIF 503 ENDIF
494 btfss ble_available ; Skip "USB" check in all Bluetooth models (Required for very old OSTC sport) 504 btfss ble_available ; skip "USB" check in all Bluetooth models (required for very old OSTC sport)
495 goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal 505 goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal
496 return 506 return
507
497 508
498 global reset_timeout_surfmode 509 global reset_timeout_surfmode
499 reset_timeout_surfmode: 510 reset_timeout_surfmode:
500 movlw surfmode_timeout_default ; load default timeout value 511 movlw surfmode_timeout_default ; load default timeout value
501 btfsc imprint_sensor_mv ; currently imprinting O2 sensor mV data? 512 btfss battery_is_36v ; running on a 3.6 V battery?
502 movlw surfmode_timeout_calibrate ; YES - replace with CCR Calibrate Menu timeout 513 movlw surfmode_timeout_aa_15v ; NO - replace by timeout for 1.5V battery
503 btfsc simulatormode ; currently in simulator (deco calculator) mode? 514 btfsc simulatormode ; currently in simulator (deco calculator) mode?
504 movlw surfmode_timeout_simulator ; YES - replace with simulator timeout 515 movlw surfmode_timeout_simulator ; YES - replace with simulator timeout
505 IFDEF _rx_functions 516 ;bra reset_timeout_time ; set timeout value
506 btfsc imprint_xmitter_ID ; currently selecting pressure transmitter? 517
507 movlw surfmode_timeout_xmitter ; YES - replace with transmitter selection timeout 518 ; btfsc imprint_sensor_mv ; currently imprinting O2 sensor mV data?
508 ENDIF ; _rx_functions 519 ; movlw surfmode_timeout_calibrate ; YES - replace with CCR Calibrate Menu timeout
509 IFDEF _external_sensor 520 ; IFDEF _rx_functions
510 btfsc surfmode_menu ; in surface menu? 521 ; btfsc imprint_xmitter_ID ; currently selecting pressure transmitter?
511 bra reset_timeout_time ; YES - keep timeout value 522 ; movlw surfmode_timeout_xmitter ; YES - replace with transmitter selection timeout
512 btfsc FLAG_ccr_mode ; NO - in CCR mode? 523 ; ENDIF ; _rx_functions
513 bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode 524 ; IFDEF _external_sensor
514 btfsc FLAG_ccr_mode ; NO - in pSCR mode? 525 ; btfsc surfmode_menu ; in surface menu?
515 bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode 526 ; bra reset_timeout_time ; YES - keep timeout value
516 bra reset_timeout_time ; NO - keep timeout value 527 ; btfsc FLAG_ccr_mode ; NO - in CCR mode?
517 reset_timeout_surfmode_loop: 528 ; bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode
518 movff opt_ccr_mode,lo ; get loop mode (=0: fixed/calculated SP, =1: sensor, =2: auto SP) 529 ; btfsc FLAG_ccr_mode ; NO - in pSCR mode?
519 decfsz lo,f ; in sensor mode? 530 ; bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode
520 bra reset_timeout_time ; NO - keep timeout value 531 ; bra reset_timeout_time ; NO - keep timeout value
521 movlw surfmode_timeout_sensor ; YES - replace with sensor mode timeout 532 ;reset_timeout_surfmode_loop:
522 ENDIF ; _external_sensor 533 ; movff opt_ccr_mode,lo ; get loop mode (=0: fixed/calculated SP, =1: sensor, =2: auto SP)
523 ;bra reset_timeout_time ; - set timeout value 534 ; decfsz lo,f ; in sensor mode?
535 ; bra reset_timeout_time ; NO - keep timeout value
536 ; movlw surfmode_timeout_sensor ; YES - replace with sensor mode timeout
537 ; ENDIF ; _external_sensor
538 ; ;bra reset_timeout_time ; set timeout value
524 539
525 540
526 global reset_timeout_time 541 global reset_timeout_time
527 reset_timeout_time: ; entry point with timeout value in WREG 542 reset_timeout_time: ; entry point with timeout value in WREG
528 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload 543 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload