mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
commander: Fix error checking and handling of level routine
This commit is contained in:
parent
afa8266255
commit
323759bb52
@ -557,7 +557,7 @@ calibrate_return calculate_calibration_values(unsigned sensor, float (&accel_ref
|
||||
|
||||
int do_level_calibration(int mavlink_fd) {
|
||||
const unsigned cal_time = 5;
|
||||
const unsigned cal_hz = 250;
|
||||
const unsigned cal_hz = 100;
|
||||
const unsigned settle_time = 30;
|
||||
int att_sub = orb_subscribe(ORB_ID(vehicle_attitude));
|
||||
struct vehicle_attitude_s att;
|
||||
@ -612,6 +612,8 @@ int do_level_calibration(int mavlink_fd) {
|
||||
pitch_mean /= counter;
|
||||
} else {
|
||||
mavlink_and_console_log_info(mavlink_fd, "not enough measurements taken");
|
||||
success = false;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (fabsf(roll_mean) > 0.8f ) {
|
||||
@ -626,6 +628,7 @@ int do_level_calibration(int mavlink_fd) {
|
||||
success = true;
|
||||
}
|
||||
|
||||
out:
|
||||
if (success) {
|
||||
mavlink_and_console_log_info(mavlink_fd, CAL_QGC_DONE_MSG, "level");
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user