sensors ignore invalid failover index

- fixes CID 199478
This commit is contained in:
Daniel Agar
2017-10-31 08:10:04 +01:00
committed by Lorenz Meier
parent dd9179efc9
commit 21995bd4b7
+12 -10
View File
@@ -922,17 +922,19 @@ bool VotedSensorsUpdate::check_failover(SensorData &sensor, const char *sensor_n
} else {
int failover_index = sensor.voter.failover_index();
mavlink_log_emergency(&_mavlink_log_pub, "%s #%i fail: %s%s%s%s%s!",
sensor_name,
failover_index,
((flags & DataValidator::ERROR_FLAG_NO_DATA) ? " OFF" : ""),
((flags & DataValidator::ERROR_FLAG_STALE_DATA) ? " STALE" : ""),
((flags & DataValidator::ERROR_FLAG_TIMEOUT) ? " TOUT" : ""),
((flags & DataValidator::ERROR_FLAG_HIGH_ERRCOUNT) ? " ECNT" : ""),
((flags & DataValidator::ERROR_FLAG_HIGH_ERRDENSITY) ? " EDNST" : ""));
if (failover_index != -1) {
mavlink_log_emergency(&_mavlink_log_pub, "%s #%i fail: %s%s%s%s%s!",
sensor_name,
failover_index,
((flags & DataValidator::ERROR_FLAG_NO_DATA) ? " OFF" : ""),
((flags & DataValidator::ERROR_FLAG_STALE_DATA) ? " STALE" : ""),
((flags & DataValidator::ERROR_FLAG_TIMEOUT) ? " TOUT" : ""),
((flags & DataValidator::ERROR_FLAG_HIGH_ERRCOUNT) ? " ECNT" : ""),
((flags & DataValidator::ERROR_FLAG_HIGH_ERRDENSITY) ? " EDNST" : ""));
// reduce priority of failed sensor to the minimum
sensor.priority[failover_index] = 1;
// reduce priority of failed sensor to the minimum
sensor.priority[failover_index] = 1;
}
}
sensor.last_failover_count = sensor.voter.failover_count();