comparison code_part1/OSTC_code_asm_part1/divemode.asm @ 98:6f8e3a08011e

1.73beta rc1 (Added new customview for divemode)
author heinrichsweikamp
date Sun, 12 Dec 2010 15:01:05 +0100
parents 3e351e25f5d1
children 966ebf905514
comparison
equal deleted inserted replaced
97:dc349e4264bb 98:6f8e3a08011e
46 46
47 diveloop_loop: ; The diveloop starts here 47 diveloop_loop: ; The diveloop starts here
48 btfss onesecupdate ; tasks any new second 48 btfss onesecupdate ; tasks any new second
49 bra diveloop_loop2 49 bra diveloop_loop2
50 50
51 btfss premenu ; Is the divemode menu active?
52 call PLED_diveclock ; No, show clock (If clock should be displayed)
53
54 btfsc gauge_mode ; Only in gauge mode 51 btfsc gauge_mode ; Only in gauge mode
55 bra diveloop_loop1a ; One Second Tasks in Gauge mode 52 bra diveloop_loop1a ; One Second Tasks in Gauge mode
56 btfsc FLAG_apnoe_mode ; Only in apnoe mode 53 btfsc FLAG_apnoe_mode ; Only in apnoe mode
57 bra diveloop_loop1b ; One Second Tasks in Apnoe mode 54 bra diveloop_loop1b ; One Second Tasks in Apnoe mode
58 btfsc FLAG_const_ppO2_mode ; only in const_ppO2_mode 55 btfsc FLAG_const_ppO2_mode ; only in const_ppO2_mode
66 ; Tasks only for Gauge mode 63 ; Tasks only for Gauge mode
67 diveloop_loop1a: 64 diveloop_loop1a:
68 btfss premenu ; Is the divemode menu active? 65 btfss premenu ; Is the divemode menu active?
69 call PLED_divemins ; display (new) divetime! 66 call PLED_divemins ; display (new) divetime!
70 call timeout_divemode ; dive finished? This routine sets the required flags 67 call timeout_divemode ; dive finished? This routine sets the required flags
71
72 btfsc stopwatch_active ; =1: Show Average Depth instead of Temperature
73 call PLED_stopwatch_show ; Show stopwatch only in Average mode
74 68
75 btfsc twosecupdate ; two seconds after the last call 69 btfsc twosecupdate ; two seconds after the last call
76 bra diveloop_loop1a2 ; Common Tasks 70 bra diveloop_loop1a2 ; Common Tasks
77 71
78 bsf twosecupdate ; Routines used in the "other second" 72 bsf twosecupdate ; Routines used in the "other second"
108 btfsc menubit ; is the Dive mode menu displayed? 102 btfsc menubit ; is the Dive mode menu displayed?
109 call timeout_divemenu ; Yes, so check for timeout divemenu 103 call timeout_divemenu ; Yes, so check for timeout divemenu
110 call set_leds_divemode ; Sets warnings, if required. Also Sets buzzer 104 call set_leds_divemode ; Sets warnings, if required. Also Sets buzzer
111 btfsc enter_error_sleep ; Enter Fatal Error Routine? 105 btfsc enter_error_sleep ; Enter Fatal Error Routine?
112 call fatal_error_sleep ; Yes (In Sleepmode_vxx.asm!) 106 call fatal_error_sleep ; Yes (In Sleepmode_vxx.asm!)
113 107 call customview_second ; Do every-second tasks for the custom view area
114 btfsc stopwatch_active ; =1: Show Average Depth instead of Temperature
115 call PLED_stopwatch_show ; Show stopwatch only in Average mode
116 108
117 bcf onesecupdate ; one seconds update done 109 bcf onesecupdate ; one seconds update done
118 110
119 GETCUSTOM8 d'38' ; Show seconds (=1?) 111 GETCUSTOM8 d'38' ; Show seconds (=1?)
120 movwf lo 112 movwf lo
136 call check_ppO2 ; check ppO2 and displays warning if required 128 call check_ppO2 ; check ppO2 and displays warning if required
137 129
138 diveloop_loop2a: 130 diveloop_loop2a:
139 bcf update_divetime ; clear flag 131 bcf update_divetime ; clear flag
140 132
141
142 diveloop_loop3: 133 diveloop_loop3:
143 btfss menubit ; Divemode menu active? 134 btfss menubit ; Divemode menu active?
144 call test_switches_divemode ; No, Check switches normal 135 call test_switches_divemode ; No, Check switches normal
145 136
146 btfsc menubit ; Divemode menu active? 137 btfsc menubit ; Divemode menu active?
156 btfsc oneminupdate ; one minute tasks 147 btfsc oneminupdate ; one minute tasks
157 call update_divemode60 ; Update clock, etc. 148 call update_divemode60 ; Update clock, etc.
158 149
159 btfsc store_sample ; store new sample? 150 btfsc store_sample ; store new sample?
160 call store_dive_data ; Store profile data 151 call store_dive_data ; Store profile data
152
153 btfsc toggle_customview ; Next view?
154 call customview_toggle ; Yes, show next customview (and delete this flag)
161 155
162 btfsc menubit ; Sleep only with inactive menu... 156 btfsc menubit ; Sleep only with inactive menu...
163 bra diveloop_loop4 157 bra diveloop_loop4
164 158
165 btfsc simulatormode_active ; Do not sleep in Simualtor mode 159 btfsc simulatormode_active ; Do not sleep in Simualtor mode
235 movff max_pressure+0,apnoe_max_pressure+0 229 movff max_pressure+0,apnoe_max_pressure+0
236 movff max_pressure+1,apnoe_max_pressure+1 230 movff max_pressure+1,apnoe_max_pressure+1
237 return 231 return
238 232
239 set_leds_divemode: 233 set_leds_divemode:
240 bcf LED_red ; LEDy OFF
241 movff char_O_gradient_factor,lo ; gradient factor absolute 234 movff char_O_gradient_factor,lo ; gradient factor absolute
242 235
243 GETCUSTOM8 d'14' ; threshold for LED warning 236 GETCUSTOM8 d'14' ; threshold for LED warning
244 cpfslt lo ; 237 cpfslt lo ;
245 call warn_gf1 ; show warning, set flags 238 call warn_gf1 ; show warning, set flags
246 239
247 btfsc ppO2_warn_value ; warn because of too high ppO2?
248 bsf LED_red ; Yes
249
250 movff char_I_deco_model,lo 240 movff char_I_deco_model,lo
251 decfsz lo,W ; jump over return if char_I_deco_model == 1 241 decfsz lo,W ; jump over return if char_I_deco_model == 1
252 return 242 return
253 243
254 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model) 244 movff char_O_relative_gradient_GF,lo ; gradient factor relative (GF model)
255 245
256 GETCUSTOM8 d'14' ; threshold for LED warning 246 GETCUSTOM8 d'14' ; threshold for LED warning
257 cpfslt lo ; 247 cpfslt lo ;
258 call warn_gf1 ; show warning, set flags 248 call warn_gf1 ; show warning, set flags
259 249
260 btfsc ppO2_warn_value ; warn because of too high ppO2?
261 bsf LED_red ; Yes
262
263 return 250 return
264 251
265 warn_gf1: 252 warn_gf1:
266 bsf LED_red ; LED Yellow on
267 movlw d'2' ; Type of Alarm 253 movlw d'2' ; Type of Alarm
268 movwf AlarmType ; Copy to Alarm Register 254 movwf AlarmType ; Copy to Alarm Register
269 bsf event_occured ; Set Event Flag 255 bsf event_occured ; Set Event Flag
270 return 256 return
271 257
510 496
511 store_dive_data: ; CF20 seconds gone 497 store_dive_data: ; CF20 seconds gone
512 bcf store_sample ; update only any CF20 seconds 498 bcf store_sample ; update only any CF20 seconds
513 bsf update_divetime ; update divemins every CF20 seconds 499 bsf update_divetime ; update divemins every CF20 seconds
514 500
515 bcf LED_red ; LEDr off (Marker)
516
517 btfsc simulatormode_active ; Are we in simulator mode? 501 btfsc simulatormode_active ; Are we in simulator mode?
518 return ; Yes, discard everything 502 return ; Yes, discard everything
519 503
520 btfsc header_stored ; Header already stored? 504 btfsc header_stored ; Header already stored?
521 bra store_dive_data2 ; Yes, store only profile data 505 bra store_dive_data2 ; Yes, store only profile data
1399 update_divemode60: ; update any minute 1383 update_divemode60: ; update any minute
1400 call get_battery_voltage ; gets battery voltage 1384 call get_battery_voltage ; gets battery voltage
1401 call set_powersafe ; red LED blinking if battery is low 1385 call set_powersafe ; red LED blinking if battery is low
1402 call PLED_max_pressure ; No, use normal max. depth 1386 call PLED_max_pressure ; No, use normal max. depth
1403 call check_temp_extrema ; check for new temperature extremas 1387 call check_temp_extrema ; check for new temperature extremas
1388 call customview_minute ; Do every-minute tasks for the custom view area
1404 bcf oneminupdate 1389 bcf oneminupdate
1405 return 1390 return
1406 1391
1407 set_max_depth: 1392 set_max_depth:
1408 movff max_pressure+0,sub_a+0 1393 movff max_pressure+0,sub_a+0
1551 clrf apnoe_surface_secs 1536 clrf apnoe_surface_secs
1552 clrf apnoe_mins 1537 clrf apnoe_mins
1553 clrf apnoe_secs 1538 clrf apnoe_secs
1554 clrf divemins+0 1539 clrf divemins+0
1555 clrf divemins+1 1540 clrf divemins+1
1541 clrf menupos3
1542 bcf menu3_active
1556 clrf divesecs 1543 clrf divesecs
1557 clrf samplesecs 1544 clrf samplesecs
1558 clrf apnoe_timeout_counter ; timeout in minutes 1545 clrf apnoe_timeout_counter ; timeout in minutes
1559 clrf timeout_counter ; takes care of the timeout 1546 clrf timeout_counter ; takes care of the timeout
1560 clrf timeout_counter2 ; Here: counts to six, then store deco data and temperature 1547 clrf timeout_counter2 ; Here: counts to six, then store deco data and temperature