Mercurial > public > hwos_code
annotate src/surfmode.asm @ 543:a92cecf8cee4
BUGFIX: "lost gas" showed current set of gases (Diluents in CC, OC in Bailout) for both "lost gas" menus
author | heinrichsweikamp |
---|---|
date | Wed, 06 Sep 2017 11:08:59 +0200 |
parents | cf68fe0c3002 |
children | b7eb98dbd800 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
3 ; File surfmode.asm | |
4 ; | |
5 ; Surfacemode | |
6 ; | |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
10 ; 2011-08-07 : [mH] moving from OSTC code | |
11 | |
275 | 12 #include "hwos.inc" ; Mandatory header |
505
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
14 #include "start.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
15 #include "tft.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
16 #include "tft_outputs.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
17 #include "isr.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
18 #include "adc_lightsensor.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
19 #include "menu_processor.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
20 #include "strings.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
21 #include "sleepmode.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
22 #include "wait.inc" ; speed_* |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
23 #include "external_flash.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
24 #include "customview.inc" |
bef07a837a60
BUGFIX: Reset to MOD in Diluent Menu did reset Setpoint change depth
heinrichsweikamp
parents:
487
diff
changeset
|
25 #include "divemode.inc" |
0 | 26 #include "mcp.inc" ; RX |
27 #include "i2c.inc" | |
28 #include "comm.inc" | |
29 #include "eeprom_rs232.inc" | |
113 | 30 #include "calibrate.inc" |
0 | 31 |
213 | 32 extern do_main_menu |
33 | |
0 | 34 #DEFINE menu_pos_row .215 |
213 | 35 #DEFINE menu_pos_column .1 |
0 | 36 #DEFINE view_row .215 |
37 #DEFINE view_column .124 | |
38 | |
39 gui CODE | |
40 | |
41 | |
42 ;============================================================================= | |
43 ; Boot tasks for all modes | |
44 global surfloop | |
45 surfloop: | |
46 call speed_normal | |
47 bcf no_sensor_int ; Normal pressure mode | |
48 | |
245 | 49 bcf LEDg |
50 bcf LEDr | |
51 | |
0 | 52 clrf CCP1CON ; stop PWM |
53 bcf PORTC,2 ; Pull PWM output to GND | |
54 call TFT_boot ; Initialize TFT (includes clear screen) | |
55 bcf restore_deco_data | |
56 | |
57 WIN_TOP .50 | |
58 WIN_LEFT .10 | |
59 movlw LOW 0x1E000 | |
60 movwf TBLPTRL | |
61 movlw HIGH 0x1E000 | |
62 movwf TBLPTRH | |
63 movlw UPPER 0x1E000 | |
64 movwf TBLPTRU | |
65 extern color_image | |
66 call color_image ; Show logo | |
67 | |
68 WIN_TOP .100 | |
69 WIN_LEFT .34 | |
275 | 70 extern ostc_logo_block |
71 movlw LOW(ostc_logo_block) | |
0 | 72 movwf TBLPTRL |
275 | 73 movlw HIGH ostc_logo_block;&0xFFFF |
0 | 74 movwf TBLPTRH |
275 | 75 movlw UPPER(ostc_logo_block) |
0 | 76 movwf TBLPTRU |
77 call color_image | |
78 call TFT_Display_FadeIn ; Show splash | |
79 call TFT_serial ; Show serial and firmware version | |
80 | |
81 ;---- Do any usefull initializes that takes time ------------------------- | |
82 call restart_set_modes_and_flags ; Sets decomode flags | |
83 bcf pressure_refresh | |
84 call I2C_init_compass | |
85 call I2C_init_accelerometer | |
86 clrf ext_flash_address+0 | |
87 clrf ext_flash_address+1 | |
88 clrf ext_flash_address+2 | |
89 | |
354 | 90 movlw surface_sp ; in cbar |
91 call transmit_setpoint ; Transmit current setpoint from WREG (in cbar) to external electronics | |
221
90923a081ae7
minor: configure buttons during splash screen
heinrichsweikamp
parents:
213
diff
changeset
|
92 |
0 | 93 clrf timeout_counter2 |
94 clrf timeout_counter3 | |
95 bcf menubit ; clear menu flag | |
382 | 96 bcf premenu |
0 | 97 clrf last_pressure+0 |
98 clrf last_pressure+1 | |
99 bcf is_bailout ; =1: Bailout | |
100 bcf ccr_diluent_setup ; Use OC gases for gaslist routine | |
101 | |
102 bcf simulatormode_active ; Quit simulator mode (if active) | |
103 bcf switch_left | |
104 bcf switch_right | |
105 | |
106 ;---- Fade to standard surface view -------------------------------------- | |
107 ; Wait 1 second | |
108 bcf onesecupdate | |
109 btfss onesecupdate | |
110 bra $-2 | |
111 ; Wait 1 second | |
112 bcf onesecupdate | |
113 btfss onesecupdate | |
114 bra $-2 | |
115 | |
116 call TFT_Display_FadeOut ; Go to black screen | |
117 call TFT_ClearScreen ; Then change everything | |
118 WIN_TOP .0 | |
119 WIN_LEFT .0 | |
120 WIN_FONT FT_SMALL | |
189
e79bc535ef9e
ignore un-calibrated sensors even if they become valid
heinrichsweikamp
parents:
188
diff
changeset
|
121 bcf win_invert ; Reset invert flag |
0 | 122 |
123 WIN_COLOR color_lightblue | |
124 WIN_SMALL menu_pos_column,menu_pos_row | |
125 STRCPY_TEXT_PRINT tMenu ;"<Menu" | |
126 WIN_SMALL view_column,view_row | |
127 STRCPY_TEXT_PRINT tView ;"View>" | |
128 call TFT_standard_color | |
129 | |
48 | 130 ; Logo |
0 | 131 WIN_TOP .0 |
132 WIN_LEFT .70 | |
275 | 133 movlw LOW(ostc_logo_block) |
0 | 134 movwf TBLPTRL |
275 | 135 movlw HIGH ostc_logo_block;&0xFFFF |
0 | 136 movwf TBLPTRH |
275 | 137 movlw UPPER(ostc_logo_block) |
0 | 138 movwf TBLPTRU |
139 call color_image | |
140 | |
158 | 141 call TFT_clock ; display time |
142 call update_surfloop60 | |
143 call get_battery_voltage ; get battery voltage | |
144 call TFT_update_batt_voltage ; display battery voltage | |
145 call TFT_update_surf_press ; display surface pressure | |
146 call TFT_temp_surfmode ; Displays temperature | |
147 call TFT_display_decotype_surface | |
375
a9e35c1327aa
1.88 release, BUGFIX: Start with Sensor use from sleep (cR only), CHANGE: Apply button settings when button menu is closed, NEW: Reset button settings on a magnet reset (cR and OSTC 2)
heinrichsweikamp
parents:
354
diff
changeset
|
148 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays |
a9e35c1327aa
1.88 release, BUGFIX: Start with Sensor use from sleep (cR only), CHANGE: Apply button settings when button menu is closed, NEW: Reset button settings on a magnet reset (cR and OSTC 2)
heinrichsweikamp
parents:
354
diff
changeset
|
149 call check_sensors ; Set enable/disable flags |
234
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
233
diff
changeset
|
150 |
480
ad8acade5567
NEW: PSCR mode (Passive semi-closed rebreather)
heinrichsweikamp
parents:
476
diff
changeset
|
151 movff opt_dive_mode,lo ; 0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=PSCR |
232 | 152 tstfsz lo |
153 bra surfloop_no_oc ; Not OC | |
234
57155164faad
Show OSTC2-like active gas boxes in surface mode
heinrichsweikamp
parents:
233
diff
changeset
|
154 call TFT_show_OC_startgas_surface; Show first gas and "OSTC2-like" active gases |
232 | 155 surfloop_no_oc: |
158 | 156 movff customview_surfmode,menupos3 ; Reload last customview |
157 call surf_customview_mask ; Update #menupos3 view | |
0 | 158 |
159 call TFT_Display_FadeIn ; Display resulting surface screen. | |
160 | |
161 ;---- Late initialisations ----------------------------------------------- | |
162 movff last_surfpressure_30min+0,int_I_pres_respiration+0 ; copy surface air pressure to deco routine | |
163 movff last_surfpressure_30min+1,int_I_pres_respiration+1 ; 30min old values | |
164 movff last_surfpressure_30min+0,int_I_pres_surface+0 ; copy surface air pressure to deco routine | |
165 movff last_surfpressure_30min+1,int_I_pres_surface+1 ; 30min old values | |
166 movff last_surfpressure_30min+0,last_surfpressure+0 ; Use 30min old airpressure | |
167 movff last_surfpressure_30min+1,last_surfpressure+1 ; Use 30min old airpressure | |
168 | |
158 | 169 ; Startup tasks for all modes |
0 | 170 ; Desaturation time needs: |
171 ; int_I_pres_surface | |
172 ; char_I_desaturation_multiplier | |
173 call deco_calc_desaturation_time ; calculate desaturation time | |
174 movlb b'00000001' ; select ram bank 1 | |
175 | |
176 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
177 call enable_rs232 ; Also sets to speed_normal ... | |
178 | |
179 surfloop_loop: | |
180 btfss onesecupdate ; do every second tasks? | |
181 bra surfloop_loop2 ; no, loop | |
182 | |
183 ; One Second tasks for all modes | |
184 call speed_normal | |
487 | 185 ;call TFT_debug_output |
0 | 186 call TFT_clock ; update clock |
187 call timeout_surfmode ; check timeout | |
188 call get_battery_voltage ; get battery voltage | |
189 call TFT_update_batt_voltage ; display battery voltage | |
190 call set_dive_modes ; tests if depth>threshold | |
191 btfss secs,0 ; Every two seconds... | |
192 call TFT_temp_surfmode ; Displays temperature | |
193 btfss secs,0 ; Every two seconds... | |
194 call surfmode_check_for_warnings ; ... check for warnings (and display/update) them | |
195 | |
196 bcf onesecupdate ; every second tasks done | |
197 | |
198 surfloop_loop2: | |
199 ; Tasks approx. every 50ms for all modes | |
200 call test_switches_surfmode ; check switches | |
487 | 201 call TFT_debug_output |
0 | 202 |
203 ; One minute tasks for all modes | |
204 btfsc oneminupdate ; do every minute tasks | |
205 call update_surfloop60 ; yes, e.g. update time and date | |
206 | |
207 ; Mode tasks | |
230
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
208 btfsc divemode ; Divemode active? |
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
209 goto diveloop ; Yes, switch into Divemode! |
f6548e8f06f5
Bugfix: Check for divemode before checking for menu
mh@mh-THINK
parents:
226
diff
changeset
|
210 |
0 | 211 btfsc menubit ; Menu? |
212 goto do_main_menu ; Menu! | |
213 | |
214 btfsc pressure_refresh ; new pressure available? | |
215 call TFT_update_surf_press ; display surface pressure | |
216 bcf pressure_refresh ; until new pressure is available | |
217 | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
218 ; Updates every 1/4 second |
0 | 219 btfss quarter_second_update |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
220 bra surfloop_loop2b |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
221 |
0 | 222 bcf quarter_second_update |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
223 |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
224 ; Update Sensors |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
225 call compute_ppo2 ; compute mv_sensorX and ppo2_sensorX arrays |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
226 call check_sensors ; Set enable/disable flags |
485 | 227 btfsc FLAG_ccr_mode ; In CCR mode? |
228 bra surfloop_loop2a1 ; Yes. | |
229 btfss FLAG_pscr_mode ; In PSCR mode? | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
230 bra surfloop_loop2a ; No, skip |
485 | 231 |
232 surfloop_loop2a1: | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
233 movff opt_ccr_mode,WREG ; =0: Fixed SP, =1: Sensor, =2: Auto SP |
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
234 sublw .1 ; opt_ccr_mode = 1 (Sensor)? |
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
235 bnz surfloop_loop2a ; No, skip |
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
236 |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
237 call TFT_surface_sensor ; ...update sensor data in surface mode |
535
cf68fe0c3002
NEW: Show a warning for each sensor if the sensor is end-of-life after calibration (Less then 8mV in Air at sea level)
heinrichsweikamp
parents:
530
diff
changeset
|
238 call TFT_sensor_surface_warning ; Show a warning arrow-down behind sensor readings when sensor is end-of-life |
530 | 239 movlw .9 |
240 cpfseq menupos3 ; in Sensor mV surface custom view? | |
241 bra surfloop_loop2a ; No | |
242 extern TFT_sensor_mV | |
243 call TFT_sensor_mV ; Yes, update mV readings (Each 1/4 second and not each second as in customview.asm) | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
244 |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
245 surfloop_loop2a: |
0 | 246 movlw .6 |
247 cpfseq menupos3 ; in compass view? | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
248 bra surfloop_loop2b ; No |
256
5b4ef0b9090d
place compass display code into compass_ops.asm
heinrichsweikamp
parents:
245
diff
changeset
|
249 extern TFT_surface_compass_heading |
0 | 250 call TFT_surface_compass_heading ; Yes, update compass heading value |
251 | |
476
7c10557c248e
no sensors in surface mode if the computer has no sensor inputs
heinrichsweikamp
parents:
382
diff
changeset
|
252 surfloop_loop2b: |
0 | 253 btfsc toggle_customview ; Next view? |
254 call surf_customview_toggle ; Yes, show next customview (and delete this flag) | |
255 | |
256 btfsc enable_screen_dumps ; =1: Ignore vin_usb, wait for "l" command (Screen dump) | |
257 bra surfloop_loop3 | |
258 btfsc vusb_in ; USB plugged in? | |
113 | 259 call comm_mode ; Start COMM mode |
0 | 260 bra surfloop_loop4 |
261 surfloop_loop3: | |
262 btfss vusb_in ; USB (still) plugged in? | |
263 bcf enable_screen_dumps ; No, clear flag | |
264 call rs232_get_byte | |
265 btfsc rs232_recieve_overflow | |
266 bra surfloop_loop4 | |
267 movlw "l" | |
268 cpfseq RCREG1 | |
269 bra surfloop_loop4 | |
270 call TFT_dump_screen ; Dump the screen contents | |
271 surfloop_loop4: | |
272 btfsc sleepmode ; Sleepmode active? | |
273 goto sleeploop ; Yes, switch into sleepmode! | |
274 | |
275 bra surfloop_loop ; loop surfacemode | |
276 | |
277 update_surfloop60: | |
278 ; One minute tasks for all modes | |
279 call TFT_date ; Update date | |
280 call calc_deko_surfmode ; calculate desaturation every minute | |
281 bcf oneminupdate | |
282 return | |
283 | |
284 extern check_cns_violation,check_warn_battery,check_and_store_gf_violation | |
285 surfmode_check_for_warnings: | |
286 movf warning_counter_backup,W | |
287 cpfseq warning_counter ; warning_counter_backup = warning_counter? | |
288 call TFT_clear_warning_text ; No, clear all warnings | |
289 movff warning_counter,warning_counter_backup ; copy warning_counter | |
290 | |
291 bcf warning_active ; Clear flag | |
292 clrf warning_counter ; Clear counter | |
293 | |
294 ; Warnings for all modes | |
295 call check_warn_battery ; Check if the battery level should be displayed/warned | |
205 | 296 rcall surfmode_check_for_nofly ; Check if nofly time should be shown |
297 rcall surfmode_check_for_desat ; Check if desat time should be shown | |
298 rcall surfmode_check_for_interval ; Check if surface interval should be shown | |
0 | 299 |
300 btfsc FLAG_apnoe_mode ; Done for Apnoe or Gauge mode | |
301 bra surfmode_check_for_warnings2 | |
302 btfsc FLAG_gauge_mode ; Done for Apnoe or Gauge mode | |
303 bra surfmode_check_for_warnings2 | |
304 | |
305 ; Warnings only in deco modes | |
306 call check_cns_violation ; Check CNS value and display it, if required | |
307 call check_and_store_gf_violation ; Check GF value and display it, if required | |
308 | |
309 surfmode_check_for_warnings2: | |
310 ; Setup warning_page number | |
311 incf warning_page,F | |
312 bcf STATUS,C | |
313 rlcf warning_page,W ; *2 | |
314 cpfsgt warning_counter ; > warning_counter | |
315 clrf warning_page ; No, clear | |
316 | |
317 ; Clear 2nd row of warnings if there is nothing to show (on this page) | |
318 btfss second_row_warning ; =1: The second row contains a warning | |
319 call TFT_clear_warning_text_2nd_row ; No, clear this row | |
320 return ; Done. | |
321 | |
322 surfmode_check_for_interval: | |
323 movf surface_interval+0,W ; Is interval null ? | |
133
939f1e83c4c2
BUGFIX: Surface interval was not displayed correctly in some cases
heinrichsweikamp
parents:
113
diff
changeset
|
324 iorwf surface_interval+1,W |
0 | 325 bnz surfmode_check_for_interval2 ; No |
326 return | |
327 surfmode_check_for_interval2: | |
328 incf warning_counter,F ; increase counter | |
329 call TFT_interval | |
330 return | |
331 | |
332 | |
333 surfmode_check_for_desat: | |
334 movf desaturation_time+0,W ; Is nofly null ? | |
335 iorwf desaturation_time+1,W | |
336 bnz surfmode_check_for_desat2 ; No | |
337 return | |
338 surfmode_check_for_desat2: | |
339 incf warning_counter,F ; increase counter | |
340 call TFT_desaturation_time | |
341 return | |
342 | |
343 surfmode_check_for_nofly: | |
344 movf nofly_time+0,W ; Is nofly null ? | |
345 iorwf nofly_time+1,W | |
346 bnz surfmode_check_for_nofly2 ; No... | |
347 return | |
348 surfmode_check_for_nofly2: | |
349 incf warning_counter,F ; increase counter | |
350 call TFT_nofly_time | |
351 return | |
352 | |
353 | |
354 ;============================================================================= | |
355 global calc_deko_surfmode | |
356 calc_deko_surfmode: | |
357 SAFE_2BYTE_COPY amb_pressure,int_I_pres_respiration ; copy surface air pressure to deco routine | |
358 call deco_calc_wo_deco_step_1_min ; calculate deco in surface mode | |
359 banksel common | |
360 return | |
361 | |
362 test_switches_surfmode: ; checks switches in surfacemode | |
363 btfsc switch_right | |
364 bra test_switches_surfmode2 | |
365 btfsc switch_left | |
366 bra test_switches_surfmode3 | |
367 | |
368 ; No button press | |
369 return | |
370 | |
371 test_switches_surfmode3: | |
382 | 372 movlw .6 |
373 cpfseq menupos3 ; in compass view? | |
374 bra test_switches_surfmode3a ; No | |
375 | |
376 btfsc premenu ; already shown "Bearing" | |
377 bra test_switches_surfmode3b ; Yes, remove it | |
378 | |
379 extern TFT_surf_set_bearing | |
380 call TFT_surf_set_bearing ; Yes. | |
381 bcf switch_left | |
382 return | |
383 | |
384 test_switches_surfmode3a: | |
0 | 385 bcf switch_left |
386 bsf menubit ; Enter Menu! | |
387 return | |
388 | |
382 | 389 test_switches_surfmode3b: |
390 ; Clear "Heading?" | |
391 WIN_BOX_BLACK .158,.190, .15, .99 ; top, bottom, left, right | |
392 bcf premenu | |
393 bcf switch_left | |
394 return | |
395 | |
0 | 396 test_switches_surfmode2: |
382 | 397 movlw .6 |
398 cpfseq menupos3 ; in compass view? | |
399 bra test_switches_surfmode2a ; No | |
400 btfss premenu ; "Heading?" shown? | |
401 bra test_switches_surfmode2a ; No | |
402 ; Set new heading | |
403 bcf premenu | |
404 bsf compass_bearing_set | |
405 movff compass_heading_shown+0,compass_bearing+0 | |
406 movff compass_heading_shown+1,compass_bearing+1 | |
407 bcf switch_right | |
408 return | |
409 | |
410 test_switches_surfmode2a: | |
0 | 411 bcf switch_right |
412 bsf toggle_customview | |
382 | 413 bcf premenu |
0 | 414 clrf timeout_counter2 ; and reset timeout |
415 return | |
416 | |
417 global timeout_surfmode | |
418 timeout_surfmode: | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
419 movlw timeout_surfacemode ; [s] Default timeout |
187
669b5d00706d
CHANGE: Longer timeout (4 min) for calibration menu
heinrichsweikamp
parents:
158
diff
changeset
|
420 btfsc menu_show_sensors2 ; In the "Calibrate" menu? |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
421 movlw timeout_calibrate_menu ; [s] CCR Calibrate Menu timeout |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
422 btfsc menubit ; in Menu? |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
423 bra timeout_testmode ; No, done. |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
424 ; Must be in surface mode |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
425 btfss FLAG_ccr_mode ; =1: CCR mode (Fixed ppO2 or Sensor) active |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
426 bra timeout_testmode ; No, not CCR |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
427 movlw timeout_ccr_surface ; [s] CCR Surface mode timeout |
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
428 |
0 | 429 global timeout_testmode |
430 timeout_testmode: | |
431 incf timeout_counter2,F ; increase timeout counter | |
432 cpfsgt timeout_counter2 ; Compare with timeout_counter2 | |
433 return ; return, no timeout | |
434 bsf sleepmode ; Set Flag | |
435 return ; Return | |
436 | |
437 END |