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