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