mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 12:48:54 +08:00
Fix calibration counter usage, take every sample
This commit is contained in:
@@ -167,8 +167,8 @@ int do_airspeed_calibration(int mavlink_fd)
|
||||
|
||||
calibration_counter = 0;
|
||||
|
||||
/* just take a few samples and make sure pitot tubes are not reversed */
|
||||
while (calibration_counter < 300) {
|
||||
/* just take a few samples and make sure pitot tubes are not reversed, timeout after ~30 seconds */
|
||||
while (calibration_counter < 1500) {
|
||||
|
||||
/* wait blocking for new data */
|
||||
struct pollfd fds[1];
|
||||
@@ -181,14 +181,13 @@ int do_airspeed_calibration(int mavlink_fd)
|
||||
orb_copy(ORB_ID(differential_pressure), diff_pres_sub, &diff_pres);
|
||||
|
||||
float calibrated_pa = diff_pres.differential_pressure_raw_pa - diff_pres_offset;
|
||||
calibration_counter++;
|
||||
|
||||
if (fabsf(calibrated_pa) < 50.0f) {
|
||||
if (calibration_counter % 20 == 0) {
|
||||
if (calibration_counter % 100 == 0) {
|
||||
mavlink_log_critical(mavlink_fd, "Create airflow on pitot (%d Pa, #h101)",
|
||||
(int)calibrated_pa);
|
||||
}
|
||||
usleep(100 * 1000);
|
||||
calibration_counter++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user