Mercurial > public > hwos_code
annotate src/surfmode.asm @ 623:c40025d8e750
3.03 beta released
| author | heinrichsweikamp |
|---|---|
| date | Mon, 03 Jun 2019 14:01:48 +0200 |
| parents | 1ad0531e9078 |
| children | cd58f7fc86db |
| rev | line source |
|---|---|
| 0 | 1 ;============================================================================= |
| 2 ; | |
| 623 | 3 ; File surfmode.asm next combined generation V3.03.2 |
| 0 | 4 ; |
| 623 | 5 ; Surface Mode |
| 0 | 6 ; |
| 7 ; Copyright (c) 2011, JD Gascuel, HeinrichsWeikamp, all right reserved. | |
| 8 ;============================================================================= | |
| 9 ; HISTORY | |
| 582 | 10 ; 2011-08-07 : [mH] moving from OSTC code |
| 0 | 11 |
| 582 | 12 #include "hwos.inc" ; Mandatory header |
| 13 #include "shared_definitions.h" ; Mailbox from/to p2_deco.c | |
| 14 #include "start.inc" | |
| 15 #include "tft.inc" | |
| 16 #include "tft_outputs.inc" | |
| 17 #include "adc_lightsensor.inc" | |
| 18 #include "menu_processor.inc" | |
| 19 #include "strings.inc" | |
| 20 #include "sleepmode.inc" | |
| 623 | 21 #include "wait.inc" |
| 582 | 22 #include "external_flash.inc" |
| 23 #include "customview.inc" | |
| 24 #include "divemode.inc" | |
| 25 #include "mcp.inc" ; RX | |
| 26 #include "i2c.inc" | |
| 27 #include "comm.inc" | |
| 28 #include "eeprom_rs232.inc" | |
| 29 #include "calibrate.inc" | |
| 623 | 30 #include "rx_ops.inc" |
| 0 | 31 |
| 604 | 32 |
| 582 | 33 extern do_main_menu |
| 604 | 34 extern check_cns_violation |
| 35 extern check_warn_battery | |
| 623 | 36 extern check_and_store_sat_violation |
| 604 | 37 extern check_mbubbles |
| 38 | |
| 39 IFDEF _osct_logo | |
| 40 extern ostc_logo_block | |
| 41 ENDIF | |
| 582 | 42 |
| 623 | 43 IFDEF _compass |
| 44 extern TFT_surface_compass_heading | |
| 45 ENDIF | |
| 582 | 46 |
| 213 | 47 |
| 623 | 48 ;---- Private local variables ------------------------------------------------ |
| 49 | |
| 50 CBLOCK local1 ; max size is 16 byte !!! | |
| 604 | 51 ; currently not used |
| 52 ENDC ; used: 0 byte, remaining: 16 byte | |
| 582 | 53 |
| 0 | 54 |
| 582 | 55 #DEFINE menu_pos_row .215 |
| 56 #DEFINE menu_pos_column .1 | |
| 57 #DEFINE view_row .215 | |
| 58 #DEFINE view_column .124 | |
| 0 | 59 |
| 623 | 60 |
| 61 sfmode CODE | |
| 0 | 62 |
| 63 ;============================================================================= | |
| 64 ; Boot tasks for all modes | |
| 623 | 65 ; |
| 66 ; called after restart via the battery selection, after compass calibration, | |
| 67 ; and via ghostwriter at the end of a dive | |
| 68 ; | |
| 0 | 69 global surfloop |
| 70 surfloop: | |
| 623 | 71 clrf STKPTR ; clear return addresses stack |
| 72 ; clrf CCP1CON ; stop PWM | |
| 73 ; bcf PORTC,2 ; pull PWM output to GND | |
| 74 clrf CCPR1L ; backlight off | |
| 75 call TFT_boot ; initialize TFT (includes clear screen) | |
| 245 | 76 |
| 623 | 77 btfsc restart_fast ; shall make a fast restart? |
| 78 bra surfloop_1 ; YES | |
| 0 | 79 |
| 623 | 80 ; show heinrichsweikamp logo |
| 604 | 81 WIN_TOP .40 |
| 582 | 82 WIN_LEFT .10 |
| 623 | 83 TFT_WRITE_PROM_IMAGE_BY_ADDR hw_logo_block |
| 0 | 84 |
| 604 | 85 IFDEF _ostc_logo |
| 623 | 86 ; show graphical OSTC logo |
| 604 | 87 WIN_TOP .100 |
| 582 | 88 WIN_LEFT .34 |
| 623 | 89 TFT_WRITE_PROM_IMAGE_BY_LABEL ostc_logo_block |
| 604 | 90 ELSE |
| 623 | 91 ; show textual OSTC logo |
| 604 | 92 WIN_COLOR color_white |
| 93 WIN_STD .30,.90 ; column, row | |
| 94 STRCPY_PRINT "Open Source" ; show OSTC banner text, line 1 | |
| 95 WIN_STD .20,.130 ; column, row | |
| 96 STRCPY_PRINT "Tauch-Computer" ; show OSTC banner text, line 2 | |
| 97 ENDIF | |
| 98 | |
| 99 WIN_COLOR color_white | |
| 100 WIN_SMALL .35,.180 | |
| 101 PUTC "v" ; print v | |
| 102 call TFT_cat_firmware ; print x.y | |
| 623 | 103 PUTC " " ; print _ |
| 604 | 104 call TFT_cat_beta_release ; print BetaZ or Release |
| 105 STRCAT_PRINT "" ; finalize output | |
| 106 bcf win_invert ; clean up eventual color-coding | |
| 107 call TFT_standard_color ; ditto | |
| 623 | 108 call TFT_Display_FadeIn ; dim up the display |
| 604 | 109 |
| 623 | 110 surfloop_1: |
| 111 ;---- Do all useful initializations that take time ----------------------- | |
| 604 | 112 |
| 623 | 113 ; set deco mode flags |
| 114 call restart_set_modes_and_flags | |
| 115 | |
| 116 bsf trigger_pres_cur_changed; set flag to have pressure written to display on first round of surface loop | |
| 117 bsf trigger_temp_changed ; set flag to have temperature written to display on first round of surface loop | |
| 118 | |
| 119 call I2C_sleep_compass ; shut down compass | |
| 120 call I2C_sleep_accelerometer ; shut down accelerometer | |
| 121 | |
| 0 | 122 clrf ext_flash_address+0 |
| 123 clrf ext_flash_address+1 | |
| 124 clrf ext_flash_address+2 | |
| 125 | |
| 623 | 126 IFDEF _ccr_pscr |
| 127 movlw surface_sp ; load default surface setpoint (in cbar) | |
| 128 movff WREG,char_I_const_ppO2 ; store it as current setpoint | |
| 129 ENDIF | |
| 130 | |
| 131 IFDEF _external_sensor | |
| 132 call transmit_setpoint ; transmit current setpoint (in cbar) via S8 digital interface (currently disabled) | |
| 133 ENDIF | |
|
221
90923a081ae7
minor: configure buttons during splash screen
heinrichsweikamp
parents:
213
diff
changeset
|
134 |
| 623 | 135 bcf surfmode_menu ; not in surface menu (any more) |
| 136 bcf compass_menu ; not in "set bearing" selection (any more) | |
| 137 bcf bailout_mode ; not in bailout menu (any more) | |
| 0 | 138 |
| 623 | 139 bcf switch_left ; clear intermediate button event since start/restart |
| 140 bcf switch_right ; clear intermediate button event since start/restart | |
| 141 | |
| 142 btfsc restart_fast ; shall make a fast restart? | |
| 143 bra surfloop_2 ; YES | |
| 604 | 144 |
| 145 call wait_1s ; wait <= 1 second | |
| 146 call wait_1s ; wait 1 second | |
| 147 call wait_1s ; wait 1 second | |
| 0 | 148 |
| 149 ;---- Fade to standard surface view -------------------------------------- | |
| 150 | |
| 623 | 151 call TFT_Display_FadeOut ; dim down display to black screen |
| 152 call TFT_ClearScreen ; clear screen | |
| 153 | |
| 154 surfloop_2: | |
| 604 | 155 WIN_TOP .0 |
| 582 | 156 WIN_LEFT .0 |
| 157 WIN_FONT FT_SMALL | |
| 623 | 158 bcf win_invert ; clear flag for inverted text |
| 0 | 159 |
| 623 | 160 ; show button functionalities |
| 582 | 161 WIN_COLOR color_lightblue |
| 162 WIN_SMALL menu_pos_column,menu_pos_row | |
| 623 | 163 STRCPY_TEXT_PRINT tMenu ; show "<Menu" |
| 582 | 164 WIN_SMALL view_column,view_row |
| 623 | 165 STRCPY_TEXT_PRINT tView ; show "View>" |
| 582 | 166 call TFT_standard_color |
| 0 | 167 |
| 623 | 168 |
| 169 ;---- Logo in upper right corner ----------------------------------------- | |
| 604 | 170 IFDEF _ostc_logo |
| 623 | 171 ; show graphical OSTC logo |
| 604 | 172 WIN_TOP .0 |
| 582 | 173 WIN_LEFT .70 |
| 623 | 174 TFT_WRITE_PROM_IMAGE_BY_LABEL ostc_logo_block |
| 604 | 175 ELSE |
| 623 | 176 ; show textual OSTC logo |
| 177 WIN_COLOR color_white ; set text color to white | |
| 178 WIN_STD .100,.2 ; set output position | |
| 604 | 179 STRCPY_PRINT "OSTC" ; show "OSTC" |
| 623 | 180 WIN_COLOR color_cyan ; set text color to cyan |
| 181 WIN_TINY .138,.2 ; set output position | |
| 604 | 182 STRCPY_PRINT "hwOS" ; show "hwOS" |
| 623 | 183 WIN_TINY .137,.14 ; set output position |
| 184 IFDEF _hwos_sport | |
| 185 STRCPY_PRINT "sport" ; show "sport" | |
| 186 ELSE | |
| 604 | 187 STRCPY_PRINT "tech" ; show "tech" |
| 188 ENDIF | |
| 623 | 189 WIN_TINY .100,.32 ; set output position |
| 190 call TFT_show_firmware ; show firmware version | |
| 191 ENDIF ; _ostc_logo | |
| 0 | 192 |
| 193 | |
| 623 | 194 ;---- fill screen -------------------------------------------------------- |
| 195 call get_battery_voltage ; get battery voltage | |
| 196 call TFT_batt_surfmode ; display battery voltage | |
| 197 call TFT_time_surfmode ; display time | |
| 198 call TFT_date_surfmode ; display date | |
| 199 call TFT_pres_surfmode ; display surface pressure | |
| 200 call TFT_temp_surfmode ; display temperature | |
| 201 call TFT_decotype_surface ; display deco mode | |
| 582 | 202 |
| 623 | 203 TSTOSS opt_dive_mode ; in OC? (0=OC, 1=CC, 2=Gauge, 3=Apnea, 4=pSCR) |
| 204 call TFT_show_OC_startgas_surface ; YES - show first gas and "OSTC2-like" active gases | |
| 0 | 205 |
| 623 | 206 movff customview_surfmode,active_customview ; reload last custom view |
| 207 call surf_customview_mask ; redraw last custom view | |
| 582 | 208 |
| 623 | 209 call TFT_Display_FadeIn ; display resulting surface screen |
| 0 | 210 |
| 604 | 211 IFDEF _screendump |
| 623 | 212 btfsc screen_dump_avail ; screen dump function enabled? |
| 213 call enable_rs232 ; YES - activate RS232 (also sets CPU to normal speed) | |
| 604 | 214 ENDIF |
| 215 | |
| 623 | 216 bcf restart_fast ; clear flag for fast restart |
| 217 bsf imprint_surfmode_data ; start imprinting surface mode data | |
| 0 | 218 |
| 623 | 219 bcf switch_left ; clear pending left button event |
| 220 bcf switch_right ; clear pending right button event | |
| 0 | 221 |
| 623 | 222 rcall reset_timeout_surfmode ; reset timeout |
| 582 | 223 |
| 623 | 224 surfloop_loop: |
| 225 ; call TFT_debug_output ; optional debug output | |
|
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
226 |
| 623 | 227 call test_switches_surfmode ; check switches |
|
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
228 |
| 623 | 229 btfsc request_next_custview ; shall show next custom view? |
| 230 call surf_customview_toggle ; YES - show next custom view (and clear this flag) | |
| 0 | 231 |
| 623 | 232 btfss surfmode_menu ; shall enter surface menu? |
| 233 bra surfloop_loop_1 ; NO | |
| 234 bcf imprint_surfmode_data ; YES - stop imprinting surface mode data | |
| 235 goto do_main_menu ; - goto surface menu | |
| 582 | 236 |
| 623 | 237 surfloop_loop_1: |
| 238 rcall housekeeping ; handle data imprinting, screen dump request, timeout and entering dive mode | |
| 239 bra surfloop_loop ; loop in surface mode | |
| 582 | 240 |
| 0 | 241 |
| 242 surfmode_check_for_warnings: | |
| 623 | 243 clrf message_counter ; clear message counter |
| 560 | 244 |
| 604 | 245 ; warnings for all modes |
| 623 | 246 call check_warn_battery ; check if the battery level should be displayed/warned |
| 0 | 247 |
| 623 | 248 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode |
| 582 | 249 bra surfmode_check_for_warnings2 |
| 623 | 250 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode |
| 582 | 251 bra surfmode_check_for_warnings2 |
| 0 | 252 |
| 604 | 253 ; warnings only in deco modes |
| 623 | 254 call check_and_store_sat_violation ; check/show tissue saturation |
| 255 call check_cns_violation ; check/show CNS value | |
| 256 call check_mbubbles ; check/show micro bubbles warning | |
| 257 movff int_O_lead_supersat+1,WREG ; get upper byte of leading tissue's supersaturation | |
| 258 btfsc WREG,int_warning_flag ; check if the warning flag is set | |
| 259 bra surfmode_check_for_warnings2 ; YES - outside model | |
| 260 rcall surfmode_check_for_desat ; NO - check/display desaturation time | |
| 261 rcall surfmode_check_for_nofly ; NO - check/display no-fly time | |
| 560 | 262 |
| 0 | 263 surfmode_check_for_warnings2: |
| 604 | 264 ; setup message page number |
| 623 | 265 incf message_page,F ; increment page number |
| 266 bcf STATUS,C ; clear carry bit | |
| 267 rlcf message_page,W ; each page can take two messages | |
| 268 cpfsgt message_counter ; number of actual messages > message capacity ? | |
| 269 clrf message_page ; NO - all messages could be shown, restart from first page next time | |
| 0 | 270 |
| 623 | 271 ; clear both rows if there is nothing to show at all |
| 272 tstfsz message_counter ; any message to show? | |
| 273 bra surfmode_check_for_warnings3 ; YES - look if second row needs to be cleared | |
| 274 goto TFT_clear_message_window ; NO - clear complete message area and return | |
| 0 | 275 |
| 582 | 276 surfmode_check_for_warnings3: |
| 623 | 277 ; clear 2nd row of messages if there is nothing to show (on this page) |
| 278 btfss message_2nd_row_used ; does the 2nd row contain a message? | |
| 279 goto TFT_clear_message_window_row2 ; NO - clear the 2nd row and return | |
| 280 return ; YES - done | |
| 281 | |
| 0 | 282 |
| 283 surfmode_check_for_desat: | |
| 560 | 284 banksel int_O_desaturation_time |
| 604 | 285 movf int_O_desaturation_time+0,W |
| 582 | 286 iorwf int_O_desaturation_time+1,W |
| 623 | 287 banksel common ; back to bank common |
| 288 bnz surfmode_check_for_desat_1 ; is the desat-time > 0 ? | |
| 289 return ; NO - done | |
| 290 surfmode_check_for_desat_1: | |
| 291 incf message_counter,F ; YES - increase counter | |
| 292 call TFT_desaturation_time ; - show desaturation time | |
| 293 return ; - done | |
| 0 | 294 |
| 295 surfmode_check_for_nofly: | |
| 560 | 296 banksel int_O_nofly_time |
| 604 | 297 movf int_O_nofly_time+0,W |
| 582 | 298 iorwf int_O_nofly_time+1,W |
| 623 | 299 banksel common ; back to bank common |
| 300 bnz surfmode_check_for_nofly_1 ; is the nofly-time > 0 ? | |
| 301 return ; NO - done | |
| 302 surfmode_check_for_nofly_1: | |
| 303 incf message_counter,F ; YES - increase counter | |
| 304 call TFT_nofly_time ; - show nofly-time | |
| 305 return ; - done | |
| 0 | 306 |
| 307 | |
| 308 ;============================================================================= | |
| 560 | 309 |
| 623 | 310 test_switches_surfmode: ; check buttons in surface mode |
| 311 btfsc switch_right ; right button pressed? | |
| 312 bra test_switches_surfmode2 ; YES | |
| 313 btfsc switch_left ; left button pressed? | |
| 314 bra test_switches_surfmode3 ; YES | |
| 315 return ; NO to both - done | |
| 316 | |
| 317 test_switches_surfmode2: ; right button pressed | |
| 318 bcf switch_right ; clear button event | |
| 319 rcall reset_timeout_surfmode ; reset timeout | |
| 320 IFDEF _compass | |
| 321 movlw .6 ; coding for surface custom compass view | |
| 322 cpfseq active_customview ; in compass view? | |
| 323 bra test_switches_surfmode2a ; NO | |
| 324 btfss compass_menu ; "set course" selection shown? | |
| 325 bra test_switches_surfmode2a ; NO | |
| 326 bsf compass_bearing_set ; YES - set new course | |
| 327 MOVII compass_heading_shown,compass_bearing | |
| 328 bra test_switches_surfmode3b ; - clear "Course" label and return | |
| 329 ENDIF | |
| 330 test_switches_surfmode2a: | |
| 331 bsf request_next_custview ; request next custom view | |
| 332 bcf compass_menu ; "set course" selection not shown anymore | |
| 0 | 333 return |
| 334 | |
| 623 | 335 test_switches_surfmode3: ; left button pressed |
| 336 bcf switch_left ; clear button event | |
| 337 rcall reset_timeout_surfmode ; reset timeout | |
| 338 IFDEF _compass | |
| 339 movlw .6 ; coding for surface custom view compass | |
| 340 cpfseq active_customview ; in compass view? | |
| 604 | 341 bra test_switches_surfmode3a ; NO |
| 623 | 342 btfsc compass_menu ; YES - "set course" selection already shown? |
| 343 bra test_switches_surfmode3b ; YES - remove it | |
| 344 call TFT_surf_set_bearing ; NO - show it | |
| 582 | 345 return |
| 623 | 346 ENDIF |
| 382 | 347 test_switches_surfmode3a: |
| 623 | 348 bcf compass_bearing_set ; clear course on entering menu |
| 349 bsf surfmode_menu ; flag that the surface menu shall be entered | |
| 582 | 350 return |
| 382 | 351 |
| 623 | 352 IFDEF _compass |
| 353 test_switches_surfmode3b: | |
| 354 WIN_BOX_BLACK .158,.190, .15, .99 ; clear "Course" label (top, bottom, left, right) | |
| 355 bcf compass_menu ; clear flag for "set course" selection | |
| 582 | 356 return |
| 623 | 357 ENDIF |
| 382 | 358 |
| 623 | 359 |
| 360 ; handle data imprinting, screen dump request, timeout and entering dive mode | |
| 361 global housekeeping | |
| 362 housekeeping: | |
| 363 btfss trigger_full_second ; new 1/1 second begun? | |
| 364 bra housekeeping_1 ; NO | |
| 365 | |
| 366 ; tasks any new second | |
| 367 bcf trigger_full_second ; YES - clear flag | |
| 368 call get_battery_voltage ; - get battery voltage | |
| 369 | |
| 370 btfsc imprint_time_date ; - shall imprint the current time & date? | |
| 371 call TFT_show_time_date_menu ; YES - imprint time and date on display (copies running time to latch registers) | |
| 372 | |
| 373 IFDEF _rx_functions | |
| 374 btfsc tr_functions_activated ; - TR functions activated? | |
| 375 call I2C_get_tankdata ; YES - get new transmitter data | |
| 376 | |
| 377 btfsc imprint_xmitter_pres ; - shall imprint transmitter ID and pressure? | |
| 378 call TFT_menu_tank_pres ; YES - imprint transmitter ID and pressure | |
| 379 ENDIF | |
| 380 | |
| 381 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
| 382 bra housekeeping_0 ; NO | |
| 383 call TFT_time_surfmode ; YES - update displayed time | |
| 384 call TFT_batt_surfmode ; - update displayed battery voltage | |
| 385 btfss timebase_1sec,0 ; - on even second? | |
| 386 call surfmode_check_for_warnings ; YES - check for warnings and display/update them | |
| 387 | |
| 388 IFDEF _rx_functions | |
| 389 btfss tr_functions_activated ; - TR functions activated? | |
| 390 bra housekeeping_0 ; NO - skip tank pressure part | |
| 391 | |
| 392 call get_pressure_readings ; YES - get pressure readings | |
| 393 call TFT_surface_tank_pres ; - update first gas/diluent pressure | |
| 394 | |
| 395 movf active_customview,W ; - get current custom view | |
| 396 xorlw .10 ; - coding of tank data custom view | |
| 397 btfsc STATUS,Z ; - equal? | |
| 398 call TFT_surface_tankdata ; YES - update tank data custom view | |
| 399 ENDIF | |
| 400 | |
| 401 housekeeping_0: | |
| 402 bsf restart_fast ; default to doing a fast restart (no logos) | |
| 403 call set_dive_modes ; check if dive mode needs to be entered, will set dive mode flag if yes | |
| 404 btfsc simulatormode ; in simulator mode? | |
| 405 bra housekeeping_1 ; YES - can't restart or go to sleep without prior cleanup | |
| 406 btfsc divemode ; NO - need to enter dive mode? | |
| 407 goto restart ; YES - restart, will proceed to dive mode | |
| 408 btfss trigger_timeout ; NO - timeout? | |
| 409 bra housekeeping_1 ; NO | |
| 410 btfsc surfmode_menu ; YES - in surface menus? | |
| 411 goto restart ; YES - goto restart, will proceed to surface mode | |
| 412 bcf restart_fast ; NO - set next restart to be done slow, i.e. with logos | |
| 413 goto sleeploop ; - goto sleep mode | |
| 414 | |
| 415 housekeeping_1: | |
| 416 btfss trigger_quarter_second ; new 1/4 second begun? | |
| 417 bra housekeeping_2 ; NO | |
| 0 | 418 |
| 623 | 419 ; tasks any new 1/4 second |
| 420 bcf trigger_quarter_second ; YES - clear flag | |
| 421 IFDEF _external_sensor | |
| 422 btfsc imprint_sensor_mv ; - shall imprint sensor mV data? | |
| 423 call TFT_menu_calibrate ; YES - imprint sensor mV data | |
| 424 ENDIF ; _external_sensor | |
| 425 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
| 426 bra housekeeping_2 ; NO | |
| 427 btfsc trigger_pres_cur_changed ; YES - pressure changed? | |
| 428 call TFT_pres_surfmode ; YES - display surface pressure | |
| 429 bcf trigger_pres_cur_changed ; - clear flag (anyhow) | |
| 430 IFDEF _compass | |
| 431 movf active_customview,W ; - get current custom view | |
| 432 xorlw .6 ; - coding of compass custom view | |
| 433 btfsc STATUS,Z ; - equal? | |
| 434 call TFT_surface_compass_heading ; YES - update compass view | |
| 435 ENDIF ; _compass | |
| 436 IFDEF _external_sensor | |
| 437 btfsc FLAG_ccr_mode ; - in CCR mode? | |
| 438 bra housekeeping_1a ; - YES - handle sensors | |
| 439 btfsc FLAG_pscr_mode ; - in pSCR mode? | |
| 440 bra housekeeping_1a ; YES - handle sensors | |
| 441 bra housekeeping_2 ; NO to both | |
| 442 housekeeping_1a: ; handle sensors | |
| 443 movff opt_ccr_mode,WREG ; =0: fixed SP, =1: sensor, =2: autoSP | |
| 444 decfsz WREG ; opt_ccr_mode = 1 (sensor)? | |
| 445 bra housekeeping_2 ; NO - skip sensor readings | |
| 446 call calc_deko_divemode_sensor ; YES - read & calculate sensor data | |
| 447 call TFT_surface_sensor ; - update displayed sensor data | |
| 448 call TFT_sensor_surface_warning ; - show a down-arrow behind sensor readings when sensor is at end-of-life | |
| 449 movf active_customview,W ; - get current custom view | |
| 450 xorlw .9 ; - coding of sensor mV readings custom view | |
| 451 btfsc STATUS,Z ; - equal? | |
| 452 call TFT_sensor_mV ; YES - update mV readings | |
| 453 ENDIF ; _external_sensor | |
| 454 housekeeping_2: | |
| 455 btfss trigger_full_minute ; new 1/1 minute begun? | |
| 456 bra housekeeping_3 ; NO | |
| 457 | |
| 458 ; tasks any new minute | |
| 459 bcf trigger_full_minute ; YES - clear flag | |
| 460 btfsc simulatormode ; - in simulator mode? | |
| 461 bra housekeeping_2a ; YES - real tissues are in the vault, skip desaturation calculations | |
| 462 call deco_calc_dive_interval_1min; NO - calculate 1 minute at surface conditions (C-code) | |
| 463 call deco_calc_desaturation_time ; - calculate desaturation and no-fly/no-altitude time (C-code) | |
| 464 banksel common ; - back to bank common | |
| 465 housekeeping_2a: | |
| 466 btfss imprint_surfmode_data ; - shall imprint all surface mode data? | |
| 467 bra housekeeping_3 ; NO | |
| 468 call TFT_date_surfmode ; YES - update displayed date | |
| 469 | |
| 470 btfsc trigger_temp_changed ; - temperature changed? | |
| 471 call TFT_temp_surfmode ; YES - display temperature | |
| 472 bcf trigger_temp_changed ; - clear flag (anyhow) | |
| 473 | |
| 474 movf active_customview,W ; - get current custom view | |
| 475 xorlw .5 ; - coding of tissue custom view | |
| 476 btfsc STATUS,Z ; - equal? | |
| 477 call TFT_surface_tissues ; YES - update tissue diagram | |
| 478 | |
| 479 movf active_customview,W ; - get current custom view | |
| 480 xorlw .8 ; - coding of last dive info custom view | |
| 481 btfsc STATUS,Z ; - equal? | |
| 482 call TFT_surface_lastdive ; YES - update last dive infos | |
| 483 | |
| 484 housekeeping_3: | |
| 485 ; tasks any round | |
| 486 IFDEF _screendump | |
| 487 btfsc screen_dump_avail ; screen dump function enabled? | |
| 488 call TFT_dump_screen_check ; YES - check if requested and do it | |
| 489 ELSE | |
| 490 btfsc comm_mode_disabled ; COMM mode disabled? | |
| 491 return ; YES - done | |
| 604 | 492 ENDIF |
| 623 | 493 btfss surfmode_menu ; in surface menus? |
| 494 return ; NO - done | |
| 495 | |
| 496 btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
| 497 return ; YES - suppress COMM mode to not jeopardize backup/restore of tissue data | |
| 498 | |
| 499 btfss vusb_in ; USB plugged in? | |
| 500 return ; NO - done | |
| 501 IFDEF _screendump | |
| 502 btfsc screen_dump_avail ; YES - screen dump enabled? | |
| 503 return ; YES - no COMM mode to be able to make screen shots of the menu and simulator mode | |
| 504 ENDIF | |
| 505 goto comm_mode_usb ; YES / NO - proceed to COMM mode, will also set CPU to speed normal | |
| 506 | |
|
188
ebc28381f17d
NEW: Show Bailout Gas List in Surface mode (CCR Modes)
heinrichsweikamp
parents:
187
diff
changeset
|
507 |
| 623 | 508 global reset_timeout_surfmode |
| 509 reset_timeout_surfmode: | |
| 510 movlw surfmode_timeout_default ; load default timeout value | |
| 511 btfsc imprint_sensor_mv ; currently imprinting O2 sensor mV data? | |
| 512 movlw surfmode_timeout_calibrate ; YES - replace with CCR Calibrate Menu timeout | |
| 513 btfsc simulatormode ; currently in simulator (deco calculator) mode? | |
| 514 movlw surfmode_timeout_simulator ; YES - replace with simulator timeout | |
| 515 IFDEF _rx_functions | |
| 516 btfsc imprint_xmitter_ID ; currently selecting pressure transmitter? | |
| 517 movlw surfmode_timeout_xmitter ; YES - replace with transmitter selection timeout | |
| 518 ENDIF ; _rx_functions | |
| 519 IFDEF _external_sensor | |
| 520 btfsc surfmode_menu ; in surface menu? | |
| 521 bra reset_timeout_time ; YES - keep timeout value | |
| 522 btfsc FLAG_ccr_mode ; NO - in CCR mode? | |
| 523 bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode | |
| 524 btfsc FLAG_ccr_mode ; NO - in pSCR mode? | |
| 525 bra reset_timeout_surfmode_loop ; YES - continue checking if in sensor mode | |
| 526 bra reset_timeout_time ; NO - keep timeout value | |
| 527 reset_timeout_surfmode_loop: | |
| 528 movff opt_ccr_mode,lo ; get loop mode (=0: fixed/calculated SP, =1: sensor, =2: auto SP) | |
| 529 decfsz lo,f ; in sensor mode? | |
| 530 bra reset_timeout_time ; NO - keep timeout value | |
| 531 movlw surfmode_timeout_sensor ; YES - replace with sensor mode timeout | |
| 532 ENDIF ; _external_sensor | |
| 533 ;bra reset_timeout_time ; - set timeout value | |
| 0 | 534 |
| 623 | 535 |
| 536 global reset_timeout_time | |
| 537 reset_timeout_time: ; entry point with timeout value in WREG | |
| 538 movwf isr_timeout_reload ; copy WREG to isr_timeout_reload | |
| 539 bsf reset_timeout ; request ISR to reset the timeout | |
| 540 bcf trigger_timeout ; clear any pending timeout trigger | |
| 541 return ; done | |
| 542 | |
| 543 ;----------------------------------------------------------------------------- | |
| 544 | |
| 545 END |
