mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +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:
@@ -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);
|
const bool recent_battery_measurement = hrt_absolute_time() < (battery_status_sub.get().timestamp + 1_s);
|
||||||
|
|
||||||
if (recent_battery_measurement) {
|
if (recent_battery_measurement && battery_status_sub.get().connected) {
|
||||||
// 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
|
} else {
|
||||||
if (!recent_battery_measurement && !battery_status_sub.get().connected) {
|
|
||||||
return true;
|
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)
|
static void set_motor_actuators(uORB::Publication<actuator_test_s> &publisher, float value, bool release_control)
|
||||||
|
|||||||
Reference in New Issue
Block a user