comparison src/divemode.asm @ 583:6636cbe64c6d

optical input work
author heinrichsweikamp
date Tue, 27 Feb 2018 12:27:31 +0100
parents b455b31ce022
children bf0c76e9b01b
comparison
equal deleted inserted replaced
582:b455b31ce022 583:6636cbe64c6d
523 btfss new_s8_data_available ; YES - check if a new data frame was received 523 btfss new_s8_data_available ; YES - check if a new data frame was received
524 bra calc_deko_divemode_sensor_common ; NO - use old values -- TODO: add timeout for no new data 524 bra calc_deko_divemode_sensor_common ; NO - use old values -- TODO: add timeout for no new data
525 call compute_mvolts_for_all_sensors ; YES - compute mV values from digital data 525 call compute_mvolts_for_all_sensors ; YES - compute mV values from digital data
526 bra calc_deko_divemode_sensor_common 526 bra calc_deko_divemode_sensor_common
527 527
528 calc_deko_divemode_sensor_opt:
529 btfss optical_input ; do we have an optical input?
530 return ; No, return (We have no sensors at all. Not analog, not S8 and not optical)
531 ;o2_ppo2_sensor1, o2_ppo2_sensor2 and o2_ppo2_sensor3 are already filled in ISR
532 ;clear use_O2_sensorX for timeout case
533 btfss sensor1_active
534 bcf use_O2_sensor1
535 btfss sensor2_active
536 bcf use_O2_sensor2
537 btfss sensor3_active
538 bcf use_O2_sensor3
539 bra calc_deko_divemode_sensor1
540
528 calc_deko_divemode_sensor_analog: 541 calc_deko_divemode_sensor_analog:
529 btfss analog_o2_input ; do we have an analog input? 542 btfss analog_o2_input ; do we have an analog input?
530 return ; NO - return 543 bra calc_deko_divemode_sensor_opt ; NO - check if we have an optical interface
531 call get_analog_inputs ; YES - get the analog voltages and continue with the common part 544 call get_analog_inputs ; YES - get the analog voltages and continue with the common part
532 545
533 calc_deko_divemode_sensor_common: 546 calc_deko_divemode_sensor_common:
534 ; Check for each sensor if it is calibrated and if its mv value is within min_mv and max_mv limits. 547 ; Check for each sensor if it is calibrated and if its mv value is within min_mv and max_mv limits.
535 ; If ok: compute o2_ppo2_sensorX := o2_mv_sensorX * opt_x_sX / 1000 548 ; If ok: compute o2_ppo2_sensorX := o2_mv_sensorX * opt_x_sX / 1000
2047 btfss sensor2_calibrated_ok 2060 btfss sensor2_calibrated_ok
2048 bcf use_O2_sensor2 2061 bcf use_O2_sensor2
2049 btfss sensor3_calibrated_ok 2062 btfss sensor3_calibrated_ok
2050 bcf use_O2_sensor3 2063 bcf use_O2_sensor3
2051 2064
2065 btfss optical_input ; do we have an optical input?
2066 bra dive_boot_cc_0 ; No
2067 ; Copy (initial) valid flags from HUD/ppO2 Monitor
2068 btfsc sensor1_active
2069 bsf use_O2_sensor1
2070 btfsc sensor2_active
2071 bsf use_O2_sensor2
2072 btfsc sensor3_active
2073 bsf use_O2_sensor3
2074
2075 dive_boot_cc_0:
2052 ; In pSCR mode, only settings 0 (calculated ppO2) and 1 (ppO2 from sensors) are defined. 2076 ; In pSCR mode, only settings 0 (calculated ppO2) and 1 (ppO2 from sensors) are defined.
2053 ; In case we still have 3 (auto SP) selected out of previous ccr mode, we reset to 0. 2077 ; In case we still have 3 (auto SP) selected out of previous ccr mode, we reset to 0.
2054 btfss FLAG_pscr_mode 2078 btfss FLAG_pscr_mode
2055 bra dive_boot_cc_1 2079 bra dive_boot_cc_1
2056 movff opt_ccr_mode,WREG ; =0: Fixed SP (CCR) / calculated SP (pSCR), =1: Sensor, =2: Auto SP 2080 movff opt_ccr_mode,WREG ; =0: Fixed SP (CCR) / calculated SP (pSCR), =1: Sensor, =2: Auto SP