voted_sensors_update: don't report failover if previous index is invalid

This commit is contained in:
Beat Küng
2017-01-27 16:25:15 +01:00
committed by Lorenz Meier
parent f9b75e68c9
commit e31958cad1
+6 -2
View File
@@ -872,8 +872,12 @@ bool VotedSensorsUpdate::check_failover(SensorData &sensor, const char *sensor_n
uint32_t flags = sensor.voter.failover_state();
if (flags == DataValidator::ERROR_FLAG_NO_ERROR) {
//we switched due to a non-critical reason. No need to panic.
PX4_INFO("%s sensor switch from #%i", sensor_name, sensor.voter.failover_index());
int failover_index = sensor.voter.failover_index();
if (failover_index != -1) {
//we switched due to a non-critical reason. No need to panic.
PX4_INFO("%s sensor switch from #%i", sensor_name, failover_index);
}
} else {
mavlink_log_emergency(&_mavlink_log_pub, "%s #%i fail: %s%s%s%s%s!",