Mercurial > public > hwos_code
annotate src/surfmode.asm @ 654:75e90cd0c2c3
hwOS sport 10.77 release
| author | heinrichsweikamp |
|---|---|
| date | Thu, 14 Mar 2024 16:56:46 +0100 |
| parents | 682c514c53c0 |
| children | 8af5aefbcdaf |
| 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 ; |
| 654 | 7 ; Copyright (c) 2011, JD Gascuel, heinrichs weikamp gmbh, all right reserved. |
| 0 | 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 |
| 654 | 81 ; show heinrichs weikamp gmbh 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 |
| 636 | 208 extern enable_rs232 |
| 634 | 209 btfsc screen_dump_avail ; screen dump function enabled? |
| 210 call enable_rs232 ; YES - activate RS232 (also sets CPU to normal speed) | |
| 604 | 211 ENDIF |
| 212 | |
| 634 | 213 bcf restart_fast ; clear flag for fast restart |
| 214 bsf imprint_surfmode_data ; start imprinting surface mode data | |
| 0 | 215 |
| 634 | 216 bcf switch_left ; clear pending left button event |
| 217 bcf switch_right ; clear pending right button event | |
| 0 | 218 |
| 634 | 219 rcall reset_timeout_surfmode ; reset timeout |
| 582 | 220 |
| 623 | 221 surfloop_loop: |
| 640 | 222 call TFT_debug_output ; optional debug output |
|
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
223 |
| 634 | 224 call test_switches_surfmode ; check switches |
|
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
225 |
| 634 | 226 btfsc request_next_custview ; shall show next custom view? |
| 227 call surf_customview_toggle ; YES - show next custom view (and clear this flag) | |
| 0 | 228 |
| 634 | 229 btfss surfmode_menu ; shall enter surface menu? |
| 230 bra surfloop_loop_1 ; NO | |
| 231 bcf imprint_surfmode_data ; YES - stop imprinting surface mode data | |
| 232 goto main_menu ; - goto surface menu | |
| 582 | 233 |
| 623 | 234 surfloop_loop_1: |
| 634 | 235 call housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode |
| 236 bra surfloop_loop ; loop in surface mode | |
| 582 | 237 |
| 0 | 238 |
| 634 | 239 ;----------------------------------------------------------------------------- |
| 240 ; Surface Mode HMI Operations | |
| 241 ; | |
| 623 | 242 test_switches_surfmode: ; check buttons in surface mode |
| 243 btfsc switch_right ; right button pressed? | |
| 244 bra test_switches_surfmode2 ; YES | |
| 245 btfsc switch_left ; left button pressed? | |
| 246 bra test_switches_surfmode3 ; YES | |
| 247 return ; NO to both - done | |
| 248 | |
| 249 test_switches_surfmode2: ; right button pressed | |
| 250 bcf switch_right ; clear button event | |
| 631 | 251 rcall reset_timeout_surfmode ; set up timeout |
| 623 | 252 IFDEF _compass |
| 253 movlw .6 ; coding for surface custom compass view | |
| 254 cpfseq active_customview ; in compass view? | |
| 255 bra test_switches_surfmode2a ; NO | |
| 256 btfss compass_menu ; "set course" selection shown? | |
| 257 bra test_switches_surfmode2a ; NO | |
| 258 bsf compass_bearing_set ; YES - set new course | |
| 259 MOVII compass_heading_shown,compass_bearing | |
| 260 bra test_switches_surfmode3b ; - clear "Course" label and return | |
| 261 ENDIF | |
| 262 test_switches_surfmode2a: | |
| 263 bsf request_next_custview ; request next custom view | |
| 264 bcf compass_menu ; "set course" selection not shown anymore | |
| 0 | 265 return |
| 266 | |
| 623 | 267 test_switches_surfmode3: ; left button pressed |
| 268 bcf switch_left ; clear button event | |
| 631 | 269 rcall reset_timeout_surfmode ; set up timeout |
| 623 | 270 IFDEF _compass |
| 271 movlw .6 ; coding for surface custom view compass | |
| 272 cpfseq active_customview ; in compass view? | |
| 604 | 273 bra test_switches_surfmode3a ; NO |
| 623 | 274 btfsc compass_menu ; YES - "set course" selection already shown? |
| 275 bra test_switches_surfmode3b ; YES - remove it | |
| 634 | 276 call TFT_surf_cv_compass_bearing ; NO - show it |
| 628 | 277 return ; - done |
| 623 | 278 ENDIF |
| 382 | 279 test_switches_surfmode3a: |
| 623 | 280 bcf compass_bearing_set ; clear course on entering menu |
| 281 bsf surfmode_menu ; flag that the surface menu shall be entered | |
| 582 | 282 return |
| 382 | 283 |
| 623 | 284 IFDEF _compass |
| 285 test_switches_surfmode3b: | |
| 628 | 286 WIN_BOX_BLACK .158,.190, .15, .99 ; clear "Course" label (top, bottom, left, right) |
| 623 | 287 bcf compass_menu ; clear flag for "set course" selection |
| 582 | 288 return |
| 623 | 289 ENDIF |
| 382 | 290 |
| 623 | 291 |
| 634 | 292 ;----------------------------------------------------------------------------- |
| 293 ; Helper Function - Reset and Restart Timeout for Surface Mode | |
| 294 ; | |
| 295 global reset_timeout_surfmode | |
| 296 reset_timeout_surfmode: | |
| 297 movlw surfmode_timeout_default ; load default timeout value | |
| 298 btfss battery_is_36v ; running on a 3.6 V battery? | |
| 299 movlw surfmode_timeout_aa_15v ; NO - replace by timeout for 1.5V battery | |
| 300 btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
| 301 movlw surfmode_timeout_simulator ; YES - replace with simulator timeout | |
| 302 ;bra restart_timeout_time ; restart timeout | |
| 303 | |
| 304 global restart_timeout_time | |
| 305 restart_timeout_time: ; entry point with timeout value in WREG | |
| 306 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload | |
| 307 bsf restart_timeout ; request ISR to restart the timeout | |
| 308 bcf trigger_timeout ; clear any pending timeout trigger | |
| 309 return ; done | |
| 310 | |
| 311 | |
| 312 ;============================================================================= | |
| 313 sfmode2 CODE | |
| 314 ;============================================================================= | |
| 315 | |
| 316 ;----------------------------------------------------------------------------- | |
| 317 ; Helper Function - Check all possible Surface Mode Warning Conditions | |
| 318 ; | |
| 319 surfmode_check_warnings: | |
| 320 clrf message_counter ; clear message counter | |
| 321 | |
| 322 ; warnings for all modes | |
| 323 call check_battery ; check if the battery level should be displayed/warned | |
| 324 | |
| 643 | 325 IFDEF _debug_output |
| 326 call check_i2c_error ; check for an I2C error (For debugging purposes only) | |
| 327 ENDIF | |
| 328 | |
| 634 | 329 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode |
| 330 bra surfmode_check_warnings2 | |
| 331 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode | |
| 332 bra surfmode_check_warnings2 | |
| 333 | |
| 334 ; warnings only in deco modes | |
| 335 call check_saturation ; check/show tissue saturation | |
| 336 call check_cns_violation_now ; check/show current CNS value | |
| 337 call check_mbubbles ; check/show micro bubbles | |
| 338 movff int_O_lead_supersat+1,WREG ; get upper byte of leading tissue's supersaturation | |
| 339 btfsc WREG,int_warning_flag ; check if the warning flag is set | |
| 340 bra surfmode_check_warnings2 ; YES - outside of the model | |
| 341 rcall surfmode_check_for_desat ; NO - check/show desaturation time | |
| 342 rcall surfmode_check_for_nofly ; - check/show no-fly time | |
| 343 | |
| 344 surfmode_check_warnings2: | |
| 345 ; setup message page number | |
| 346 incf message_page,F ; increment page number | |
| 347 bcf STATUS,C ; clear carry bit | |
| 348 rlcf message_page,W ; each page can take two messages | |
| 349 cpfsgt message_counter ; number of actual messages > message capacity ? | |
| 350 clrf message_page ; NO - all messages could be shown, restart from first page next time | |
| 351 | |
| 352 ; clear both rows if there is nothing to show at all | |
| 353 tstfsz message_counter ; any message to show? | |
| 354 bra surfmode_check_warnings3 ; YES - look if second row needs to be cleared | |
| 355 goto TFT_clear_message_window ; NO - clear complete message area and return | |
| 356 | |
| 357 surfmode_check_warnings3: | |
| 358 ; clear 2nd row of messages if there is nothing to show (on this page) | |
| 359 btfss message_2nd_row_used ; does the 2nd row contain a message? | |
| 360 goto TFT_clear_message_window_row2 ; NO - clear the 2nd row and return | |
| 361 return ; YES - done | |
| 362 | |
| 363 | |
| 364 ;----------------------------------------------------------------------------- | |
| 365 ; Helper Function - check if still in Desaturation, if yes show a Message | |
| 366 ; | |
| 367 surfmode_check_for_desat: | |
| 368 banksel int_O_desaturation_time | |
| 369 movf int_O_desaturation_time+0,W | |
| 370 iorwf int_O_desaturation_time+1,W | |
| 371 banksel common ; back to bank common | |
| 372 bnz surfmode_check_for_desat_1 ; is the desat-time > 0 ? | |
| 373 return ; NO - done | |
| 374 surfmode_check_for_desat_1: | |
| 375 incf message_counter,F ; YES - increase counter | |
| 376 call TFT_surf_mesg_desat ; - show desaturation time | |
| 377 return ; - done | |
| 378 | |
| 379 | |
| 380 ;----------------------------------------------------------------------------- | |
| 381 ; Helper Function - check if still in no-fly, if yes show a Message | |
| 382 ; | |
| 383 surfmode_check_for_nofly: | |
| 384 banksel int_O_nofly_time | |
| 385 movf int_O_nofly_time+0,W | |
| 386 iorwf int_O_nofly_time+1,W | |
| 387 banksel common ; back to bank common | |
| 388 bnz surfmode_check_for_nofly_1 ; is the nofly-time > 0 ? | |
| 389 return ; NO - done | |
| 390 surfmode_check_for_nofly_1: | |
| 391 incf message_counter,F ; YES - increase counter | |
| 392 call TFT_surf_mesg_nofly ; - show nofly-time | |
| 393 return ; - done | |
| 394 | |
| 395 | |
| 396 ;============================================================================= | |
| 397 sfmode3 CODE | |
| 398 ;============================================================================= | |
| 399 | |
| 400 ;----------------------------------------------------------------------------- | |
| 401 ; Data Imprinting, Screen Dump request, Timeout and Entering Dive Mode | |
| 402 ; | |
| 623 | 403 global housekeeping |
| 404 housekeeping: | |
| 405 btfss trigger_full_second ; new 1/1 second begun? | |
| 406 bra housekeeping_1 ; NO | |
| 407 | |
| 634 | 408 ;---- tasks any new second --------- |
| 409 | |
| 623 | 410 bcf trigger_full_second ; YES - clear flag |
| 411 call get_battery_voltage ; - get battery voltage | |
| 412 | |
| 413 btfsc imprint_time_date ; - shall imprint the current time & date? | |
| 634 | 414 call TFT_imprint_time_date ; YES - imprint time and date on display (copies running time to latch registers) |
| 415 | |
| 416 btfsc imprint_color_schemes ; - shall imprint color scheme demo? | |
| 417 call TFT_imprint_color_schemes ; YES - update the color schemes | |
| 623 | 418 |
| 419 IFDEF _rx_functions | |
| 420 btfsc tr_functions_activated ; - TR functions activated? | |
| 421 call I2C_get_tankdata ; YES - get new transmitter data | |
| 422 | |
| 423 btfsc imprint_xmitter_pres ; - shall imprint transmitter ID and pressure? | |
| 634 | 424 call TFT_imprint_tank_pres ; YES - imprint transmitter ID and pressure |
| 623 | 425 ENDIF |
| 426 | |
| 427 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
| 428 bra housekeeping_0 ; NO | |
| 634 | 429 call TFT_surfmode_time ; YES - update displayed time |
| 430 call TFT_surfmode_batt ; - update displayed battery voltage | |
| 623 | 431 btfss timebase_1sec,0 ; - on even second? |
| 634 | 432 call surfmode_check_warnings ; YES - check for warnings and display/update them |
| 643 | 433 |
| 434 btfsc trigger_temp_changed ; - temperature changed? | |
| 435 call TFT_surfmode_temp ; YES - display temperature | |
| 436 bcf trigger_temp_changed ; - clear flag (anyhow) | |
| 437 | |
| 438 btfsc trigger_pres_cur_changed ; YES - pressure changed? | |
| 439 call TFT_surfmode_pres_fast ; YES - display surface pressure, but only if change > threshold | |
| 440 bcf trigger_pres_cur_changed ; - clear flag (anyhow) | |
| 441 | |
| 623 | 442 |
| 443 IFDEF _rx_functions | |
| 444 btfss tr_functions_activated ; - TR functions activated? | |
| 445 bra housekeeping_0 ; NO - skip tank pressure part | |
| 446 | |
| 447 call get_pressure_readings ; YES - get pressure readings | |
| 634 | 448 call TFT_surfmode_tankpres ; - update first gas/diluent pressure |
| 623 | 449 |
| 450 movf active_customview,W ; - get current custom view | |
| 451 xorlw .10 ; - coding of tank data custom view | |
| 452 btfsc STATUS,Z ; - equal? | |
| 634 | 453 call TFT_surf_cv_tankdata ; YES - update tank data custom view |
| 623 | 454 ENDIF |
| 455 | |
| 456 housekeeping_0: | |
| 457 bsf restart_fast ; default to doing a fast restart (no logos) | |
| 643 | 458 btfsc divemode ; NO - need to enter dive mode? |
| 459 bra housekeeping_0b ; YES - but check again, to filter potential glitches (New sensor) | |
| 460 housekeeping_0a: | |
| 634 | 461 call check_dive_modes_surf ; check if dive mode needs to be entered, will set dive mode flag if yes |
| 623 | 462 btfsc simulatormode ; in simulator mode? |
| 463 bra housekeeping_1 ; YES - can't restart or go to sleep without prior cleanup | |
| 464 btfss trigger_timeout ; NO - timeout? | |
| 465 bra housekeeping_1 ; NO | |
| 466 btfsc surfmode_menu ; YES - in surface menus? | |
| 467 goto restart ; YES - goto restart, will proceed to surface mode | |
| 468 bcf restart_fast ; NO - set next restart to be done slow, i.e. with logos | |
| 469 goto sleeploop ; - goto sleep mode | |
| 470 | |
| 643 | 471 housekeeping_0b: |
| 472 call check_dive_modes_surf ; check if dive mode needs to be entered, will set dive mode flag if yes | |
| 473 btfsc divemode ; NO - really need to enter dive mode? | |
| 474 goto restart ; YES | |
| 475 bra housekeeping_0a ; No, continue above | |
| 476 | |
| 623 | 477 housekeeping_1: |
| 478 btfss trigger_quarter_second ; new 1/4 second begun? | |
| 479 bra housekeeping_2 ; NO | |
| 0 | 480 |
| 634 | 481 ;---- tasks any new 1/4 second ----- |
| 623 | 482 bcf trigger_quarter_second ; YES - clear flag |
| 643 | 483 |
| 484 btfss press_sensor_type ; New sensor found? | |
| 485 bra housekeeping_1aa ; No | |
| 486 | |
| 487 btfsc ms5837_state ; =0: result of temperature is in the ADC | |
| 488 bra housekeeping_1ab | |
| 489 call I2C_get_temp_val_MS5837 ; (Will set ms5837_state) | |
| 490 bra housekeeping_1aa ; Done. | |
| 491 housekeeping_1ab: | |
| 492 call I2C_get_press_val_MS5837 ; (Will clear ms5837_state) | |
| 493 housekeeping_1aa: | |
| 623 | 494 IFDEF _external_sensor |
| 495 btfsc imprint_sensor_mv ; - shall imprint sensor mV data? | |
| 634 | 496 call TFT_imprint_menu_mV ; YES - imprint sensor mV data |
| 623 | 497 ENDIF ; _external_sensor |
| 498 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
| 499 bra housekeeping_2 ; NO | |
| 643 | 500 |
| 623 | 501 IFDEF _compass |
| 502 movf active_customview,W ; - get current custom view | |
| 503 xorlw .6 ; - coding of compass custom view | |
| 504 btfsc STATUS,Z ; - equal? | |
| 505 call TFT_surface_compass_heading ; YES - update compass view | |
| 506 ENDIF ; _compass | |
| 507 IFDEF _external_sensor | |
| 508 btfsc FLAG_ccr_mode ; - in CCR mode? | |
| 509 bra housekeeping_1a ; - YES - handle sensors | |
| 510 btfsc FLAG_pscr_mode ; - in pSCR mode? | |
| 511 bra housekeeping_1a ; YES - handle sensors | |
| 512 bra housekeeping_2 ; NO to both | |
| 634 | 513 |
| 623 | 514 housekeeping_1a: ; handle sensors |
| 515 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: sensor, =2: autoSP | |
| 516 decfsz WREG ; opt_ccr_mode = 1 (sensor)? | |
| 517 bra housekeeping_2 ; NO - skip sensor readings | |
| 518 call calc_deko_divemode_sensor ; YES - read & calculate sensor data | |
| 634 | 519 call TFT_imprint_surf_ppO2 ; - update displayed sensor data |
| 520 call TFT_imprint_surf_sensor_eol ; - show a down-arrow behind sensor readings when sensor is at end-of-life | |
| 623 | 521 movf active_customview,W ; - get current custom view |
| 522 xorlw .9 ; - coding of sensor mV readings custom view | |
| 523 btfsc STATUS,Z ; - equal? | |
| 634 | 524 call TFT_imprint_surf_mV ; YES - update mV readings |
| 623 | 525 ENDIF ; _external_sensor |
| 634 | 526 |
| 623 | 527 housekeeping_2: |
| 528 btfss trigger_full_minute ; new 1/1 minute begun? | |
| 529 bra housekeeping_3 ; NO | |
| 530 | |
| 634 | 531 ;---- tasks any new minute --------- |
| 532 | |
| 623 | 533 bcf trigger_full_minute ; YES - clear flag |
| 634 | 534 |
| 535 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
| 536 bra housekeeping_2a ; NO | |
| 537 btfsc trigger_pres_cur_changed ; YES - pressure changed? | |
| 538 call TFT_surfmode_pres ; YES - display surface pressure | |
| 539 bcf trigger_pres_cur_changed ; - clear flag (anyhow) | |
| 540 | |
| 541 housekeeping_2a: | |
| 623 | 542 btfsc simulatormode ; - in simulator mode? |
| 634 | 543 bra housekeeping_2b ; YES - real tissues are in the vault, skip desaturation calculations |
| 623 | 544 call deco_calc_dive_interval_1min; NO - calculate 1 minute at surface conditions (C-code) |
| 545 call deco_calc_desaturation_time ; - calculate desaturation and no-fly/no-altitude time (C-code) | |
| 546 banksel common ; - back to bank common | |
| 634 | 547 |
| 548 housekeeping_2b: | |
| 623 | 549 btfss imprint_surfmode_data ; - shall imprint all surface mode data? |
| 550 bra housekeeping_3 ; NO | |
| 634 | 551 call TFT_surfmode_date ; YES - update displayed date |
| 623 | 552 |
| 553 movf active_customview,W ; - get current custom view | |
| 554 xorlw .5 ; - coding of tissue custom view | |
| 555 btfsc STATUS,Z ; - equal? | |
| 634 | 556 call TFT_surf_cv_tissues ; YES - update tissue diagram |
| 623 | 557 |
| 558 movf active_customview,W ; - get current custom view | |
| 559 xorlw .8 ; - coding of last dive info custom view | |
| 560 btfsc STATUS,Z ; - equal? | |
| 634 | 561 call TFT_surf_cv_lastdive ; YES - update last dive infos |
| 623 | 562 |
| 563 housekeeping_3: | |
| 634 | 564 |
| 565 ;---- tasks any round -------------- | |
| 566 | |
| 623 | 567 IFDEF _screendump |
| 568 btfsc screen_dump_avail ; screen dump function enabled? | |
| 569 call TFT_dump_screen_check ; YES - check if requested and do it | |
| 570 ELSE | |
| 571 btfsc comm_mode_disabled ; COMM mode disabled? | |
| 572 return ; YES - done | |
| 604 | 573 ENDIF |
| 629 | 574 return |
| 651 | 575 ; btfss surfmode_menu ; in surface menus? |
| 576 ; return ; NO - done | |
| 577 ; | |
| 578 ; btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
| 579 ; return ; YES - suppress COMM mode to not jeopardize backup/restore of tissue data | |
| 580 ; | |
| 581 ; btfss vusb_in ; USB plugged in? | |
| 582 ; return ; NO - done | |
| 583 ; IFDEF _screendump | |
| 584 ; btfsc screen_dump_avail ; YES - screen dump enabled? | |
| 585 ; return ; YES - no COMM mode to be able to make screen shots of the menu and simulator mode | |
| 586 ; ENDIF | |
| 587 ; btfss ble_available ; skip "USB" check in all Bluetooth models (required for very old OSTC sport) | |
| 588 ; goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal | |
| 589 ; return | |
|
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
590 |
| 623 | 591 ;----------------------------------------------------------------------------- |
| 592 | |
| 593 END |
