mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 02:16:53 +08:00
Fix reporting of connected battery
This commit is contained in:
@@ -63,14 +63,14 @@ bool check_battery_disconnected(orb_advert_t *mavlink_log_pub)
|
|||||||
|
|
||||||
const bool recent_battery_measurement = hrt_absolute_time() < (battery_status_sub.get().timestamp + 1_s);
|
const bool recent_battery_measurement = hrt_absolute_time() < (battery_status_sub.get().timestamp + 1_s);
|
||||||
|
|
||||||
if (!recent_battery_measurement) {
|
if (recent_battery_measurement) {
|
||||||
// We have to send this message for now because "battery unavailable" gets ignored by QGC
|
// We have to send this message for now because "battery unavailable" gets ignored by QGC
|
||||||
calibration_log_critical(mavlink_log_pub, CAL_QGC_FAILED_MSG, "Disconnect battery and try again");
|
calibration_log_critical(mavlink_log_pub, CAL_QGC_FAILED_MSG, "Disconnect battery and try again");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure battery is reported to be disconnected
|
// Make sure battery is reported to be disconnected
|
||||||
if (recent_battery_measurement && !battery_status_sub.get().connected) {
|
if (!recent_battery_measurement && !battery_status_sub.get().connected) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user