Mercurial > public > hwos_code
annotate src/surfmode.asm @ 637:cdff88f5a4a0
Battery menu for OSTC plus
author | heinrichsweikamp |
---|---|
date | Sun, 17 May 2020 09:34:18 +0200 |
parents | 4050675965ea |
children | 2737ddc643bb |
rev | line source |
---|---|
0 | 1 ;============================================================================= |
2 ; | |
634 | 3 ; File surfmode.asm * next combined generation V3.09.5 |
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 |
634 | 12 #include "hwos.inc" ; mandatory header |
13 #include "shared_definitions.h" ; mailbox from/to p2_deco.c | |
582 | 14 #include "start.inc" |
15 #include "tft.inc" | |
16 #include "tft_outputs.inc" | |
17 #include "adc_lightsensor.inc" | |
18 #include "strings.inc" | |
19 #include "sleepmode.inc" | |
623 | 20 #include "wait.inc" |
582 | 21 #include "customview.inc" |
22 #include "divemode.inc" | |
23 #include "i2c.inc" | |
24 #include "comm.inc" | |
634 | 25 #include "colorschemes.inc" |
26 | |
27 IFDEF _rx_functions | |
28 #include "rx_ops.inc" | |
29 ENDIF | |
30 | |
31 IFDEF _external_sensor | |
582 | 32 #include "calibrate.inc" |
634 | 33 ENDIF |
0 | 34 |
604 | 35 |
634 | 36 extern main_menu |
37 extern check_cns_violation_now | |
38 extern check_battery | |
39 extern check_saturation | |
604 | 40 extern check_mbubbles |
41 | |
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 |
634 | 60 ;============================================================================= |
61 sfmode1 CODE | |
62 ;============================================================================= | |
0 | 63 |
634 | 64 ;----------------------------------------------------------------------------- |
65 ; Entry Point for Surface Mode | |
623 | 66 ; |
67 ; called after restart via the battery selection, after compass calibration, | |
68 ; and via ghostwriter at the end of a dive | |
69 ; | |
0 | 70 global surfloop |
71 surfloop: | |
634 | 72 clrf STKPTR ; clear return addresses stack |
73 ; clrf CCP1CON ; stop PWM | |
74 ; bcf PORTC,2 ; pull PWM output to GND | |
75 ; clrf CCPR1L ; backlight off | |
76 call TFT_boot ; initialize TFT (includes clear screen) | |
245 | 77 |
634 | 78 btfsc restart_fast ; shall make a fast restart? |
79 bra surfloop_1 ; YES | |
0 | 80 |
623 | 81 ; show heinrichsweikamp logo |
604 | 82 WIN_TOP .40 |
582 | 83 WIN_LEFT .10 |
623 | 84 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block |
0 | 85 |
634 | 86 ; set font color |
87 FONT_COLOR color_white | |
88 | |
623 | 89 ; show textual OSTC logo |
634 | 90 WIN_STD .30,.90 ; column, row |
91 STRCPY_PRINT "Open Source" ; show OSTC banner text, line 1 | |
92 WIN_STD .20,.130 ; column, row | |
93 STRCPY_PRINT "Tauch-Computer" ; show OSTC banner text, line 2 | |
604 | 94 |
634 | 95 ; show firmware version |
604 | 96 WIN_SMALL .35,.180 |
634 | 97 PUTC "v" ; print "v" |
98 call TFT_print_firmware ; print full firmware version (may change the font color) | |
99 call TFT_Display_FadeIn ; dim up the display | |
604 | 100 |
623 | 101 surfloop_1: |
634 | 102 |
103 ;---- do all useful initializations that take time ----------------------- | |
604 | 104 |
623 | 105 ; set deco mode flags |
106 call restart_set_modes_and_flags | |
107 | |
634 | 108 bsf trigger_pres_cur_changed ; set flag to have pressure written to display on first round of surface loop |
109 bsf trigger_temp_changed ; set flag to have temperature written to display on first round of surface loop | |
623 | 110 |
634 | 111 call I2C_sleep_compass ; shut down compass |
0 | 112 |
623 | 113 IFDEF _ccr_pscr |
634 | 114 movlw surface_sp ; load default surface setpoint (in cbar) |
115 movff WREG,char_I_const_ppO2 ; store it as current setpoint | |
623 | 116 ENDIF |
117 | |
118 IFDEF _external_sensor | |
634 | 119 call transmit_setpoint ; transmit current setpoint (in cbar) via S8 digital interface (currently disabled) |
623 | 120 ENDIF |
221
90923a081ae7
minor: configure buttons during splash screen
heinrichsweikamp
parents:
213
diff
changeset
|
121 |
634 | 122 bcf surfmode_menu ; not in surface menu (any more) |
123 bcf compass_menu ; not in "set bearing" selection (any more) | |
0 | 124 |
634 | 125 bcf switch_left ; clear intermediate button event since start/restart |
126 bcf switch_right ; clear intermediate button event since start/restart | |
623 | 127 |
634 | 128 btfsc restart_fast ; shall make a fast restart? |
129 bra surfloop_2 ; YES | |
604 | 130 |
628 | 131 call deco_calc_desaturation_time ; calculate desaturation and no-fly/no-altitude time (C-code) |
132 banksel common ; back to bank common | |
133 | |
634 | 134 WAITS .2 ; wait 2 seconds |
0 | 135 |
634 | 136 ;---- fade to standard surface view -------------------------------------- |
0 | 137 |
634 | 138 call TFT_Display_FadeOut ; dim down display to black screen |
139 call TFT_ClearScreen ; clear screen | |
623 | 140 |
141 surfloop_2: | |
634 | 142 |
143 call TFT_load_std_color_pallet ; load standard color pallet | |
144 | |
145 ;---- button functionalities --------------------------------------------- | |
0 | 146 |
634 | 147 FONT_COLOR color_lightblue ; set font color |
148 WIN_SMALL menu_pos_column,menu_pos_row ; set font size and output position | |
149 STRCPY_TEXT_PRINT tMenu ; print "<Menu" | |
150 WIN_SMALL view_column,view_row ; set font size and output position | |
151 STRCPY_TEXT_PRINT tView ; print "View>" | |
0 | 152 |
623 | 153 |
634 | 154 ;---- logo in upper right corner ----------------------------------------- |
628 | 155 |
623 | 156 ; show textual OSTC logo |
157 WIN_STD .100,.2 ; set output position | |
634 | 158 FONT_COLOR color_white ; set text color to white |
604 | 159 STRCPY_PRINT "OSTC" ; show "OSTC" |
634 | 160 |
161 FONT_COLOR color_cyan ; set text color to cyan | |
623 | 162 WIN_TINY .138,.2 ; set output position |
604 | 163 STRCPY_PRINT "hwOS" ; show "hwOS" |
623 | 164 WIN_TINY .137,.14 ; set output position |
165 IFDEF _hwos_sport | |
166 STRCPY_PRINT "sport" ; show "sport" | |
167 ELSE | |
604 | 168 STRCPY_PRINT "tech" ; show "tech" |
169 ENDIF | |
634 | 170 |
171 ; firmware version | |
623 | 172 WIN_TINY .100,.32 ; set output position |
634 | 173 FONT_COLOR color_white ; set text color to white |
174 call TFT_print_firmware ; show firmware version (long format) | |
0 | 175 |
176 | |
623 | 177 ;---- fill screen -------------------------------------------------------- |
582 | 178 |
634 | 179 call get_battery_voltage ; get battery voltage |
180 call TFT_surfmode_batt ; show battery voltage | |
181 call TFT_surfmode_time ; show time | |
182 call TFT_surfmode_date ; show date | |
183 call TFT_surfmode_pres ; show surface pressure | |
184 call TFT_surfmode_temp ; show temperature | |
185 call TFT_surfmode_decotype ; show deco mode | |
186 | |
187 TSTOSS opt_dive_mode ; in OC? (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR) | |
188 call TFT_surfmode_startgas ; YES - show first gas and "OSTC2-like" active gases | |
0 | 189 |
631 | 190 ; configure tissue graphics |
634 | 191 bcf tissue_graphic_mode ; select surface mode |
192 bsf tissue_graphic_cns ; show CNS value | |
631 | 193 |
634 | 194 bsf tissue_graphic_layout ; default to N2+He |
195 TSTOSS opt_tissue_graphics ; shall show press+sat? | |
196 bcf tissue_graphic_layout ; YES - show press+sat | |
631 | 197 |
634 | 198 bcf tissue_graphic_gf ; default to none-GF |
199 TSTOSC char_I_model ; GF factors enabled? | |
200 bsf tissue_graphic_gf ; YES - show GF lines | |
631 | 201 |
623 | 202 movff customview_surfmode,active_customview ; reload last custom view |
203 call surf_customview_mask ; redraw last custom view | |
582 | 204 |
634 | 205 call TFT_Display_FadeIn ; show resulting surface screen |
0 | 206 |
604 | 207 IFDEF _screendump |
634 | 208 btfsc screen_dump_avail ; screen dump function enabled? |
209 call enable_rs232 ; YES - activate RS232 (also sets CPU to normal speed) | |
604 | 210 ENDIF |
211 | |
634 | 212 bcf restart_fast ; clear flag for fast restart |
213 bsf imprint_surfmode_data ; start imprinting surface mode data | |
0 | 214 |
634 | 215 bcf switch_left ; clear pending left button event |
216 bcf switch_right ; clear pending right button event | |
0 | 217 |
634 | 218 rcall reset_timeout_surfmode ; reset timeout |
582 | 219 |
623 | 220 surfloop_loop: |
634 | 221 ; call TFT_debug_output ; optional debug output |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
222 |
634 | 223 call test_switches_surfmode ; check switches |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
224 |
634 | 225 btfsc request_next_custview ; shall show next custom view? |
226 call surf_customview_toggle ; YES - show next custom view (and clear this flag) | |
0 | 227 |
634 | 228 btfss surfmode_menu ; shall enter surface menu? |
229 bra surfloop_loop_1 ; NO | |
230 bcf imprint_surfmode_data ; YES - stop imprinting surface mode data | |
231 goto main_menu ; - goto surface menu | |
582 | 232 |
623 | 233 surfloop_loop_1: |
634 | 234 call housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode |
235 bra surfloop_loop ; loop in surface mode | |
582 | 236 |
0 | 237 |
634 | 238 ;----------------------------------------------------------------------------- |
239 ; Surface Mode HMI Operations | |
240 ; | |
623 | 241 test_switches_surfmode: ; check buttons in surface mode |
242 btfsc switch_right ; right button pressed? | |
243 bra test_switches_surfmode2 ; YES | |
244 btfsc switch_left ; left button pressed? | |
245 bra test_switches_surfmode3 ; YES | |
246 return ; NO to both - done | |
247 | |
248 test_switches_surfmode2: ; right button pressed | |
249 bcf switch_right ; clear button event | |
631 | 250 rcall reset_timeout_surfmode ; set up timeout |
623 | 251 IFDEF _compass |
252 movlw .6 ; coding for surface custom compass view | |
253 cpfseq active_customview ; in compass view? | |
254 bra test_switches_surfmode2a ; NO | |
255 btfss compass_menu ; "set course" selection shown? | |
256 bra test_switches_surfmode2a ; NO | |
257 bsf compass_bearing_set ; YES - set new course | |
258 MOVII compass_heading_shown,compass_bearing | |
259 bra test_switches_surfmode3b ; - clear "Course" label and return | |
260 ENDIF | |
261 test_switches_surfmode2a: | |
262 bsf request_next_custview ; request next custom view | |
263 bcf compass_menu ; "set course" selection not shown anymore | |
0 | 264 return |
265 | |
623 | 266 test_switches_surfmode3: ; left button pressed |
267 bcf switch_left ; clear button event | |
631 | 268 rcall reset_timeout_surfmode ; set up timeout |
623 | 269 IFDEF _compass |
270 movlw .6 ; coding for surface custom view compass | |
271 cpfseq active_customview ; in compass view? | |
604 | 272 bra test_switches_surfmode3a ; NO |
623 | 273 btfsc compass_menu ; YES - "set course" selection already shown? |
274 bra test_switches_surfmode3b ; YES - remove it | |
634 | 275 call TFT_surf_cv_compass_bearing ; NO - show it |
628 | 276 return ; - done |
623 | 277 ENDIF |
382 | 278 test_switches_surfmode3a: |
623 | 279 bcf compass_bearing_set ; clear course on entering menu |
280 bsf surfmode_menu ; flag that the surface menu shall be entered | |
582 | 281 return |
382 | 282 |
623 | 283 IFDEF _compass |
284 test_switches_surfmode3b: | |
628 | 285 WIN_BOX_BLACK .158,.190, .15, .99 ; clear "Course" label (top, bottom, left, right) |
623 | 286 bcf compass_menu ; clear flag for "set course" selection |
582 | 287 return |
623 | 288 ENDIF |
382 | 289 |
623 | 290 |
634 | 291 ;----------------------------------------------------------------------------- |
292 ; Helper Function - Reset and Restart Timeout for Surface Mode | |
293 ; | |
294 global reset_timeout_surfmode | |
295 reset_timeout_surfmode: | |
296 movlw surfmode_timeout_default ; load default timeout value | |
297 btfss battery_is_36v ; running on a 3.6 V battery? | |
298 movlw surfmode_timeout_aa_15v ; NO - replace by timeout for 1.5V battery | |
299 btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
300 movlw surfmode_timeout_simulator ; YES - replace with simulator timeout | |
301 ;bra restart_timeout_time ; restart timeout | |
302 | |
303 global restart_timeout_time | |
304 restart_timeout_time: ; entry point with timeout value in WREG | |
305 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload | |
306 bsf restart_timeout ; request ISR to restart the timeout | |
307 bcf trigger_timeout ; clear any pending timeout trigger | |
308 return ; done | |
309 | |
310 | |
311 ;============================================================================= | |
312 sfmode2 CODE | |
313 ;============================================================================= | |
314 | |
315 ;----------------------------------------------------------------------------- | |
316 ; Helper Function - Check all possible Surface Mode Warning Conditions | |
317 ; | |
318 surfmode_check_warnings: | |
319 clrf message_counter ; clear message counter | |
320 | |
321 ; warnings for all modes | |
322 call check_battery ; check if the battery level should be displayed/warned | |
323 | |
324 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode | |
325 bra surfmode_check_warnings2 | |
326 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode | |
327 bra surfmode_check_warnings2 | |
328 | |
329 ; warnings only in deco modes | |
330 call check_saturation ; check/show tissue saturation | |
331 call check_cns_violation_now ; check/show current CNS value | |
332 call check_mbubbles ; check/show micro bubbles | |
333 movff int_O_lead_supersat+1,WREG ; get upper byte of leading tissue's supersaturation | |
334 btfsc WREG,int_warning_flag ; check if the warning flag is set | |
335 bra surfmode_check_warnings2 ; YES - outside of the model | |
336 rcall surfmode_check_for_desat ; NO - check/show desaturation time | |
337 rcall surfmode_check_for_nofly ; - check/show no-fly time | |
338 | |
339 surfmode_check_warnings2: | |
340 ; setup message page number | |
341 incf message_page,F ; increment page number | |
342 bcf STATUS,C ; clear carry bit | |
343 rlcf message_page,W ; each page can take two messages | |
344 cpfsgt message_counter ; number of actual messages > message capacity ? | |
345 clrf message_page ; NO - all messages could be shown, restart from first page next time | |
346 | |
347 ; clear both rows if there is nothing to show at all | |
348 tstfsz message_counter ; any message to show? | |
349 bra surfmode_check_warnings3 ; YES - look if second row needs to be cleared | |
350 goto TFT_clear_message_window ; NO - clear complete message area and return | |
351 | |
352 surfmode_check_warnings3: | |
353 ; clear 2nd row of messages if there is nothing to show (on this page) | |
354 btfss message_2nd_row_used ; does the 2nd row contain a message? | |
355 goto TFT_clear_message_window_row2 ; NO - clear the 2nd row and return | |
356 return ; YES - done | |
357 | |
358 | |
359 ;----------------------------------------------------------------------------- | |
360 ; Helper Function - check if still in Desaturation, if yes show a Message | |
361 ; | |
362 surfmode_check_for_desat: | |
363 banksel int_O_desaturation_time | |
364 movf int_O_desaturation_time+0,W | |
365 iorwf int_O_desaturation_time+1,W | |
366 banksel common ; back to bank common | |
367 bnz surfmode_check_for_desat_1 ; is the desat-time > 0 ? | |
368 return ; NO - done | |
369 surfmode_check_for_desat_1: | |
370 incf message_counter,F ; YES - increase counter | |
371 call TFT_surf_mesg_desat ; - show desaturation time | |
372 return ; - done | |
373 | |
374 | |
375 ;----------------------------------------------------------------------------- | |
376 ; Helper Function - check if still in no-fly, if yes show a Message | |
377 ; | |
378 surfmode_check_for_nofly: | |
379 banksel int_O_nofly_time | |
380 movf int_O_nofly_time+0,W | |
381 iorwf int_O_nofly_time+1,W | |
382 banksel common ; back to bank common | |
383 bnz surfmode_check_for_nofly_1 ; is the nofly-time > 0 ? | |
384 return ; NO - done | |
385 surfmode_check_for_nofly_1: | |
386 incf message_counter,F ; YES - increase counter | |
387 call TFT_surf_mesg_nofly ; - show nofly-time | |
388 return ; - done | |
389 | |
390 | |
391 ;============================================================================= | |
392 sfmode3 CODE | |
393 ;============================================================================= | |
394 | |
395 ;----------------------------------------------------------------------------- | |
396 ; Data Imprinting, Screen Dump request, Timeout and Entering Dive Mode | |
397 ; | |
623 | 398 global housekeeping |
399 housekeeping: | |
400 btfss trigger_full_second ; new 1/1 second begun? | |
401 bra housekeeping_1 ; NO | |
402 | |
634 | 403 ;---- tasks any new second --------- |
404 | |
623 | 405 bcf trigger_full_second ; YES - clear flag |
406 call get_battery_voltage ; - get battery voltage | |
407 | |
408 btfsc imprint_time_date ; - shall imprint the current time & date? | |
634 | 409 call TFT_imprint_time_date ; YES - imprint time and date on display (copies running time to latch registers) |
410 | |
411 btfsc imprint_color_schemes ; - shall imprint color scheme demo? | |
412 call TFT_imprint_color_schemes ; YES - update the color schemes | |
623 | 413 |
414 IFDEF _rx_functions | |
415 btfsc tr_functions_activated ; - TR functions activated? | |
416 call I2C_get_tankdata ; YES - get new transmitter data | |
417 | |
418 btfsc imprint_xmitter_pres ; - shall imprint transmitter ID and pressure? | |
634 | 419 call TFT_imprint_tank_pres ; YES - imprint transmitter ID and pressure |
623 | 420 ENDIF |
421 | |
422 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
423 bra housekeeping_0 ; NO | |
634 | 424 call TFT_surfmode_time ; YES - update displayed time |
425 call TFT_surfmode_batt ; - update displayed battery voltage | |
623 | 426 btfss timebase_1sec,0 ; - on even second? |
634 | 427 call surfmode_check_warnings ; YES - check for warnings and display/update them |
623 | 428 |
429 IFDEF _rx_functions | |
430 btfss tr_functions_activated ; - TR functions activated? | |
431 bra housekeeping_0 ; NO - skip tank pressure part | |
432 | |
433 call get_pressure_readings ; YES - get pressure readings | |
634 | 434 call TFT_surfmode_tankpres ; - update first gas/diluent pressure |
623 | 435 |
436 movf active_customview,W ; - get current custom view | |
437 xorlw .10 ; - coding of tank data custom view | |
438 btfsc STATUS,Z ; - equal? | |
634 | 439 call TFT_surf_cv_tankdata ; YES - update tank data custom view |
623 | 440 ENDIF |
441 | |
442 housekeeping_0: | |
443 bsf restart_fast ; default to doing a fast restart (no logos) | |
634 | 444 call check_dive_modes_surf ; check if dive mode needs to be entered, will set dive mode flag if yes |
623 | 445 btfsc simulatormode ; in simulator mode? |
446 bra housekeeping_1 ; YES - can't restart or go to sleep without prior cleanup | |
447 btfsc divemode ; NO - need to enter dive mode? | |
448 goto restart ; YES - restart, will proceed to dive mode | |
449 btfss trigger_timeout ; NO - timeout? | |
450 bra housekeeping_1 ; NO | |
451 btfsc surfmode_menu ; YES - in surface menus? | |
452 goto restart ; YES - goto restart, will proceed to surface mode | |
453 bcf restart_fast ; NO - set next restart to be done slow, i.e. with logos | |
454 goto sleeploop ; - goto sleep mode | |
455 | |
456 housekeeping_1: | |
457 btfss trigger_quarter_second ; new 1/4 second begun? | |
458 bra housekeeping_2 ; NO | |
0 | 459 |
634 | 460 ;---- tasks any new 1/4 second ----- |
461 | |
623 | 462 bcf trigger_quarter_second ; YES - clear flag |
463 IFDEF _external_sensor | |
464 btfsc imprint_sensor_mv ; - shall imprint sensor mV data? | |
634 | 465 call TFT_imprint_menu_mV ; YES - imprint sensor mV data |
623 | 466 ENDIF ; _external_sensor |
467 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
468 bra housekeeping_2 ; NO | |
469 btfsc trigger_pres_cur_changed ; YES - pressure changed? | |
634 | 470 call TFT_surfmode_pres_fast ; YES - display surface pressure, but only if change > threshold |
623 | 471 bcf trigger_pres_cur_changed ; - clear flag (anyhow) |
472 IFDEF _compass | |
473 movf active_customview,W ; - get current custom view | |
474 xorlw .6 ; - coding of compass custom view | |
475 btfsc STATUS,Z ; - equal? | |
476 call TFT_surface_compass_heading ; YES - update compass view | |
477 ENDIF ; _compass | |
478 IFDEF _external_sensor | |
479 btfsc FLAG_ccr_mode ; - in CCR mode? | |
480 bra housekeeping_1a ; - YES - handle sensors | |
481 btfsc FLAG_pscr_mode ; - in pSCR mode? | |
482 bra housekeeping_1a ; YES - handle sensors | |
483 bra housekeeping_2 ; NO to both | |
634 | 484 |
623 | 485 housekeeping_1a: ; handle sensors |
486 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: sensor, =2: autoSP | |
487 decfsz WREG ; opt_ccr_mode = 1 (sensor)? | |
488 bra housekeeping_2 ; NO - skip sensor readings | |
489 call calc_deko_divemode_sensor ; YES - read & calculate sensor data | |
634 | 490 call TFT_imprint_surf_ppO2 ; - update displayed sensor data |
491 call TFT_imprint_surf_sensor_eol ; - show a down-arrow behind sensor readings when sensor is at end-of-life | |
623 | 492 movf active_customview,W ; - get current custom view |
493 xorlw .9 ; - coding of sensor mV readings custom view | |
494 btfsc STATUS,Z ; - equal? | |
634 | 495 call TFT_imprint_surf_mV ; YES - update mV readings |
623 | 496 ENDIF ; _external_sensor |
634 | 497 |
623 | 498 housekeeping_2: |
499 btfss trigger_full_minute ; new 1/1 minute begun? | |
500 bra housekeeping_3 ; NO | |
501 | |
634 | 502 ;---- tasks any new minute --------- |
503 | |
623 | 504 bcf trigger_full_minute ; YES - clear flag |
634 | 505 |
506 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
507 bra housekeeping_2a ; NO | |
508 btfsc trigger_pres_cur_changed ; YES - pressure changed? | |
509 call TFT_surfmode_pres ; YES - display surface pressure | |
510 bcf trigger_pres_cur_changed ; - clear flag (anyhow) | |
511 | |
512 housekeeping_2a: | |
623 | 513 btfsc simulatormode ; - in simulator mode? |
634 | 514 bra housekeeping_2b ; YES - real tissues are in the vault, skip desaturation calculations |
623 | 515 call deco_calc_dive_interval_1min; NO - calculate 1 minute at surface conditions (C-code) |
516 call deco_calc_desaturation_time ; - calculate desaturation and no-fly/no-altitude time (C-code) | |
517 banksel common ; - back to bank common | |
634 | 518 |
519 housekeeping_2b: | |
623 | 520 btfss imprint_surfmode_data ; - shall imprint all surface mode data? |
521 bra housekeeping_3 ; NO | |
634 | 522 call TFT_surfmode_date ; YES - update displayed date |
623 | 523 |
524 btfsc trigger_temp_changed ; - temperature changed? | |
634 | 525 call TFT_surfmode_temp ; YES - display temperature |
623 | 526 bcf trigger_temp_changed ; - clear flag (anyhow) |
527 | |
528 movf active_customview,W ; - get current custom view | |
529 xorlw .5 ; - coding of tissue custom view | |
530 btfsc STATUS,Z ; - equal? | |
634 | 531 call TFT_surf_cv_tissues ; YES - update tissue diagram |
623 | 532 |
533 movf active_customview,W ; - get current custom view | |
534 xorlw .8 ; - coding of last dive info custom view | |
535 btfsc STATUS,Z ; - equal? | |
634 | 536 call TFT_surf_cv_lastdive ; YES - update last dive infos |
623 | 537 |
538 housekeeping_3: | |
634 | 539 |
540 ;---- tasks any round -------------- | |
541 | |
623 | 542 IFDEF _screendump |
543 btfsc screen_dump_avail ; screen dump function enabled? | |
544 call TFT_dump_screen_check ; YES - check if requested and do it | |
545 ELSE | |
546 btfsc comm_mode_disabled ; COMM mode disabled? | |
547 return ; YES - done | |
604 | 548 ENDIF |
623 | 549 btfss surfmode_menu ; in surface menus? |
550 return ; NO - done | |
551 | |
552 btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
553 return ; YES - suppress COMM mode to not jeopardize backup/restore of tissue data | |
554 | |
555 btfss vusb_in ; USB plugged in? | |
631 | 556 return ; NO - done |
623 | 557 IFDEF _screendump |
558 btfsc screen_dump_avail ; YES - screen dump enabled? | |
559 return ; YES - no COMM mode to be able to make screen shots of the menu and simulator mode | |
560 ENDIF | |
631 | 561 btfss ble_available ; skip "USB" check in all Bluetooth models (required for very old OSTC sport) |
623 | 562 goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal |
629 | 563 return |
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
564 |
623 | 565 ;----------------------------------------------------------------------------- |
566 | |
567 END |