remove superfluous elseif (#431)

* remove superfluous elseif

* Set ev_hgt flag false when starting on baro
This commit is contained in:
Bart Slinger
2018-05-11 00:38:42 +02:00
committed by Paul Riseborough
parent 16976d3911
commit bae4b8a5e7
+3 -16
View File
@@ -189,18 +189,12 @@ bool Ekf::initialiseFilter()
_primary_hgt_source = _params.vdist_sensor_type; _primary_hgt_source = _params.vdist_sensor_type;
} }
// accumulate enough height measurements to be confident in the qulaity of the data // accumulate enough height measurements to be confident in the quality of the data
if (_primary_hgt_source == VDIST_SENSOR_BARO || _primary_hgt_source == VDIST_SENSOR_GPS || // we use baro height initially and switch to GPS/range/EV finder later when it passes checks.
_primary_hgt_source == VDIST_SENSOR_RANGE || _primary_hgt_source == VDIST_SENSOR_EV) {
// if the user parameter specifies use of GPS/range/EV finder for height 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)) { if (_baro_buffer.pop_first_older_than(_imu_sample_delayed.time_us, &_baro_sample_delayed)) {
if ((_hgt_counter == 0) && (_baro_sample_delayed.time_us != 0)) { if ((_hgt_counter == 0) && (_baro_sample_delayed.time_us != 0)) {
// initialise the counter and height fusion method when we start getting data from the buffer // initialise the counter and height fusion method when we start getting data from the buffer
_control_status.flags.baro_hgt = true; setControlBaroHeight();
_control_status.flags.gps_hgt = false;
_control_status.flags.rng_hgt = false;
_hgt_counter = 1; _hgt_counter = 1;
} else if ((_hgt_counter != 0) && (_baro_sample_delayed.time_us != 0)) { } else if ((_hgt_counter != 0) && (_baro_sample_delayed.time_us != 0)) {
@@ -219,13 +213,6 @@ bool Ekf::initialiseFilter()
} }
} }
} else if (_primary_hgt_source == VDIST_SENSOR_EV) {
_hgt_counter = _ev_counter;
} else {
return false;
}
// check to see if we have enough measurements and return false if not // check to see if we have enough measurements and return false if not
bool hgt_count_fail = _hgt_counter <= 2u * _obs_buffer_length; bool hgt_count_fail = _hgt_counter <= 2u * _obs_buffer_length;
bool mag_count_fail = _mag_counter <= 2u * _obs_buffer_length; bool mag_count_fail = _mag_counter <= 2u * _obs_buffer_length;