Mercurial > public > hwos_code
annotate src/surfmode.asm @ 630:4cd81bdbf15c
3.08 stable release
author | heinrichsweikamp |
---|---|
date | Fri, 21 Feb 2020 10:51:36 +0100 |
parents | 237931377539 |
children | 185ba2f91f59 |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
628 | 3 ; File surfmode.asm next combined generation V3.04.3 |
0 | 4 ; |
623 | 5 ; Surface Mode |
0 | 6 ; |
7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
8 ;============================================================================= | |
9 ; HISTORY | |
582 | 10 ; 2011-08-07 : [mH] moving from OSTC code |
0 | 11 |
582 | 12 #include "hwos.inc" ; Mandatory header |
13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | |
14 #include "start.inc" | |
15 #include "tft.inc" | |
16 #include "tft_outputs.inc" | |
17 #include "adc_lightsensor.inc" | |
18 #include "menu_processor.inc" | |
19 #include "strings.inc" | |
20 #include "sleepmode.inc" | |
623 | 21 #include "wait.inc" |
582 | 22 #include "external_flash.inc" |
23 #include "customview.inc" | |
24 #include "divemode.inc" | |
25 #include "mcp.inc" ; RX | |
26 #include "i2c.inc" | |
27 #include "comm.inc" | |
28 #include "eeprom_rs232.inc" | |
29 #include "calibrate.inc" | |
623 | 30 #include "rx_ops.inc" |
0 | 31 |
604 | 32 |
582 | 33 extern do_main_menu |
604 | 34 extern check_cns_violation |
35 extern check_warn_battery | |
623 | 36 extern check_and_store_sat_violation |
604 | 37 extern check_mbubbles |
38 | |
39 IFDEF _osct_logo | |
40 extern ostc_logo_block | |
41 ENDIF | |
582 | 42 |
623 | 43 IFDEF _compass |
44 extern TFT_surface_compass_heading | |
45 ENDIF | |
582 | 46 |
213 | 47 |
623 | 48 ;---- Private local variables ------------------------------------------------ |
49 | |
50 CBLOCK local1 ; max size is 16 byte !!! | |
604 | 51 ; currently not used |
52 ENDC ; used: 0 byte, remaining: 16 byte | |
582 | 53 |
0 | 54 |
582 | 55 #DEFINE menu_pos_row .215 |
56 #DEFINE menu_pos_column .1 | |
57 #DEFINE view_row .215 | |
58 #DEFINE view_column .124 | |
0 | 59 |
623 | 60 |
61 sfmode CODE | |
0 | 62 |
63 ;============================================================================= | |
64 ; Boot tasks for all modes | |
623 | 65 ; |
66 ; called after restart via the battery selection, after compass calibration, | |
67 ; and via ghostwriter at the end of a dive | |
68 ; | |
0 | 69 global surfloop |
70 surfloop: | |
623 | 71 clrf STKPTR ; clear return addresses stack |
72 ; clrf CCP1CON ; stop PWM | |
73 ; bcf PORTC,2 ; pull PWM output to GND | |
628 | 74 ; clrf CCPR1L ; backlight off |
623 | 75 call TFT_boot ; initialize TFT (includes clear screen) |
245 | 76 |
623 | 77 btfsc restart_fast ; shall make a fast restart? |
78 bra surfloop_1 ; YES | |
0 | 79 |
623 | 80 ; show heinrichsweikamp logo |
604 | 81 WIN_TOP .40 |
582 | 82 WIN_LEFT .10 |
623 | 83 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block |
0 | 84 |
623 | 85 ; show textual OSTC logo |
604 | 86 WIN_COLOR color_white |
87 WIN_STD .30,.90 ; column, row | |
88 STRCPY_PRINT "Open Source" ; show OSTC banner text, line 1 | |
89 WIN_STD .20,.130 ; column, row | |
90 STRCPY_PRINT "Tauch-Computer" ; show OSTC banner text, line 2 | |
91 | |
92 WIN_COLOR color_white | |
93 WIN_SMALL .35,.180 | |
94 PUTC "v" ; print v | |
95 call TFT_cat_firmware ; print x.y | |
623 | 96 PUTC " " ; print _ |
604 | 97 call TFT_cat_beta_release ; print BetaZ or Release |
98 STRCAT_PRINT "" ; finalize output | |
99 bcf win_invert ; clean up eventual color-coding | |
100 call TFT_standard_color ; ditto | |
623 | 101 call TFT_Display_FadeIn ; dim up the display |
604 | 102 |
623 | 103 surfloop_1: |
104 ;---- Do all useful initializations that take time ----------------------- | |
604 | 105 |
623 | 106 ; set deco mode flags |
107 call restart_set_modes_and_flags | |
108 | |
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 | |
111 | |
112 call I2C_sleep_compass ; shut down compass | |
113 | |
0 | 114 clrf ext_flash_address+0 |
115 clrf ext_flash_address+1 | |
116 clrf ext_flash_address+2 | |
117 | |
623 | 118 IFDEF _ccr_pscr |
119 movlw surface_sp ; load default surface setpoint (in cbar) | |
120 movff WREG,char_I_const_ppO2 ; store it as current setpoint | |
121 ENDIF | |
122 | |
123 IFDEF _external_sensor | |
124 call transmit_setpoint ; transmit current setpoint (in cbar) via S8 digital interface (currently disabled) | |
125 ENDIF | |
221
90923a081ae7
minor: configure buttons during splash screen
heinrichsweikamp
parents:
213
diff
changeset
|
126 |
623 | 127 bcf surfmode_menu ; not in surface menu (any more) |
128 bcf compass_menu ; not in "set bearing" selection (any more) | |
129 bcf bailout_mode ; not in bailout menu (any more) | |
0 | 130 |
623 | 131 bcf switch_left ; clear intermediate button event since start/restart |
132 bcf switch_right ; clear intermediate button event since start/restart | |
133 | |
134 btfsc restart_fast ; shall make a fast restart? | |
135 bra surfloop_2 ; YES | |
604 | 136 |
628 | 137 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code) |
138 banksel common ; back to bank common | |
139 | |
604 | 140 call wait_1s ; wait <= 1 second |
141 call wait_1s ; wait 1 second | |
142 call wait_1s ; wait 1 second | |
0 | 143 |
144 ;---- Fade to standard surface view -------------------------------------- | |
145 | |
623 | 146 call TFT_Display_FadeOut ; dim down display to black screen |
147 call TFT_ClearScreen ; clear screen | |
148 | |
149 surfloop_2: | |
604 | 150 WIN_TOP .0 |
582 | 151 WIN_LEFT .0 |
152 WIN_FONT FT_SMALL | |
623 | 153 bcf win_invert ; clear flag for inverted text |
0 | 154 |
623 | 155 ; show button functionalities |
582 | 156 WIN_COLOR color_lightblue |
157 WIN_SMALL menu_pos_column,menu_pos_row | |
623 | 158 STRCPY_TEXT_PRINT tMenu ; show "<Menu" |
582 | 159 WIN_SMALL view_column,view_row |
623 | 160 STRCPY_TEXT_PRINT tView ; show "View>" |
582 | 161 call TFT_standard_color |
0 | 162 |
623 | 163 |
164 ;---- Logo in upper right corner ----------------------------------------- | |
628 | 165 |
623 | 166 ; show textual OSTC logo |
167 WIN_COLOR color_white ; set text color to white | |
168 WIN_STD .100,.2 ; set output position | |
604 | 169 STRCPY_PRINT "OSTC" ; show "OSTC" |
623 | 170 WIN_COLOR color_cyan ; set text color to cyan |
171 WIN_TINY .138,.2 ; set output position | |
604 | 172 STRCPY_PRINT "hwOS" ; show "hwOS" |
623 | 173 WIN_TINY .137,.14 ; set output position |
174 IFDEF _hwos_sport | |
175 STRCPY_PRINT "sport" ; show "sport" | |
176 ELSE | |
604 | 177 STRCPY_PRINT "tech" ; show "tech" |
178 ENDIF | |
623 | 179 WIN_TINY .100,.32 ; set output position |
180 call TFT_show_firmware ; show firmware version | |
0 | 181 |
182 | |
623 | 183 ;---- fill screen -------------------------------------------------------- |
184 call get_battery_voltage ; get battery voltage | |
185 call TFT_batt_surfmode ; display battery voltage | |
186 call TFT_time_surfmode ; display time | |
187 call TFT_date_surfmode ; display date | |
188 call TFT_pres_surfmode ; display surface pressure | |
189 call TFT_temp_surfmode ; display temperature | |
190 call TFT_decotype_surface ; display deco mode | |
582 | 191 |
623 | 192 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 | |
0 | 194 |
623 | 195 movff customview_surfmode,active_customview ; reload last custom view |
196 call surf_customview_mask ; redraw last custom view | |
582 | 197 |
623 | 198 call TFT_Display_FadeIn ; display resulting surface screen |
0 | 199 |
604 | 200 IFDEF _screendump |
623 | 201 btfsc screen_dump_avail ; screen dump function enabled? |
202 call enable_rs232 ; YES - activate RS232 (also sets CPU to normal speed) | |
604 | 203 ENDIF |
204 | |
623 | 205 bcf restart_fast ; clear flag for fast restart |
206 bsf imprint_surfmode_data ; start imprinting surface mode data | |
0 | 207 |
623 | 208 bcf switch_left ; clear pending left button event |
209 bcf switch_right ; clear pending right button event | |
0 | 210 |
623 | 211 rcall reset_timeout_surfmode ; reset timeout |
582 | 212 |
623 | 213 surfloop_loop: |
214 ; call TFT_debug_output ; optional debug output | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
215 |
623 | 216 call test_switches_surfmode ; check switches |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
217 |
623 | 218 btfsc request_next_custview ; shall show next custom view? |
219 call surf_customview_toggle ; YES - show next custom view (and clear this flag) | |
0 | 220 |
623 | 221 btfss surfmode_menu ; shall enter surface menu? |
222 bra surfloop_loop_1 ; NO | |
223 bcf imprint_surfmode_data ; YES - stop imprinting surface mode data | |
224 goto do_main_menu ; - goto surface menu | |
582 | 225 |
623 | 226 surfloop_loop_1: |
227 rcall housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode | |
228 bra surfloop_loop ; loop in surface mode | |
582 | 229 |
0 | 230 |
231 surfmode_check_for_warnings: | |
623 | 232 clrf message_counter ; clear message counter |
560 | 233 |
604 | 234 ; warnings for all modes |
623 | 235 call check_warn_battery ; check if the battery level should be displayed/warned |
0 | 236 |
623 | 237 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode |
582 | 238 bra surfmode_check_for_warnings2 |
623 | 239 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode |
582 | 240 bra surfmode_check_for_warnings2 |
0 | 241 |
604 | 242 ; warnings only in deco modes |
623 | 243 call check_and_store_sat_violation ; check/show tissue saturation |
244 call check_cns_violation ; check/show CNS value | |
245 call check_mbubbles ; check/show micro bubbles warning | |
246 movff int_O_lead_supersat+1,WREG ; get upper byte of leading tissue's supersaturation | |
247 btfsc WREG,int_warning_flag ; check if the warning flag is set | |
248 bra surfmode_check_for_warnings2 ; YES - outside model | |
249 rcall surfmode_check_for_desat ; NO - check/display desaturation time | |
250 rcall surfmode_check_for_nofly ; NO - check/display no-fly time | |
560 | 251 |
0 | 252 surfmode_check_for_warnings2: |
604 | 253 ; setup message page number |
623 | 254 incf message_page,F ; increment page number |
255 bcf STATUS,C ; clear carry bit | |
256 rlcf message_page,W ; each page can take two messages | |
257 cpfsgt message_counter ; number of actual messages > message capacity ? | |
258 clrf message_page ; NO - all messages could be shown, restart from first page next time | |
0 | 259 |
623 | 260 ; clear both rows if there is nothing to show at all |
261 tstfsz message_counter ; any message to show? | |
262 bra surfmode_check_for_warnings3 ; YES - look if second row needs to be cleared | |
263 goto TFT_clear_message_window ; NO - clear complete message area and return | |
0 | 264 |
582 | 265 surfmode_check_for_warnings3: |
623 | 266 ; clear 2nd row of messages if there is nothing to show (on this page) |
267 btfss message_2nd_row_used ; does the 2nd row contain a message? | |
268 goto TFT_clear_message_window_row2 ; NO - clear the 2nd row and return | |
269 return ; YES - done | |
270 | |
0 | 271 |
272 surfmode_check_for_desat: | |
560 | 273 banksel int_O_desaturation_time |
604 | 274 movf int_O_desaturation_time+0,W |
582 | 275 iorwf int_O_desaturation_time+1,W |
623 | 276 banksel common ; back to bank common |
277 bnz surfmode_check_for_desat_1 ; is the desat-time > 0 ? | |
278 return ; NO - done | |
279 surfmode_check_for_desat_1: | |
280 incf message_counter,F ; YES - increase counter | |
281 call TFT_desaturation_time ; - show desaturation time | |
282 return ; - done | |
0 | 283 |
284 surfmode_check_for_nofly: | |
560 | 285 banksel int_O_nofly_time |
604 | 286 movf int_O_nofly_time+0,W |
582 | 287 iorwf int_O_nofly_time+1,W |
623 | 288 banksel common ; back to bank common |
289 bnz surfmode_check_for_nofly_1 ; is the nofly-time > 0 ? | |
290 return ; NO - done | |
291 surfmode_check_for_nofly_1: | |
292 incf message_counter,F ; YES - increase counter | |
293 call TFT_nofly_time ; - show nofly-time | |
294 return ; - done | |
0 | 295 |
296 | |
297 ;============================================================================= | |
560 | 298 |
623 | 299 test_switches_surfmode: ; check buttons in surface mode |
300 btfsc switch_right ; right button pressed? | |
301 bra test_switches_surfmode2 ; YES | |
302 btfsc switch_left ; left button pressed? | |
303 bra test_switches_surfmode3 ; YES | |
304 return ; NO to both - done | |
305 | |
306 test_switches_surfmode2: ; right button pressed | |
307 bcf switch_right ; clear button event | |
308 rcall reset_timeout_surfmode ; reset timeout | |
309 IFDEF _compass | |
310 movlw .6 ; coding for surface custom compass view | |
311 cpfseq active_customview ; in compass view? | |
312 bra test_switches_surfmode2a ; NO | |
313 btfss compass_menu ; "set course" selection shown? | |
314 bra test_switches_surfmode2a ; NO | |
315 bsf compass_bearing_set ; YES - set new course | |
316 MOVII compass_heading_shown,compass_bearing | |
317 bra test_switches_surfmode3b ; - clear "Course" label and return | |
318 ENDIF | |
319 test_switches_surfmode2a: | |
320 bsf request_next_custview ; request next custom view | |
321 bcf compass_menu ; "set course" selection not shown anymore | |
0 | 322 return |
323 | |
623 | 324 test_switches_surfmode3: ; left button pressed |
325 bcf switch_left ; clear button event | |
326 rcall reset_timeout_surfmode ; reset timeout | |
327 IFDEF _compass | |
328 movlw .6 ; coding for surface custom view compass | |
329 cpfseq active_customview ; in compass view? | |
604 | 330 bra test_switches_surfmode3a ; NO |
623 | 331 btfsc compass_menu ; YES - "set course" selection already shown? |
332 bra test_switches_surfmode3b ; YES - remove it | |
333 call TFT_surf_set_bearing ; NO - show it | |
628 | 334 return ; - done |
623 | 335 ENDIF |
382 | 336 test_switches_surfmode3a: |
623 | 337 bcf compass_bearing_set ; clear course on entering menu |
338 bsf surfmode_menu ; flag that the surface menu shall be entered | |
582 | 339 return |
382 | 340 |
623 | 341 IFDEF _compass |
342 test_switches_surfmode3b: | |
628 | 343 WIN_BOX_BLACK .158,.190, .15, .99 ; clear "Course" label (top, bottom, left, right) |
623 | 344 bcf compass_menu ; clear flag for "set course" selection |
582 | 345 return |
623 | 346 ENDIF |
382 | 347 |
623 | 348 |
349 ; handle data imprinting, screen dump request, timeout and entering dive mode | |
350 global housekeeping | |
351 housekeeping: | |
352 btfss trigger_full_second ; new 1/1 second begun? | |
353 bra housekeeping_1 ; NO | |
354 | |
355 ; tasks any new second | |
356 bcf trigger_full_second ; YES - clear flag | |
357 call get_battery_voltage ; - get battery voltage | |
358 | |
359 btfsc imprint_time_date ; - shall imprint the current time & date? | |
360 call TFT_show_time_date_menu ; YES - imprint time and date on display (copies running time to latch registers) | |
361 | |
362 IFDEF _rx_functions | |
363 btfsc tr_functions_activated ; - TR functions activated? | |
364 call I2C_get_tankdata ; YES - get new transmitter data | |
365 | |
366 btfsc imprint_xmitter_pres ; - shall imprint transmitter ID and pressure? | |
367 call TFT_menu_tank_pres ; YES - imprint transmitter ID and pressure | |
368 ENDIF | |
369 | |
370 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
371 bra housekeeping_0 ; NO | |
372 call TFT_time_surfmode ; YES - update displayed time | |
373 call TFT_batt_surfmode ; - update displayed battery voltage | |
374 btfss timebase_1sec,0 ; - on even second? | |
375 call surfmode_check_for_warnings ; YES - check for warnings and display/update them | |
376 | |
377 IFDEF _rx_functions | |
378 btfss tr_functions_activated ; - TR functions activated? | |
379 bra housekeeping_0 ; NO - skip tank pressure part | |
380 | |
381 call get_pressure_readings ; YES - get pressure readings | |
382 call TFT_surface_tank_pres ; - update first gas/diluent pressure | |
383 | |
384 movf active_customview,W ; - get current custom view | |
385 xorlw .10 ; - coding of tank data custom view | |
386 btfsc STATUS,Z ; - equal? | |
387 call TFT_surface_tankdata ; YES - update tank data custom view | |
388 ENDIF | |
389 | |
390 housekeeping_0: | |
391 bsf restart_fast ; default to doing a fast restart (no logos) | |
392 call set_dive_modes ; check if dive mode needs to be entered, will set dive mode flag if yes | |
393 btfsc simulatormode ; in simulator mode? | |
394 bra housekeeping_1 ; YES - can't restart or go to sleep without prior cleanup | |
395 btfsc divemode ; NO - need to enter dive mode? | |
396 goto restart ; YES - restart, will proceed to dive mode | |
397 btfss trigger_timeout ; NO - timeout? | |
398 bra housekeeping_1 ; NO | |
399 btfsc surfmode_menu ; YES - in surface menus? | |
400 goto restart ; YES - goto restart, will proceed to surface mode | |
401 bcf restart_fast ; NO - set next restart to be done slow, i.e. with logos | |
402 goto sleeploop ; - goto sleep mode | |
403 | |
404 housekeeping_1: | |
405 btfss trigger_quarter_second ; new 1/4 second begun? | |
406 bra housekeeping_2 ; NO | |
0 | 407 |
623 | 408 ; tasks any new 1/4 second |
409 bcf trigger_quarter_second ; YES - clear flag | |
410 IFDEF _external_sensor | |
411 btfsc imprint_sensor_mv ; - shall imprint sensor mV data? | |
412 call TFT_menu_calibrate ; YES - imprint sensor mV data | |
413 ENDIF ; _external_sensor | |
414 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
415 bra housekeeping_2 ; NO | |
416 btfsc trigger_pres_cur_changed ; YES - pressure changed? | |
417 call TFT_pres_surfmode ; YES - display surface pressure | |
418 bcf trigger_pres_cur_changed ; - clear flag (anyhow) | |
419 IFDEF _compass | |
420 movf active_customview,W ; - get current custom view | |
421 xorlw .6 ; - coding of compass custom view | |
422 btfsc STATUS,Z ; - equal? | |
423 call TFT_surface_compass_heading ; YES - update compass view | |
424 ENDIF ; _compass | |
425 IFDEF _external_sensor | |
426 btfsc FLAG_ccr_mode ; - in CCR mode? | |
427 bra housekeeping_1a ; - YES - handle sensors | |
428 btfsc FLAG_pscr_mode ; - in pSCR mode? | |
429 bra housekeeping_1a ; YES - handle sensors | |
430 bra housekeeping_2 ; NO to both | |
431 housekeeping_1a: ; handle sensors | |
432 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: sensor, =2: autoSP | |
433 decfsz WREG ; opt_ccr_mode = 1 (sensor)? | |
434 bra housekeeping_2 ; NO - skip sensor readings | |
435 call calc_deko_divemode_sensor ; YES - read & calculate sensor data | |
436 call TFT_surface_sensor ; - update displayed sensor data | |
437 call TFT_sensor_surface_warning ; - show a down-arrow behind sensor readings when sensor is at end-of-life | |
438 movf active_customview,W ; - get current custom view | |
439 xorlw .9 ; - coding of sensor mV readings custom view | |
440 btfsc STATUS,Z ; - equal? | |
441 call TFT_sensor_mV ; YES - update mV readings | |
442 ENDIF ; _external_sensor | |
443 housekeeping_2: | |
444 btfss trigger_full_minute ; new 1/1 minute begun? | |
445 bra housekeeping_3 ; NO | |
446 | |
447 ; tasks any new minute | |
448 bcf trigger_full_minute ; YES - clear flag | |
449 btfsc simulatormode ; - in simulator mode? | |
450 bra housekeeping_2a ; YES - real tissues are in the vault, skip desaturation calculations | |
451 call deco_calc_dive_interval_1min; NO - calculate 1 minute at surface conditions (C-code) | |
452 call deco_calc_desaturation_time ; - calculate desaturation and no-fly/no-altitude time (C-code) | |
453 banksel common ; - back to bank common | |
454 housekeeping_2a: | |
455 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
456 bra housekeeping_3 ; NO | |
457 call TFT_date_surfmode ; YES - update displayed date | |
458 | |
459 btfsc trigger_temp_changed ; - temperature changed? | |
460 call TFT_temp_surfmode ; YES - display temperature | |
461 bcf trigger_temp_changed ; - clear flag (anyhow) | |
462 | |
463 movf active_customview,W ; - get current custom view | |
464 xorlw .5 ; - coding of tissue custom view | |
465 btfsc STATUS,Z ; - equal? | |
466 call TFT_surface_tissues ; YES - update tissue diagram | |
467 | |
468 movf active_customview,W ; - get current custom view | |
469 xorlw .8 ; - coding of last dive info custom view | |
470 btfsc STATUS,Z ; - equal? | |
471 call TFT_surface_lastdive ; YES - update last dive infos | |
472 | |
473 housekeeping_3: | |
474 ; tasks any round | |
475 IFDEF _screendump | |
476 btfsc screen_dump_avail ; screen dump function enabled? | |
477 call TFT_dump_screen_check ; YES - check if requested and do it | |
478 ELSE | |
479 btfsc comm_mode_disabled ; COMM mode disabled? | |
480 return ; YES - done | |
604 | 481 ENDIF |
623 | 482 btfss surfmode_menu ; in surface menus? |
483 return ; NO - done | |
484 | |
485 btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
486 return ; YES - suppress COMM mode to not jeopardize backup/restore of tissue data | |
487 | |
488 btfss vusb_in ; USB plugged in? | |
489 return ; NO - done | |
490 IFDEF _screendump | |
491 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 | |
493 ENDIF | |
629 | 494 btfss ble_available ; Skip "USB" check in all Bluetooth models (Required for very old OSTC sport) |
623 | 495 goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal |
629 | 496 return |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
497 |
623 | 498 global reset_timeout_surfmode |
499 reset_timeout_surfmode: | |
500 movlw surfmode_timeout_default ; load default timeout value | |
501 btfsc imprint_sensor_mv ; currently imprinting O2 sensor mV data? | |
502 movlw surfmode_timeout_calibrate ; YES - replace with CCR Calibrate Menu timeout | |
503 btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
504 movlw surfmode_timeout_simulator ; YES - replace with simulator timeout | |
505 IFDEF _rx_functions | |
506 btfsc imprint_xmitter_ID ; currently selecting pressure transmitter? | |
507 movlw surfmode_timeout_xmitter ; YES - replace with transmitter selection timeout | |
508 ENDIF ; _rx_functions | |
509 IFDEF _external_sensor | |
510 btfsc surfmode_menu ; in surface menu? | |
511 bra reset_timeout_time ; YES - keep timeout value | |
512 btfsc FLAG_ccr_mode ; NO - in CCR mode? | |
513 bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode | |
514 btfsc FLAG_ccr_mode ; NO - in pSCR mode? | |
515 bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode | |
516 bra reset_timeout_time ; NO - keep timeout value | |
517 reset_timeout_surfmode_loop: | |
518 movff opt_ccr_mode,lo ; get loop mode (=0: fixed/calculated SP, =1: sensor, =2: auto SP) | |
519 decfsz lo,f ; in sensor mode? | |
520 bra reset_timeout_time ; NO - keep timeout value | |
521 movlw surfmode_timeout_sensor ; YES - replace with sensor mode timeout | |
522 ENDIF ; _external_sensor | |
523 ;bra reset_timeout_time ; - set timeout value | |
0 | 524 |
623 | 525 |
526 global reset_timeout_time | |
527 reset_timeout_time: ; entry point with timeout value in WREG | |
528 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload | |
529 bsf reset_timeout ; request ISR to reset the timeout | |
530 bcf trigger_timeout ; clear any pending timeout trigger | |
531 return ; done | |
532 | |
533 ;----------------------------------------------------------------------------- | |
534 | |
535 END |