diff --git a/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp b/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp index 24996c84da..263a56090f 100644 --- a/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp +++ b/src/modules/sensors/vehicle_air_data/VehicleAirData.cpp @@ -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); diff --git a/src/modules/sensors/vehicle_air_data/VehicleAirData.hpp b/src/modules/sensors/vehicle_air_data/VehicleAirData.hpp index ce7a8a117c..a0bdb4007d 100644 --- a/src/modules/sensors/vehicle_air_data/VehicleAirData.hpp +++ b/src/modules/sensors/vehicle_air_data/VehicleAirData.hpp @@ -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) _param_sens_baro_qnh, (ParamFloat) _param_sens_baro_rate