Mercurial > public > hwos_code
comparison src/divemode.asm @ 104:223579e905c3
Show a Safety Stop if enabled (Menu "Deco Parameters")
author | heinrichsweikamp |
---|---|
date | Tue, 03 Jun 2014 12:25:47 +0200 |
parents | 37275e0fa7f5 |
children | c61b7a4e317c |
comparison
equal
deleted
inserted
replaced
103:047629595215 | 104:223579e905c3 |
---|---|
68 | 68 |
69 call TFT_divemins ; Display (new) divetime! | 69 call TFT_divemins ; Display (new) divetime! |
70 call customview_second ; Do every-second tasks for the custom view area | 70 call customview_second ; Do every-second tasks for the custom view area |
71 | 71 |
72 ; Tasks only for deco modes | 72 ; Tasks only for deco modes |
73 btfsc show_safety_stop ; Show the safety stop? | |
74 call TFT_show_safety_stop ; Yes, show/delete if done. | |
73 call calc_deko_divemode ; calculate decompression and display result (any two seconds) | 75 call calc_deko_divemode ; calculate decompression and display result (any two seconds) |
74 bra diveloop_loop1x ; Common Tasks | 76 bra diveloop_loop1x ; Common Tasks |
75 | 77 |
76 diveloop_loop1b: | 78 diveloop_loop1b: |
77 ; Tasks only for Apnoe mode | 79 ; Tasks only for Apnoe mode |
206 | 208 |
207 bsf twosecupdate ; No, but next second! | 209 bsf twosecupdate ; No, but next second! |
208 ; Routines used in the "other second" | 210 ; Routines used in the "other second" |
209 call calc_average_depth ; calculate average depth | 211 call calc_average_depth ; calculate average depth |
210 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) | 212 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) |
211 call divemode_check_for_warnings ; Check for any warnings | 213 call divemode_check_for_warnings ; Check for any warnings |
214 call set_reset_safety_stop ; Set flags for safety stop and/or reset safety stop | |
212 call TFT_debug_output | 215 call TFT_debug_output |
213 | 216 |
214 btfsc FLAG_apnoe_mode ; Done for Apnoe or Gauge mode | 217 btfsc FLAG_apnoe_mode ; Done for Apnoe or Gauge mode |
215 return | 218 return |
216 btfsc FLAG_gauge_mode ; Done for Apnoe or Gauge mode | 219 btfsc FLAG_gauge_mode ; Done for Apnoe or Gauge mode |
426 call TFT_display_velocity_clear | 429 call TFT_display_velocity_clear |
427 return | 430 return |
428 | 431 |
429 ;============================================================================= | 432 ;============================================================================= |
430 | 433 |
434 set_reset_safety_stop: ; Set flags for safety stop and/or reset safety stop | |
435 TSTOSS opt_enable_safetystop ; =1: A safety stop is shown | |
436 bra delete_safety_stop ; No, don't show safety stop | |
437 | |
438 btfsc decostop_active ; Is a deco stop displayed? | |
439 bra delete_safety_stop ; Yes, don't show safety stop | |
440 ; Below "safety_stop_reset"? Set flag and reset count-down timer | |
441 SAFE_2BYTE_COPY rel_pressure, lo | |
442 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
443 movff lo,sub_a+0 | |
444 movff hi,sub_a+1 | |
445 movlw LOW safety_stop_reset | |
446 movwf sub_b+0 | |
447 movlw HIGH safety_stop_reset | |
448 movwf sub_b+1 | |
449 call subU16 ; sub_c = sub_a - sub_b | |
450 btfss neg_flag | |
451 bra reset_safety_stop ; Below 10m, reset safety stop | |
452 | |
453 ; Above "safety_stop_end"? Clear flag. | |
454 SAFE_2BYTE_COPY rel_pressure, lo | |
455 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
456 movff lo,sub_a+0 | |
457 movff hi,sub_a+1 | |
458 movlw LOW safety_stop_end | |
459 movwf sub_b+0 | |
460 movlw HIGH safety_stop_end | |
461 movwf sub_b+1 | |
462 call subU16 ; sub_c = sub_a - sub_b | |
463 btfsc neg_flag | |
464 bra delete_safety_stop ; Above 3m, remove safety stop | |
465 | |
466 ; Above "safety_stop_start"? Activate safety stop | |
467 SAFE_2BYTE_COPY rel_pressure, lo | |
468 call adjust_depth_with_salinity ; computes salinity setting into lo:hi [mbar] | |
469 movff lo,sub_a+0 | |
470 movff hi,sub_a+1 | |
471 movlw LOW safety_stop_start | |
472 movwf sub_b+0 | |
473 movlw HIGH safety_stop_start | |
474 movwf sub_b+1 | |
475 call subU16 ; sub_c = sub_a - sub_b | |
476 btfsc neg_flag | |
477 bra acivate_safety_stop ; Above 5m, activate safety stop | |
478 bra reset_safety_stop2 ; Pause safety stop | |
479 | |
480 acivate_safety_stop: | |
481 tstfsz safety_stop_countdown ; Countdown at zero? | |
482 bsf show_safety_stop ; No, Set flag! | |
483 return | |
484 | |
485 delete_safety_stop: | |
486 clrf safety_stop_countdown ; reset timer | |
487 bra reset_safety_stop2 ; Remove safety stop from display | |
488 | |
489 reset_safety_stop: | |
490 movlw safety_stop_length ;[s] | |
491 movwf safety_stop_countdown ; reset timer | |
492 reset_safety_stop2: | |
493 bcf show_safety_stop ; Clear flag | |
494 btfss safety_stop_active ; Safety stop shown | |
495 return ; No, don't delete it | |
496 bcf safety_stop_active ; Clear flag | |
497 call TFT_display_ndl_mask ; Show NDL again | |
498 call TFT_display_ndl | |
499 return | |
500 | |
501 ;============================================================================= | |
502 | |
431 timeout_menuview: | 503 timeout_menuview: |
432 decfsz timeout_counter3,F ; timeout for menuview | 504 decfsz timeout_counter3,F ; timeout for menuview |
433 return ; No timeout, return | 505 return ; No timeout, return |
434 ; Timeout, clear e.g. "Menu?" | 506 ; Timeout, clear e.g. "Menu?" |
435 goto menuview_toggle_reset ; "returns" | 507 goto menuview_toggle_reset ; "returns" |
1145 rcall dive_boot_cc | 1217 rcall dive_boot_cc |
1146 | 1218 |
1147 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode | 1219 bcf better_gas_available ;=1: A better gas is available and a gas change is advised in divemode |
1148 clrf better_gas_number ; Clear better gas register | 1220 clrf better_gas_number ; Clear better gas register |
1149 | 1221 |
1222 bcf show_safety_stop ;=1: Show the safety stop | |
1223 clrf safety_stop_countdown ; Clear count-down | |
1224 | |
1150 clrf samplesecs | 1225 clrf samplesecs |
1151 clrf apnoe_timeout_counter ; timeout in minutes | 1226 clrf apnoe_timeout_counter ; timeout in minutes |
1152 clrf timeout_counter ; takes care of the timeout (Low byte) | 1227 clrf timeout_counter ; takes care of the timeout (Low byte) |
1153 clrf timeout_counter2 ; takes care of the timeout (High byte) | 1228 clrf timeout_counter2 ; takes care of the timeout (High byte) |
1154 clrf AlarmType ; Clear all alarms | 1229 clrf AlarmType ; Clear all alarms |