diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-04-26 17:33:45 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-04-26 17:33:45 +0200 |
commit | 362672ece8210fe64537e434d17b3917a3a7e29a (patch) | |
tree | af7f93742e1f0a711aa847fb535eacac8f224bea /src/modules/commander/accelerometer_calibration.cpp | |
parent | a7f88d97b819a73ce5b0e804df21f9c9dc1ebadd (diff) | |
download | px4-firmware-362672ece8210fe64537e434d17b3917a3a7e29a.tar.gz px4-firmware-362672ece8210fe64537e434d17b3917a3a7e29a.tar.bz2 px4-firmware-362672ece8210fe64537e434d17b3917a3a7e29a.zip |
commander: Fix calibration feedback so that QGC picks up all error conditions
Diffstat (limited to 'src/modules/commander/accelerometer_calibration.cpp')
-rw-r--r-- | src/modules/commander/accelerometer_calibration.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/modules/commander/accelerometer_calibration.cpp b/src/modules/commander/accelerometer_calibration.cpp index d0982b341..f83640d28 100644 --- a/src/modules/commander/accelerometer_calibration.cpp +++ b/src/modules/commander/accelerometer_calibration.cpp @@ -222,8 +222,10 @@ int do_accel_calibration(int mavlink_fd) } } - if (res != OK || active_sensors == 0) { - mavlink_and_console_log_critical(mavlink_fd, CAL_ERROR_SENSOR_MSG); + if (res != OK) { + if (active_sensors == 0) { + mavlink_and_console_log_critical(mavlink_fd, CAL_ERROR_SENSOR_MSG); + } return ERROR; } @@ -278,7 +280,7 @@ int do_accel_calibration(int mavlink_fd) fd = open(str, 0); if (fd < 0) { - mavlink_and_console_log_critical(mavlink_fd, "[cal] sensor does not exist"); + mavlink_and_console_log_critical(mavlink_fd, CAL_QGC_FAILED_MSG, "sensor does not exist"); res = ERROR; } else { res = ioctl(fd, ACCELIOCSSCALE, (long unsigned int)&accel_scale); @@ -298,14 +300,17 @@ int do_accel_calibration(int mavlink_fd) mavlink_and_console_log_critical(mavlink_fd, CAL_ERROR_SAVE_PARAMS_MSG); } + /* if there is a any preflight-check system response, let the barrage of messages through */ + usleep(200000); + mavlink_and_console_log_info(mavlink_fd, CAL_QGC_DONE_MSG, sensor_name); } else { mavlink_and_console_log_critical(mavlink_fd, CAL_QGC_FAILED_MSG, sensor_name); } - // This give a chance for the log messages to go out of the queue before someone else stomps on then - sleep(1); + /* give this message enough time to propagate */ + usleep(600000); return res; } |