mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-09 13:21:37 +08:00
accel & gyro calibration helpers
This commit is contained in:
@@ -65,6 +65,8 @@ static void feedback_calibration_failed(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
int do_airspeed_calibration(orb_advert_t *mavlink_log_pub)
|
||||
{
|
||||
const hrt_abstime calibration_started = hrt_absolute_time();
|
||||
|
||||
int result = PX4_OK;
|
||||
unsigned calibration_counter = 0;
|
||||
const unsigned maxcount = 2400;
|
||||
@@ -99,8 +101,6 @@ int do_airspeed_calibration(orb_advert_t *mavlink_log_pub)
|
||||
px4_close(fd);
|
||||
}
|
||||
|
||||
int cancel_sub = calibrate_cancel_subscribe();
|
||||
|
||||
if (!paramreset_successful) {
|
||||
|
||||
/* only warn if analog scaling is zero */
|
||||
@@ -124,7 +124,7 @@ int do_airspeed_calibration(orb_advert_t *mavlink_log_pub)
|
||||
|
||||
while (calibration_counter < calibration_count) {
|
||||
|
||||
if (calibrate_cancel_check(mavlink_log_pub, cancel_sub)) {
|
||||
if (calibrate_cancel_check(mavlink_log_pub, calibration_started)) {
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ int do_airspeed_calibration(orb_advert_t *mavlink_log_pub)
|
||||
/* just take a few samples and make sure pitot tubes are not reversed, timeout after ~30 seconds */
|
||||
while (calibration_counter < maxcount) {
|
||||
|
||||
if (calibrate_cancel_check(mavlink_log_pub, cancel_sub)) {
|
||||
if (calibrate_cancel_check(mavlink_log_pub, calibration_started)) {
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
@@ -279,7 +279,6 @@ int do_airspeed_calibration(orb_advert_t *mavlink_log_pub)
|
||||
px4_usleep(2e6);
|
||||
|
||||
normal_return:
|
||||
calibrate_cancel_unsubscribe(cancel_sub);
|
||||
px4_close(diff_pres_sub);
|
||||
|
||||
// This give a chance for the log messages to go out of the queue before someone else stomps on then
|
||||
|
||||
Reference in New Issue
Block a user