mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
esc_calibration: simplify the logic and consider battery only connected if there's no message timeout and the connected flag is set
This commit is contained in:
parent
eedd770cbd
commit
ea12400ea3
@ -63,19 +63,13 @@ 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);
|
||||
|
||||
if (recent_battery_measurement) {
|
||||
// We have to send this message for now because "battery unavailable" gets ignored by QGC
|
||||
if (recent_battery_measurement && battery_status_sub.get().connected) {
|
||||
calibration_log_critical(mavlink_log_pub, CAL_QGC_FAILED_MSG, "Disconnect battery and try again");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure battery is reported to be disconnected
|
||||
if (!recent_battery_measurement && !battery_status_sub.get().connected) {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
calibration_log_critical(mavlink_log_pub, CAL_QGC_FAILED_MSG, "Disconnect battery and try again");
|
||||
return false;
|
||||
}
|
||||
|
||||
static void set_motor_actuators(uORB::Publication<actuator_test_s> &publisher, float value, bool release_control)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user