aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/accelerometer_calibration.c
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-07-19 12:53:37 +0200
committerLorenz Meier <lm@inf.ethz.ch>2013-07-19 12:53:37 +0200
commit1575da4390ade717e1fa43a3f18f2348bd494205 (patch)
tree049aefb4c1cee5b1f9c401c3debeac0b4e1b3209 /src/modules/commander/accelerometer_calibration.c
parentbcdedd9a35a5b9ebf3851a0d472adab8d3e7edac (diff)
parenta8ac56b9e5eb8c1501ea592b4417aa8becd7236c (diff)
downloadpx4-firmware-1575da4390ade717e1fa43a3f18f2348bd494205.tar.gz
px4-firmware-1575da4390ade717e1fa43a3f18f2348bd494205.tar.bz2
px4-firmware-1575da4390ade717e1fa43a3f18f2348bd494205.zip
Merge branch 'master' of github.com:PX4/Firmware into new_state_machine
Diffstat (limited to 'src/modules/commander/accelerometer_calibration.c')
-rw-r--r--src/modules/commander/accelerometer_calibration.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/modules/commander/accelerometer_calibration.c b/src/modules/commander/accelerometer_calibration.c
index 50234a45e..bc9d24956 100644
--- a/src/modules/commander/accelerometer_calibration.c
+++ b/src/modules/commander/accelerometer_calibration.c
@@ -283,6 +283,9 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) {
hrt_abstime t = t_start;
hrt_abstime t_prev = t_start;
hrt_abstime t_still = 0;
+
+ unsigned poll_errcount = 0;
+
while (true) {
/* wait blocking for new data */
int poll_ret = poll(fds, 1, 1000);
@@ -327,12 +330,14 @@ int detect_orientation(int mavlink_fd, int sub_sensor_combined) {
}
}
} else if (poll_ret == 0) {
- /* any poll failure for 1s is a reason to abort */
- mavlink_log_info(mavlink_fd, "ERROR: poll failure");
- return -3;
+ poll_errcount++;
}
if (t > t_timeout) {
- mavlink_log_info(mavlink_fd, "ERROR: timeout");
+ poll_errcount++;
+ }
+
+ if (poll_errcount > 1000) {
+ mavlink_log_info(mavlink_fd, "ERROR: failed reading accel");
return -1;
}
}