Airspeed selector: fix condition for messaging (#19173)

Change warning message after airspeed failure on the ground, 
recommend RTL only if flying.
This commit is contained in:
Yannick Fuhrer 2022-02-15 17:23:36 +01:00 committed by GitHub
parent 6de5d24e00
commit 26ea70e729
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -593,9 +593,13 @@ void AirspeedModule::select_airspeed_and_publish()
// print warning or info, depending of whether airspeed got declared invalid or healthy
if (_valid_airspeed_index != _prev_airspeed_index &&
(_number_of_airspeed_sensors > 0 || !_vehicle_land_detected.landed) &&
_valid_airspeed_index != _prev_airspeed_index) {
if (_prev_airspeed_index > 0) {
_number_of_airspeed_sensors > 0) {
if (_vehicle_status.arming_state == !vehicle_status_s::ARMING_STATE_ARMED && _prev_airspeed_index > 0) {
mavlink_log_critical(&_mavlink_log_pub, "Airspeed sensor failure detected. Check connection and reboot.\t");
events::send(events::ID("airspeed_selector_sensor_failure_disarmed"), events::Log::Critical,
"Airspeed sensor failure detected. Check connection and reboot");
} else if (_prev_airspeed_index > 0) {
mavlink_log_critical(&_mavlink_log_pub, "Airspeed sensor failure detected. Return to launch (RTL) is advised.\t");
events::send(events::ID("airspeed_selector_sensor_failure"), events::Log::Critical,
"Airspeed sensor failure detected. Return to launch (RTL) is advised");