mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-21 23:57:35 +08:00
Fix for dynamic / static part of calibration
This commit is contained in:
@@ -121,19 +121,6 @@ int do_airspeed_calibration(int mavlink_fd)
|
||||
if (poll_ret) {
|
||||
orb_copy(ORB_ID(differential_pressure), diff_pres_sub, &diff_pres);
|
||||
|
||||
if (calc_indicated_airspeed(fabsf(diff_pres.differential_pressure_raw_pa)) < 10.0f) {
|
||||
mavlink_log_critical(mavlink_fd, "Put a finger on front hole of pitot");
|
||||
usleep(5000 * 1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* do not log negative values in the second go */
|
||||
if ((diff_pres_offset / calibration_counter) < calc_indicated_airspeed(-5.0f)) {
|
||||
mavlink_log_critical(mavlink_fd, "Negative val: swap static<->dynamic ports,restart");
|
||||
close(diff_pres_sub);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
diff_pres_offset += diff_pres.differential_pressure_raw_pa;
|
||||
calibration_counter++;
|
||||
|
||||
@@ -197,16 +184,16 @@ int do_airspeed_calibration(int mavlink_fd)
|
||||
diff_pres_offset += diff_pres.differential_pressure_raw_pa;
|
||||
calibration_counter++;
|
||||
|
||||
float curr_avg = (diff_pres_offset / calibration_counter);
|
||||
float curr_avg_airspeed = calc_indicated_airspeed(diff_pres_offset / calibration_counter);
|
||||
|
||||
if (calc_indicated_airspeed(fabsf(curr_avg)) < 10.0f) {
|
||||
if (fabsf(curr_avg) < 10.0f) {
|
||||
mavlink_log_critical(mavlink_fd, "Put a finger on front hole of pitot (%.1f m/s)", (double)curr_avg);
|
||||
usleep(5000 * 1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* do not log negative values in the second go */
|
||||
if (curr_avg < -calc_indicated_airspeed(5.0f)) {
|
||||
if (curr_avg_airspeed < -calc_indicated_airspeed(5.0f)) {
|
||||
mavlink_log_critical(mavlink_fd, "Negative val: swap static<->dynamic ports,restart");
|
||||
close(diff_pres_sub);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user