diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-08-20 09:41:16 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-08-20 09:41:16 +0200 |
commit | 7cff9b1e84e1c620d9af7fd8feae7ee77d8ef6a6 (patch) | |
tree | c511ff2b9c3c8074aec84c2272cd65c1bd1d1b54 /src/modules | |
parent | 95260d453592903bfcd3dba9379db033738d5b89 (diff) | |
parent | deb426b66002da2562531b37e4ac0f8097c8a6eb (diff) | |
download | px4-firmware-7cff9b1e84e1c620d9af7fd8feae7ee77d8ef6a6.tar.gz px4-firmware-7cff9b1e84e1c620d9af7fd8feae7ee77d8ef6a6.tar.bz2 px4-firmware-7cff9b1e84e1c620d9af7fd8feae7ee77d8ef6a6.zip |
Merge branch 'master' of github.com:PX4/Firmware into fmuv2_bringup_new_state_machine_drton
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/commander/accelerometer_calibration.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/modules/commander/accelerometer_calibration.cpp b/src/modules/commander/accelerometer_calibration.cpp index b3a5d012b..b6217a414 100644 --- a/src/modules/commander/accelerometer_calibration.cpp +++ b/src/modules/commander/accelerometer_calibration.cpp @@ -230,6 +230,12 @@ int do_accel_calibration_measurements(int mavlink_fd, float accel_offs[3], float if (orient < 0) return ERROR; + if (data_collected[orient]) { + sprintf(str, "%s direction already measured, please rotate", orientation_strs[orient]); + mavlink_log_info(mavlink_fd, str); + continue; + } + sprintf(str, "meas started: %s", orientation_strs[orient]); mavlink_log_info(mavlink_fd, str); read_accelerometer_avg(sensor_combined_sub, &(accel_ref[orient][0]), samples_num); @@ -391,6 +397,8 @@ int read_accelerometer_avg(int sensor_combined_sub, float accel_avg[3], int samp int count = 0; float accel_sum[3] = { 0.0f, 0.0f, 0.0f }; + int errcount = 0; + while (count < samples_num) { int poll_ret = poll(fds, 1, 1000); if (poll_ret == 1) { @@ -400,8 +408,12 @@ int read_accelerometer_avg(int sensor_combined_sub, float accel_avg[3], int samp accel_sum[i] += sensor.accelerometer_m_s2[i]; count++; } else { - return ERROR; + errcount++; + continue; } + + if (errcount > samples_num / 10) + return ERROR; } for (int i = 0; i < 3; i++) { |