From 042d9b66158a09d31ffd5c5f477451ffe5345a9d Mon Sep 17 00:00:00 2001 From: kamilritz Date: Wed, 11 Dec 2019 16:05:51 +0100 Subject: [PATCH] Remove dangerous _primary_hgt_source variable --- EKF/ekf.cpp | 5 ----- EKF/ekf.h | 1 - EKF/gps_checks.cpp | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/EKF/ekf.cpp b/EKF/ekf.cpp index 7660c39b63..7f322c4ff5 100644 --- a/EKF/ekf.cpp +++ b/EKF/ekf.cpp @@ -177,11 +177,6 @@ bool Ekf::initialiseFilter() } } - // set the default height source from the adjustable parameter - if (_hgt_counter == 0) { - _primary_hgt_source = _params.vdist_sensor_type; - } - // accumulate enough height measurements to be confident in the quality of the data // we use baro height initially and switch to GPS/range/EV finder later when it passes checks. if (_baro_buffer.pop_first_older_than(_imu_sample_delayed.time_us, &_baro_sample_delayed)) { diff --git a/EKF/ekf.h b/EKF/ekf.h index 11563d0fd8..92f17d0e40 100644 --- a/EKF/ekf.h +++ b/EKF/ekf.h @@ -505,7 +505,6 @@ private: bool _baro_hgt_faulty{false}; ///< true if valid baro data is unavailable for use bool _gps_hgt_intermittent{false}; ///< true if gps height into the buffer is intermittent bool _rng_hgt_valid{false}; ///< true if range finder sample retrieved from buffer is valid - int _primary_hgt_source{VDIST_SENSOR_BARO}; ///< specifies primary source of height data uint64_t _time_bad_rng_signal_quality{0}; ///< timestamp at which range finder signal quality was 0 (used for hysteresis) // imu fault status diff --git a/EKF/gps_checks.cpp b/EKF/gps_checks.cpp index 0d74106c38..8085a13377 100644 --- a/EKF/gps_checks.cpp +++ b/EKF/gps_checks.cpp @@ -90,7 +90,7 @@ bool Ekf::collect_gps(const gps_message &gps) _gps_origin_epv = gps.epv; // if the user has selected GPS as the primary height source, switch across to using it - if (_primary_hgt_source == VDIST_SENSOR_GPS) { + if (_params.vdist_sensor_type == VDIST_SENSOR_GPS) { ECL_INFO_TIMESTAMPED("EKF GPS checks passed (WGS-84 origin set, using GPS height)"); _control_status.flags.baro_hgt = false; _control_status.flags.gps_hgt = true;