comparison src/divemode.asm @ 131:35b9da423de6

NEW: Update warnings every second NEW: Show "Stop" in front of Safety Stop
author heinrichsweikamp
date Fri, 04 Jul 2014 12:51:20 +0200
parents f3062a611eef
children 4574aed5cd4c
comparison
equal deleted inserted replaced
130:c935f7fbd39c 131:35b9da423de6
67 btfsc FLAG_apnoe_mode ; Only in apnoe mode 67 btfsc FLAG_apnoe_mode ; Only in apnoe mode
68 bra diveloop_loop1b ; One Second Tasks in Apnoe mode 68 bra diveloop_loop1b ; One Second Tasks in Apnoe mode
69 69
70 call TFT_divemins ; Display (new) divetime! 70 call TFT_divemins ; Display (new) divetime!
71 call customview_second ; Do every-second tasks for the custom view area 71 call customview_second ; Do every-second tasks for the custom view area
72 call divemode_check_for_warnings ; Check for any warnings
72 73
73 ; Tasks only for deco modes 74 ; Tasks only for deco modes
74 btfsc show_safety_stop ; Show the safety stop? 75 btfsc show_safety_stop ; Show the safety stop?
75 call TFT_show_safety_stop ; Yes, show/delete if done. 76 call TFT_show_safety_stop ; Yes, show/delete if done.
76 call calc_deko_divemode ; calculate decompression and display result (any two seconds) 77 call calc_deko_divemode ; calculate decompression and display result (any two seconds)
77 bra diveloop_loop1x ; Common Tasks 78 bra diveloop_loop1x ; Common Tasks
78 79
79 diveloop_loop1b: 80 diveloop_loop1b:
80 ; Tasks only for Apnoe mode 81 ; Tasks only for Apnoe mode
81 call divemode_apnoe_tasks ; 1 sec. Apnoe tasks 82 call divemode_check_for_warnings ; Check for any warnings
83 rcall divemode_apnoe_tasks ; 1 sec. Apnoe tasks
82 bra diveloop_loop1x ; Common Tasks 84 bra diveloop_loop1x ; Common Tasks
83 85
84 diveloop_loop1x: 86 diveloop_loop1x:
85 ; Common 1sec. tasks for all modes 87 ; Common 1sec. tasks for all modes
86 call timeout_divemode ; dive finished? This routine sets the required flags 88 rcall timeout_divemode ; dive finished? This routine sets the required flags
87 call set_dive_modes ; tests if depth>threshold 89 rcall set_dive_modes ; tests if depth>threshold
88 call set_min_temp ; store min. temp if required 90 rcall set_min_temp ; store min. temp if required
89 91
90 btfsc store_sample ; store new sample? 92 btfsc store_sample ; store new sample?
91 call store_dive_data ; Store profile data 93 call store_dive_data ; Store profile data
92 94
93 btfss divemode ; Dive finished? 95 btfss divemode ; Dive finished?
211 213
212 bsf twosecupdate ; No, but next second! 214 bsf twosecupdate ; No, but next second!
213 ; Routines used in the "other second" 215 ; Routines used in the "other second"
214 call calc_average_depth ; calculate average depth 216 call calc_average_depth ; calculate average depth
215 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds) 217 call calc_velocity ; calculate vertical velocity and display if > threshold (every two seconds)
216 call divemode_check_for_warnings ; Check for any warnings
217 call set_reset_safety_stop ; Set flags for safety stop and/or reset safety stop 218 call set_reset_safety_stop ; Set flags for safety stop and/or reset safety stop
218 call TFT_debug_output 219 call TFT_debug_output
219 220
220 btfsc FLAG_apnoe_mode ; Done for Apnoe or Gauge mode 221 btfsc FLAG_apnoe_mode ; Done for Apnoe or Gauge mode
221 return 222 return
509 reset_safety_stop2: 510 reset_safety_stop2:
510 bcf show_safety_stop ; Clear flag 511 bcf show_safety_stop ; Clear flag
511 btfss safety_stop_active ; Safety stop shown 512 btfss safety_stop_active ; Safety stop shown
512 return ; No, don't delete it 513 return ; No, don't delete it
513 bcf safety_stop_active ; Clear flag 514 bcf safety_stop_active ; Clear flag
514 call TFT_display_ndl_mask ; Show NDL again 515 call TFT_clear_safety_stop ; Clear safety stop
515 call TFT_display_ndl
516 return 516 return
517 517
518 ;============================================================================= 518 ;=============================================================================
519 519
520 timeout_menuview: 520 timeout_menuview:
1321 movff int_O_CNS_fraction+1,CNS_start+1 ; Save CNS value at beginning of dive 1321 movff int_O_CNS_fraction+1,CNS_start+1 ; Save CNS value at beginning of dive
1322 movff char_O_relative_gradient_GF,GF_start ; Save GF value at beginning of dive 1322 movff char_O_relative_gradient_GF,GF_start ; Save GF value at beginning of dive
1323 return ; Done with divemode boot 1323 return ; Done with divemode boot
1324 1324
1325 divemode_check_for_warnings: 1325 divemode_check_for_warnings:
1326 btfss secs,1 ; Every four seconds 1326 movlw .2
1327 return 1327 cpfsgt warning_counter ; only two warnings active?
1328 1328 bra divemode_check_for_warnings1 ; Yes, update every second
1329
1330 btfss secs,0 ; Every two seconds...
1331 return
1332 btfss secs,1 ; Every four seconds...
1333 return
1334
1335 divemode_check_for_warnings1:
1329 movf warning_counter_backup,W 1336 movf warning_counter_backup,W
1330 cpfseq warning_counter ; warning_counter_backup = warning_counter? 1337 cpfseq warning_counter ; warning_counter_backup = warning_counter?
1331 call TFT_clear_warning_text ; No, clear all warnings 1338 call TFT_clear_warning_text ; No, clear all warnings
1332 movff warning_counter,warning_counter_backup ; copy warning_counter 1339 movff warning_counter,warning_counter_backup ; copy warning_counter
1333 1340