mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 07:11:35 +08:00
sensors/vehicle_air_data: only trigger the sensor fallback when the baro_fault flag switches from 0 -> 1
This commit is contained in:
@@ -200,7 +200,7 @@ void VehicleAirData::Run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (estimator_status_flags_updated && _selected_sensor_sub_index >= 0 && _selected_sensor_sub_index == uorb_index
|
if (estimator_status_flags_updated && _selected_sensor_sub_index >= 0 && _selected_sensor_sub_index == uorb_index
|
||||||
&& estimator_status_flags.cs_baro_fault) {
|
&& estimator_status_flags.cs_baro_fault && !_last_status_baro_fault) {
|
||||||
_priority[uorb_index] = 1; // 1 is min priority while still being enabled
|
_priority[uorb_index] = 1; // 1 is min priority while still being enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,6 +225,10 @@ void VehicleAirData::Run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (estimator_status_flags_updated) {
|
||||||
|
_last_status_baro_fault = estimator_status_flags.cs_baro_fault;
|
||||||
|
}
|
||||||
|
|
||||||
// check for the current best sensor
|
// check for the current best sensor
|
||||||
int best_index = 0;
|
int best_index = 0;
|
||||||
_voter.get_best(time_now_us, &best_index);
|
_voter.get_best(time_now_us, &best_index);
|
||||||
|
|||||||
@@ -126,6 +126,8 @@ private:
|
|||||||
|
|
||||||
float _air_temperature_celsius{20.f}; // initialize with typical 20degC ambient temperature
|
float _air_temperature_celsius{20.f}; // initialize with typical 20degC ambient temperature
|
||||||
|
|
||||||
|
bool _last_status_baro_fault{false};
|
||||||
|
|
||||||
DEFINE_PARAMETERS(
|
DEFINE_PARAMETERS(
|
||||||
(ParamFloat<px4::params::SENS_BARO_QNH>) _param_sens_baro_qnh,
|
(ParamFloat<px4::params::SENS_BARO_QNH>) _param_sens_baro_qnh,
|
||||||
(ParamFloat<px4::params::SENS_BARO_RATE>) _param_sens_baro_rate
|
(ParamFloat<px4::params::SENS_BARO_RATE>) _param_sens_baro_rate
|
||||||
|
|||||||
Reference in New Issue
Block a user