sensors/vehicle_air_data: only trigger the sensor fallback when the baro_fault flag switches from 0 -> 1

This commit is contained in:
Marco Hauswirth 2025-02-07 05:47:32 +01:00 committed by GitHub
parent fd175d619c
commit de1ade8eb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -200,7 +200,7 @@ void VehicleAirData::Run()
}
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
}
@ -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
int best_index = 0;
_voter.get_best(time_now_us, &best_index);

View File

@ -126,6 +126,8 @@ private:
float _air_temperature_celsius{20.f}; // initialize with typical 20degC ambient temperature
bool _last_status_baro_fault{false};
DEFINE_PARAMETERS(
(ParamFloat<px4::params::SENS_BARO_QNH>) _param_sens_baro_qnh,
(ParamFloat<px4::params::SENS_BARO_RATE>) _param_sens_baro_rate