diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-13 12:44:57 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-13 12:44:57 +0200 |
commit | 8590d555b432f206e2b88893ea5198c1398aa99c (patch) | |
tree | 1069f3f2c0a56e424276563f7d925b764bae6005 | |
parent | 744eed91dca8a5f2ad8ead7ffa812d25755bcc93 (diff) | |
download | px4-firmware-8590d555b432f206e2b88893ea5198c1398aa99c.tar.gz px4-firmware-8590d555b432f206e2b88893ea5198c1398aa99c.tar.bz2 px4-firmware-8590d555b432f206e2b88893ea5198c1398aa99c.zip |
Fix calibration counter usage, take every sample
-rw-r--r-- | src/modules/commander/airspeed_calibration.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/modules/commander/airspeed_calibration.cpp b/src/modules/commander/airspeed_calibration.cpp index a2f11b14a..10d04aae9 100644 --- a/src/modules/commander/airspeed_calibration.cpp +++ b/src/modules/commander/airspeed_calibration.cpp @@ -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; } |