Mercurial > public > hwos_code
annotate src/surfmode.asm @ 631:185ba2f91f59
3.09 beta 1 release
author | heinrichsweikamp |
---|---|
date | Fri, 28 Feb 2020 15:45:07 +0100 |
parents | 237931377539 |
children | 4050675965ea |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
631 | 3 ; File surfmode.asm next combined generation V3.08.8 |
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 | |
631 | 114 CLRT ext_flash_address |
115 | |
0 | 116 |
623 | 117 IFDEF _ccr_pscr |
118 movlw surface_sp ; load default surface setpoint (in cbar) | |
119 movff WREG,char_I_const_ppO2 ; store it as current setpoint | |
120 ENDIF | |
121 | |
122 IFDEF _external_sensor | |
123 call transmit_setpoint ; transmit current setpoint (in cbar) via S8 digital interface (currently disabled) | |
124 ENDIF | |
221
90923a081ae7
minor: configure buttons during splash screen
heinrichsweikamp
parents:
213
diff
changeset
|
125 |
623 | 126 bcf surfmode_menu ; not in surface menu (any more) |
127 bcf compass_menu ; not in "set bearing" selection (any more) | |
0 | 128 |
623 | 129 bcf switch_left ; clear intermediate button event since start/restart |
130 bcf switch_right ; clear intermediate button event since start/restart | |
131 | |
132 btfsc restart_fast ; shall make a fast restart? | |
133 bra surfloop_2 ; YES | |
604 | 134 |
628 | 135 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code) |
136 banksel common ; back to bank common | |
137 | |
604 | 138 call wait_1s ; wait <= 1 second |
139 call wait_1s ; wait 1 second | |
140 call wait_1s ; wait 1 second | |
0 | 141 |
142 ;---- Fade to standard surface view -------------------------------------- | |
143 | |
623 | 144 call TFT_Display_FadeOut ; dim down display to black screen |
145 call TFT_ClearScreen ; clear screen | |
146 | |
147 surfloop_2: | |
604 | 148 WIN_TOP .0 |
582 | 149 WIN_LEFT .0 |
150 WIN_FONT FT_SMALL | |
623 | 151 bcf win_invert ; clear flag for inverted text |
0 | 152 |
623 | 153 ; show button functionalities |
582 | 154 WIN_COLOR color_lightblue |
155 WIN_SMALL menu_pos_column,menu_pos_row | |
623 | 156 STRCPY_TEXT_PRINT tMenu ; show "<Menu" |
582 | 157 WIN_SMALL view_column,view_row |
623 | 158 STRCPY_TEXT_PRINT tView ; show "View>" |
582 | 159 call TFT_standard_color |
0 | 160 |
623 | 161 |
162 ;---- Logo in upper right corner ----------------------------------------- | |
628 | 163 |
623 | 164 ; show textual OSTC logo |
165 WIN_COLOR color_white ; set text color to white | |
166 WIN_STD .100,.2 ; set output position | |
604 | 167 STRCPY_PRINT "OSTC" ; show "OSTC" |
623 | 168 WIN_COLOR color_cyan ; set text color to cyan |
169 WIN_TINY .138,.2 ; set output position | |
604 | 170 STRCPY_PRINT "hwOS" ; show "hwOS" |
623 | 171 WIN_TINY .137,.14 ; set output position |
172 IFDEF _hwos_sport | |
173 STRCPY_PRINT "sport" ; show "sport" | |
174 ELSE | |
604 | 175 STRCPY_PRINT "tech" ; show "tech" |
176 ENDIF | |
623 | 177 WIN_TINY .100,.32 ; set output position |
178 call TFT_show_firmware ; show firmware version | |
0 | 179 |
180 | |
623 | 181 ;---- fill screen -------------------------------------------------------- |
182 call get_battery_voltage ; get battery voltage | |
183 call TFT_batt_surfmode ; display battery voltage | |
184 call TFT_time_surfmode ; display time | |
185 call TFT_date_surfmode ; display date | |
186 call TFT_pres_surfmode ; display surface pressure | |
187 call TFT_temp_surfmode ; display temperature | |
188 call TFT_decotype_surface ; display deco mode | |
582 | 189 |
623 | 190 TSTOSS opt_dive_mode ; in OC? (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR) |
191 call TFT_show_OC_startgas_surface ; YES - show first gas and "OSTC2-like" active gases | |
0 | 192 |
631 | 193 ; configure tissue graphics |
194 bcf tissue_graphic_mode ; select surface mode | |
195 bsf tissue_graphic_cns ; show CNS value | |
196 | |
197 bsf tissue_graphic_layout ; default to N2+He | |
198 TSTOSS opt_tissue_graphics ; shall show press+sat? | |
199 bcf tissue_graphic_layout ; YES - show press+sat | |
200 | |
201 bcf tissue_graphic_gf ; default to none-GF | |
202 TSTOSC char_I_model ; GF factors enabled? | |
203 bsf tissue_graphic_gf ; YES - show GF lines | |
204 | |
623 | 205 movff customview_surfmode,active_customview ; reload last custom view |
206 call surf_customview_mask ; redraw last custom view | |
582 | 207 |
623 | 208 call TFT_Display_FadeIn ; display resulting surface screen |
0 | 209 |
604 | 210 IFDEF _screendump |
623 | 211 btfsc screen_dump_avail ; screen dump function enabled? |
212 call enable_rs232 ; YES - activate RS232 (also sets CPU to normal speed) | |
604 | 213 ENDIF |
214 | |
623 | 215 bcf restart_fast ; clear flag for fast restart |
216 bsf imprint_surfmode_data ; start imprinting surface mode data | |
0 | 217 |
623 | 218 bcf switch_left ; clear pending left button event |
219 bcf switch_right ; clear pending right button event | |
0 | 220 |
623 | 221 rcall reset_timeout_surfmode ; reset timeout |
582 | 222 |
623 | 223 surfloop_loop: |
224 ; call TFT_debug_output ; optional debug output | |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
225 |
623 | 226 call test_switches_surfmode ; check switches |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
227 |
623 | 228 btfsc request_next_custview ; shall show next custom view? |
229 call surf_customview_toggle ; YES - show next custom view (and clear this flag) | |
0 | 230 |
623 | 231 btfss surfmode_menu ; shall enter surface menu? |
232 bra surfloop_loop_1 ; NO | |
233 bcf imprint_surfmode_data ; YES - stop imprinting surface mode data | |
234 goto do_main_menu ; - goto surface menu | |
582 | 235 |
623 | 236 surfloop_loop_1: |
237 rcall housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode | |
238 bra surfloop_loop ; loop in surface mode | |
582 | 239 |
0 | 240 |
241 surfmode_check_for_warnings: | |
623 | 242 clrf message_counter ; clear message counter |
560 | 243 |
604 | 244 ; warnings for all modes |
623 | 245 call check_warn_battery ; check if the battery level should be displayed/warned |
0 | 246 |
623 | 247 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode |
582 | 248 bra surfmode_check_for_warnings2 |
623 | 249 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode |
582 | 250 bra surfmode_check_for_warnings2 |
0 | 251 |
604 | 252 ; warnings only in deco modes |
623 | 253 call check_and_store_sat_violation ; check/show tissue saturation |
254 call check_cns_violation ; check/show CNS value | |
255 call check_mbubbles ; check/show micro bubbles warning | |
256 movff int_O_lead_supersat+1,WREG ; get upper byte of leading tissue's supersaturation | |
257 btfsc WREG,int_warning_flag ; check if the warning flag is set | |
258 bra surfmode_check_for_warnings2 ; YES - outside model | |
259 rcall surfmode_check_for_desat ; NO - check/display desaturation time | |
260 rcall surfmode_check_for_nofly ; NO - check/display no-fly time | |
560 | 261 |
0 | 262 surfmode_check_for_warnings2: |
604 | 263 ; setup message page number |
623 | 264 incf message_page,F ; increment page number |
265 bcf STATUS,C ; clear carry bit | |
266 rlcf message_page,W ; each page can take two messages | |
267 cpfsgt message_counter ; number of actual messages > message capacity ? | |
268 clrf message_page ; NO - all messages could be shown, restart from first page next time | |
0 | 269 |
623 | 270 ; clear both rows if there is nothing to show at all |
271 tstfsz message_counter ; any message to show? | |
272 bra surfmode_check_for_warnings3 ; YES - look if second row needs to be cleared | |
273 goto TFT_clear_message_window ; NO - clear complete message area and return | |
0 | 274 |
582 | 275 surfmode_check_for_warnings3: |
623 | 276 ; clear 2nd row of messages if there is nothing to show (on this page) |
277 btfss message_2nd_row_used ; does the 2nd row contain a message? | |
278 goto TFT_clear_message_window_row2 ; NO - clear the 2nd row and return | |
279 return ; YES - done | |
280 | |
0 | 281 |
282 surfmode_check_for_desat: | |
560 | 283 banksel int_O_desaturation_time |
604 | 284 movf int_O_desaturation_time+0,W |
582 | 285 iorwf int_O_desaturation_time+1,W |
623 | 286 banksel common ; back to bank common |
287 bnz surfmode_check_for_desat_1 ; is the desat-time > 0 ? | |
288 return ; NO - done | |
289 surfmode_check_for_desat_1: | |
290 incf message_counter,F ; YES - increase counter | |
291 call TFT_desaturation_time ; - show desaturation time | |
292 return ; - done | |
0 | 293 |
294 surfmode_check_for_nofly: | |
560 | 295 banksel int_O_nofly_time |
604 | 296 movf int_O_nofly_time+0,W |
582 | 297 iorwf int_O_nofly_time+1,W |
623 | 298 banksel common ; back to bank common |
299 bnz surfmode_check_for_nofly_1 ; is the nofly-time > 0 ? | |
300 return ; NO - done | |
301 surfmode_check_for_nofly_1: | |
302 incf message_counter,F ; YES - increase counter | |
303 call TFT_nofly_time ; - show nofly-time | |
304 return ; - done | |
0 | 305 |
306 | |
307 ;============================================================================= | |
560 | 308 |
623 | 309 test_switches_surfmode: ; check buttons in surface mode |
310 btfsc switch_right ; right button pressed? | |
311 bra test_switches_surfmode2 ; YES | |
312 btfsc switch_left ; left button pressed? | |
313 bra test_switches_surfmode3 ; YES | |
314 return ; NO to both - done | |
315 | |
316 test_switches_surfmode2: ; right button pressed | |
317 bcf switch_right ; clear button event | |
631 | 318 rcall reset_timeout_surfmode ; set up timeout |
623 | 319 IFDEF _compass |
320 movlw .6 ; coding for surface custom compass view | |
321 cpfseq active_customview ; in compass view? | |
322 bra test_switches_surfmode2a ; NO | |
323 btfss compass_menu ; "set course" selection shown? | |
324 bra test_switches_surfmode2a ; NO | |
325 bsf compass_bearing_set ; YES - set new course | |
326 MOVII compass_heading_shown,compass_bearing | |
327 bra test_switches_surfmode3b ; - clear "Course" label and return | |
328 ENDIF | |
329 test_switches_surfmode2a: | |
330 bsf request_next_custview ; request next custom view | |
331 bcf compass_menu ; "set course" selection not shown anymore | |
0 | 332 return |
333 | |
623 | 334 test_switches_surfmode3: ; left button pressed |
335 bcf switch_left ; clear button event | |
631 | 336 rcall reset_timeout_surfmode ; set up timeout |
623 | 337 IFDEF _compass |
338 movlw .6 ; coding for surface custom view compass | |
339 cpfseq active_customview ; in compass view? | |
604 | 340 bra test_switches_surfmode3a ; NO |
623 | 341 btfsc compass_menu ; YES - "set course" selection already shown? |
342 bra test_switches_surfmode3b ; YES - remove it | |
343 call TFT_surf_set_bearing ; NO - show it | |
628 | 344 return ; - done |
623 | 345 ENDIF |
382 | 346 test_switches_surfmode3a: |
623 | 347 bcf compass_bearing_set ; clear course on entering menu |
348 bsf surfmode_menu ; flag that the surface menu shall be entered | |
582 | 349 return |
382 | 350 |
623 | 351 IFDEF _compass |
352 test_switches_surfmode3b: | |
628 | 353 WIN_BOX_BLACK .158,.190, .15, .99 ; clear "Course" label (top, bottom, left, right) |
623 | 354 bcf compass_menu ; clear flag for "set course" selection |
582 | 355 return |
623 | 356 ENDIF |
382 | 357 |
623 | 358 |
359 ; handle data imprinting, screen dump request, timeout and entering dive mode | |
360 global housekeeping | |
361 housekeeping: | |
362 btfss trigger_full_second ; new 1/1 second begun? | |
363 bra housekeeping_1 ; NO | |
364 | |
365 ; tasks any new second | |
366 bcf trigger_full_second ; YES - clear flag | |
367 call get_battery_voltage ; - get battery voltage | |
368 | |
369 btfsc imprint_time_date ; - shall imprint the current time & date? | |
370 call TFT_show_time_date_menu ; YES - imprint time and date on display (copies running time to latch registers) | |
371 | |
372 IFDEF _rx_functions | |
373 btfsc tr_functions_activated ; - TR functions activated? | |
374 call I2C_get_tankdata ; YES - get new transmitter data | |
375 | |
376 btfsc imprint_xmitter_pres ; - shall imprint transmitter ID and pressure? | |
377 call TFT_menu_tank_pres ; YES - imprint transmitter ID and pressure | |
378 ENDIF | |
379 | |
380 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
381 bra housekeeping_0 ; NO | |
382 call TFT_time_surfmode ; YES - update displayed time | |
383 call TFT_batt_surfmode ; - update displayed battery voltage | |
384 btfss timebase_1sec,0 ; - on even second? | |
385 call surfmode_check_for_warnings ; YES - check for warnings and display/update them | |
386 | |
387 IFDEF _rx_functions | |
388 btfss tr_functions_activated ; - TR functions activated? | |
389 bra housekeeping_0 ; NO - skip tank pressure part | |
390 | |
391 call get_pressure_readings ; YES - get pressure readings | |
392 call TFT_surface_tank_pres ; - update first gas/diluent pressure | |
393 | |
394 movf active_customview,W ; - get current custom view | |
395 xorlw .10 ; - coding of tank data custom view | |
396 btfsc STATUS,Z ; - equal? | |
397 call TFT_surface_tankdata ; YES - update tank data custom view | |
398 ENDIF | |
399 | |
400 housekeeping_0: | |
401 bsf restart_fast ; default to doing a fast restart (no logos) | |
402 call set_dive_modes ; check if dive mode needs to be entered, will set dive mode flag if yes | |
403 btfsc simulatormode ; in simulator mode? | |
404 bra housekeeping_1 ; YES - can't restart or go to sleep without prior cleanup | |
405 btfsc divemode ; NO - need to enter dive mode? | |
406 goto restart ; YES - restart, will proceed to dive mode | |
407 btfss trigger_timeout ; NO - timeout? | |
408 bra housekeeping_1 ; NO | |
409 btfsc surfmode_menu ; YES - in surface menus? | |
410 goto restart ; YES - goto restart, will proceed to surface mode | |
411 bcf restart_fast ; NO - set next restart to be done slow, i.e. with logos | |
412 goto sleeploop ; - goto sleep mode | |
413 | |
414 housekeeping_1: | |
415 btfss trigger_quarter_second ; new 1/4 second begun? | |
416 bra housekeeping_2 ; NO | |
0 | 417 |
623 | 418 ; tasks any new 1/4 second |
419 bcf trigger_quarter_second ; YES - clear flag | |
420 IFDEF _external_sensor | |
421 btfsc imprint_sensor_mv ; - shall imprint sensor mV data? | |
422 call TFT_menu_calibrate ; YES - imprint sensor mV data | |
423 ENDIF ; _external_sensor | |
424 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
425 bra housekeeping_2 ; NO | |
426 btfsc trigger_pres_cur_changed ; YES - pressure changed? | |
427 call TFT_pres_surfmode ; YES - display surface pressure | |
428 bcf trigger_pres_cur_changed ; - clear flag (anyhow) | |
429 IFDEF _compass | |
430 movf active_customview,W ; - get current custom view | |
431 xorlw .6 ; - coding of compass custom view | |
432 btfsc STATUS,Z ; - equal? | |
433 call TFT_surface_compass_heading ; YES - update compass view | |
434 ENDIF ; _compass | |
435 IFDEF _external_sensor | |
436 btfsc FLAG_ccr_mode ; - in CCR mode? | |
437 bra housekeeping_1a ; - YES - handle sensors | |
438 btfsc FLAG_pscr_mode ; - in pSCR mode? | |
439 bra housekeeping_1a ; YES - handle sensors | |
440 bra housekeeping_2 ; NO to both | |
441 housekeeping_1a: ; handle sensors | |
442 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: sensor, =2: autoSP | |
443 decfsz WREG ; opt_ccr_mode = 1 (sensor)? | |
444 bra housekeeping_2 ; NO - skip sensor readings | |
445 call calc_deko_divemode_sensor ; YES - read & calculate sensor data | |
446 call TFT_surface_sensor ; - update displayed sensor data | |
447 call TFT_sensor_surface_warning ; - show a down-arrow behind sensor readings when sensor is at end-of-life | |
448 movf active_customview,W ; - get current custom view | |
449 xorlw .9 ; - coding of sensor mV readings custom view | |
450 btfsc STATUS,Z ; - equal? | |
451 call TFT_sensor_mV ; YES - update mV readings | |
452 ENDIF ; _external_sensor | |
453 housekeeping_2: | |
454 btfss trigger_full_minute ; new 1/1 minute begun? | |
455 bra housekeeping_3 ; NO | |
456 | |
457 ; tasks any new minute | |
458 bcf trigger_full_minute ; YES - clear flag | |
459 btfsc simulatormode ; - in simulator mode? | |
460 bra housekeeping_2a ; YES - real tissues are in the vault, skip desaturation calculations | |
461 call deco_calc_dive_interval_1min; NO - calculate 1 minute at surface conditions (C-code) | |
462 call deco_calc_desaturation_time ; - calculate desaturation and no-fly/no-altitude time (C-code) | |
463 banksel common ; - back to bank common | |
464 housekeeping_2a: | |
465 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
466 bra housekeeping_3 ; NO | |
467 call TFT_date_surfmode ; YES - update displayed date | |
468 | |
469 btfsc trigger_temp_changed ; - temperature changed? | |
470 call TFT_temp_surfmode ; YES - display temperature | |
471 bcf trigger_temp_changed ; - clear flag (anyhow) | |
472 | |
473 movf active_customview,W ; - get current custom view | |
474 xorlw .5 ; - coding of tissue custom view | |
475 btfsc STATUS,Z ; - equal? | |
476 call TFT_surface_tissues ; YES - update tissue diagram | |
477 | |
478 movf active_customview,W ; - get current custom view | |
479 xorlw .8 ; - coding of last dive info custom view | |
480 btfsc STATUS,Z ; - equal? | |
481 call TFT_surface_lastdive ; YES - update last dive infos | |
482 | |
483 housekeeping_3: | |
484 ; tasks any round | |
485 IFDEF _screendump | |
486 btfsc screen_dump_avail ; screen dump function enabled? | |
487 call TFT_dump_screen_check ; YES - check if requested and do it | |
488 ELSE | |
489 btfsc comm_mode_disabled ; COMM mode disabled? | |
490 return ; YES - done | |
604 | 491 ENDIF |
623 | 492 btfss surfmode_menu ; in surface menus? |
493 return ; NO - done | |
494 | |
495 btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
496 return ; YES - suppress COMM mode to not jeopardize backup/restore of tissue data | |
497 | |
498 btfss vusb_in ; USB plugged in? | |
631 | 499 return ; NO - done |
623 | 500 IFDEF _screendump |
501 btfsc screen_dump_avail ; YES - screen dump enabled? | |
502 return ; YES - no COMM mode to be able to make screen shots of the menu and simulator mode | |
503 ENDIF | |
631 | 504 btfss ble_available ; skip "USB" check in all Bluetooth models (required for very old OSTC sport) |
623 | 505 goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal |
629 | 506 return |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
507 |
631 | 508 |
623 | 509 global reset_timeout_surfmode |
510 reset_timeout_surfmode: | |
511 movlw surfmode_timeout_default ; load default timeout value | |
631 | 512 btfss battery_is_36v ; running on a 3.6 V battery? |
513 movlw surfmode_timeout_aa_15v ; NO - replace by timeout for 1.5V battery | |
623 | 514 btfsc simulatormode ; currently in simulator (deco calculator) mode? |
515 movlw surfmode_timeout_simulator ; YES - replace with simulator timeout | |
631 | 516 ;bra reset_timeout_time ; set timeout value |
517 | |
518 ; btfsc imprint_sensor_mv ; currently imprinting O2 sensor mV data? | |
519 ; movlw surfmode_timeout_calibrate ; YES - replace with CCR Calibrate Menu timeout | |
520 ; IFDEF _rx_functions | |
521 ; btfsc imprint_xmitter_ID ; currently selecting pressure transmitter? | |
522 ; movlw surfmode_timeout_xmitter ; YES - replace with transmitter selection timeout | |
523 ; ENDIF ; _rx_functions | |
524 ; IFDEF _external_sensor | |
525 ; btfsc surfmode_menu ; in surface menu? | |
526 ; bra reset_timeout_time ; YES - keep timeout value | |
527 ; btfsc FLAG_ccr_mode ; NO - in CCR mode? | |
528 ; bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode | |
529 ; btfsc FLAG_ccr_mode ; NO - in pSCR mode? | |
530 ; bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode | |
531 ; bra reset_timeout_time ; NO - keep timeout value | |
532 ;reset_timeout_surfmode_loop: | |
533 ; movff opt_ccr_mode,lo ; get loop mode (=0: fixed/calculated SP, =1: sensor, =2: auto SP) | |
534 ; decfsz lo,f ; in sensor mode? | |
535 ; bra reset_timeout_time ; NO - keep timeout value | |
536 ; movlw surfmode_timeout_sensor ; YES - replace with sensor mode timeout | |
537 ; ENDIF ; _external_sensor | |
538 ; ;bra reset_timeout_time ; set timeout value | |
0 | 539 |
623 | 540 |
541 global reset_timeout_time | |
542 reset_timeout_time: ; entry point with timeout value in WREG | |
543 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload | |
544 bsf reset_timeout ; request ISR to reset the timeout | |
545 bcf trigger_timeout ; clear any pending timeout trigger | |
546 return ; done | |
547 | |
548 ;----------------------------------------------------------------------------- | |
549 | |
550 END |