mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 01:53:35 +08:00
mavlink log: ensure all critical & emergency msgs are also logged to console & ulog
Critical messages that the user sees should also go to the log file, so that the exact error (with time) can later be analyzed from the log file.
This commit is contained in:
@@ -2185,14 +2185,14 @@ Sensors::check_failover(SensorData &sensor, const char *sensor_name)
|
||||
PX4_INFO("%s sensor switch from #%i", sensor_name, sensor.voter.failover_index());
|
||||
|
||||
} else {
|
||||
mavlink_and_console_log_emergency(&_mavlink_log_pub, "%s #%i failover :%s%s%s%s%s!",
|
||||
sensor_name,
|
||||
sensor.voter.failover_index(),
|
||||
((flags & DataValidator::ERROR_FLAG_NO_DATA) ? " No data" : ""),
|
||||
((flags & DataValidator::ERROR_FLAG_STALE_DATA) ? " Stale data" : ""),
|
||||
((flags & DataValidator::ERROR_FLAG_TIMEOUT) ? " Data timeout" : ""),
|
||||
((flags & DataValidator::ERROR_FLAG_HIGH_ERRCOUNT) ? " High error count" : ""),
|
||||
((flags & DataValidator::ERROR_FLAG_HIGH_ERRDENSITY) ? " High error density" : ""));
|
||||
mavlink_log_emergency(&_mavlink_log_pub, "%s #%i failover :%s%s%s%s%s!",
|
||||
sensor_name,
|
||||
sensor.voter.failover_index(),
|
||||
((flags & DataValidator::ERROR_FLAG_NO_DATA) ? " No data" : ""),
|
||||
((flags & DataValidator::ERROR_FLAG_STALE_DATA) ? " Stale data" : ""),
|
||||
((flags & DataValidator::ERROR_FLAG_TIMEOUT) ? " Data timeout" : ""),
|
||||
((flags & DataValidator::ERROR_FLAG_HIGH_ERRCOUNT) ? " High error count" : ""),
|
||||
((flags & DataValidator::ERROR_FLAG_HIGH_ERRDENSITY) ? " High error density" : ""));
|
||||
}
|
||||
|
||||
sensor.last_failover_count = sensor.voter.failover_count();
|
||||
@@ -2217,10 +2217,10 @@ Sensors::check_vibration()
|
||||
|
||||
} else if (hrt_elapsed_time(&_vibration_warning_timestamp) > 10000 * 1000) {
|
||||
_vibration_warning = true;
|
||||
mavlink_and_console_log_critical(&_mavlink_log_pub, "HIGH VIBRATION! g: %d a: %d m: %d",
|
||||
(int)(100 * _gyro.voter.get_vibration_factor(cur_time)),
|
||||
(int)(100 * _accel.voter.get_vibration_factor(cur_time)),
|
||||
(int)(100 * _mag.voter.get_vibration_factor(cur_time)));
|
||||
mavlink_log_critical(&_mavlink_log_pub, "HIGH VIBRATION! g: %d a: %d m: %d",
|
||||
(int)(100 * _gyro.voter.get_vibration_factor(cur_time)),
|
||||
(int)(100 * _accel.voter.get_vibration_factor(cur_time)),
|
||||
(int)(100 * _mag.voter.get_vibration_factor(cur_time)));
|
||||
ret = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user