comparison src/surfmode.asm @ 643:7d8a4c60ec1a

3.15 release
author heinrichsweikamp
date Mon, 24 May 2021 18:40:53 +0200
parents 8c1f1f334275
children 682c514c53c0
comparison
equal deleted inserted replaced
642:a9a0188091e4 643:7d8a4c60ec1a
320 clrf message_counter ; clear message counter 320 clrf message_counter ; clear message counter
321 321
322 ; warnings for all modes 322 ; warnings for all modes
323 call check_battery ; check if the battery level should be displayed/warned 323 call check_battery ; check if the battery level should be displayed/warned
324 324
325 IFDEF _debug_output
326 call check_i2c_error ; check for an I2C error (For debugging purposes only)
327 ENDIF
328
325 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode 329 btfsc FLAG_apnoe_mode ; done for Apnoe or Gauge mode
326 bra surfmode_check_warnings2 330 bra surfmode_check_warnings2
327 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode 331 btfsc FLAG_gauge_mode ; done for Apnoe or Gauge mode
328 bra surfmode_check_warnings2 332 bra surfmode_check_warnings2
329 333
424 bra housekeeping_0 ; NO 428 bra housekeeping_0 ; NO
425 call TFT_surfmode_time ; YES - update displayed time 429 call TFT_surfmode_time ; YES - update displayed time
426 call TFT_surfmode_batt ; - update displayed battery voltage 430 call TFT_surfmode_batt ; - update displayed battery voltage
427 btfss timebase_1sec,0 ; - on even second? 431 btfss timebase_1sec,0 ; - on even second?
428 call surfmode_check_warnings ; YES - check for warnings and display/update them 432 call surfmode_check_warnings ; YES - check for warnings and display/update them
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
429 442
430 IFDEF _rx_functions 443 IFDEF _rx_functions
431 btfss tr_functions_activated ; - TR functions activated? 444 btfss tr_functions_activated ; - TR functions activated?
432 bra housekeeping_0 ; NO - skip tank pressure part 445 bra housekeeping_0 ; NO - skip tank pressure part
433 446
440 call TFT_surf_cv_tankdata ; YES - update tank data custom view 453 call TFT_surf_cv_tankdata ; YES - update tank data custom view
441 ENDIF 454 ENDIF
442 455
443 housekeeping_0: 456 housekeeping_0:
444 bsf restart_fast ; default to doing a fast restart (no logos) 457 bsf restart_fast ; default to doing a fast restart (no logos)
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:
445 call check_dive_modes_surf ; check if dive mode needs to be entered, will set dive mode flag if yes 461 call check_dive_modes_surf ; check if dive mode needs to be entered, will set dive mode flag if yes
446 btfsc simulatormode ; in simulator mode? 462 btfsc simulatormode ; in simulator mode?
447 bra housekeeping_1 ; YES - can't restart or go to sleep without prior cleanup 463 bra housekeeping_1 ; YES - can't restart or go to sleep without prior cleanup
448 btfsc divemode ; NO - need to enter dive mode?
449 goto restart ; YES - restart, will proceed to dive mode
450 btfss trigger_timeout ; NO - timeout? 464 btfss trigger_timeout ; NO - timeout?
451 bra housekeeping_1 ; NO 465 bra housekeeping_1 ; NO
452 btfsc surfmode_menu ; YES - in surface menus? 466 btfsc surfmode_menu ; YES - in surface menus?
453 goto restart ; YES - goto restart, will proceed to surface mode 467 goto restart ; YES - goto restart, will proceed to surface mode
454 bcf restart_fast ; NO - set next restart to be done slow, i.e. with logos 468 bcf restart_fast ; NO - set next restart to be done slow, i.e. with logos
455 goto sleeploop ; - goto sleep mode 469 goto sleeploop ; - goto sleep mode
456 470
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
457 housekeeping_1: 477 housekeeping_1:
458 btfss trigger_quarter_second ; new 1/4 second begun? 478 btfss trigger_quarter_second ; new 1/4 second begun?
459 bra housekeeping_2 ; NO 479 bra housekeeping_2 ; NO
460 480
461 ;---- tasks any new 1/4 second ----- 481 ;---- tasks any new 1/4 second -----
462
463 bcf trigger_quarter_second ; YES - clear flag 482 bcf trigger_quarter_second ; YES - clear flag
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:
464 IFDEF _external_sensor 494 IFDEF _external_sensor
465 btfsc imprint_sensor_mv ; - shall imprint sensor mV data? 495 btfsc imprint_sensor_mv ; - shall imprint sensor mV data?
466 call TFT_imprint_menu_mV ; YES - imprint sensor mV data 496 call TFT_imprint_menu_mV ; YES - imprint sensor mV data
467 ENDIF ; _external_sensor 497 ENDIF ; _external_sensor
468 btfss imprint_surfmode_data ; - shall imprint all surface mode data? 498 btfss imprint_surfmode_data ; - shall imprint all surface mode data?
469 bra housekeeping_2 ; NO 499 bra housekeeping_2 ; NO
470 btfsc trigger_pres_cur_changed ; YES - pressure changed? 500
471 call TFT_surfmode_pres_fast ; YES - display surface pressure, but only if change > threshold
472 bcf trigger_pres_cur_changed ; - clear flag (anyhow)
473 IFDEF _compass 501 IFDEF _compass
474 movf active_customview,W ; - get current custom view 502 movf active_customview,W ; - get current custom view
475 xorlw .6 ; - coding of compass custom view 503 xorlw .6 ; - coding of compass custom view
476 btfsc STATUS,Z ; - equal? 504 btfsc STATUS,Z ; - equal?
477 call TFT_surface_compass_heading ; YES - update compass view 505 call TFT_surface_compass_heading ; YES - update compass view
520 housekeeping_2b: 548 housekeeping_2b:
521 btfss imprint_surfmode_data ; - shall imprint all surface mode data? 549 btfss imprint_surfmode_data ; - shall imprint all surface mode data?
522 bra housekeeping_3 ; NO 550 bra housekeeping_3 ; NO
523 call TFT_surfmode_date ; YES - update displayed date 551 call TFT_surfmode_date ; YES - update displayed date
524 552
525 btfsc trigger_temp_changed ; - temperature changed?
526 call TFT_surfmode_temp ; YES - display temperature
527 bcf trigger_temp_changed ; - clear flag (anyhow)
528
529 movf active_customview,W ; - get current custom view 553 movf active_customview,W ; - get current custom view
530 xorlw .5 ; - coding of tissue custom view 554 xorlw .5 ; - coding of tissue custom view
531 btfsc STATUS,Z ; - equal? 555 btfsc STATUS,Z ; - equal?
532 call TFT_surf_cv_tissues ; YES - update tissue diagram 556 call TFT_surf_cv_tissues ; YES - update tissue diagram
533 557