diff options
author | Julian Oes <julian@oes.ch> | 2013-08-22 15:57:17 +0200 |
---|---|---|
committer | Julian Oes <julian@oes.ch> | 2013-08-22 15:57:17 +0200 |
commit | 5f1004117f8086c4bba5b4031f3aebd73411682c (patch) | |
tree | db7650538973c72b35835247095743596af5645e /src/modules/commander/mag_calibration.cpp | |
parent | 6c3da5aeddf929f5a4f19f6bd1b75c911c2a414c (diff) | |
download | px4-firmware-5f1004117f8086c4bba5b4031f3aebd73411682c.tar.gz px4-firmware-5f1004117f8086c4bba5b4031f3aebd73411682c.tar.bz2 px4-firmware-5f1004117f8086c4bba5b4031f3aebd73411682c.zip |
Restore proper feedback (mavlink and tone) for calibration commands, etc
Diffstat (limited to 'src/modules/commander/mag_calibration.cpp')
-rw-r--r-- | src/modules/commander/mag_calibration.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/modules/commander/mag_calibration.cpp b/src/modules/commander/mag_calibration.cpp index 9a25103f8..9263c6a15 100644 --- a/src/modules/commander/mag_calibration.cpp +++ b/src/modules/commander/mag_calibration.cpp @@ -53,8 +53,13 @@ #include <systemlib/param/param.h> #include <systemlib/err.h> +/* oddly, ERROR is not defined for c++ */ +#ifdef ERROR +# undef ERROR +#endif +static const int ERROR = -1; -void do_mag_calibration(int mavlink_fd) +int do_mag_calibration(int mavlink_fd) { mavlink_log_info(mavlink_fd, "mag calibration starting, hold still"); @@ -113,7 +118,7 @@ void do_mag_calibration(int mavlink_fd) warnx("mag cal failed: out of memory"); mavlink_log_info(mavlink_fd, "mag cal failed: out of memory"); warnx("x:%p y:%p z:%p\n", x, y, z); - return; + return ERROR; } while (hrt_absolute_time() < calibration_deadline && @@ -252,6 +257,7 @@ void do_mag_calibration(int mavlink_fd) if (save_ret != 0) { warn("WARNING: auto-save of params to storage failed"); mavlink_log_info(mavlink_fd, "FAILED storing calibration"); + return ERROR; } warnx("\tscale: %.6f %.6f %.6f\n \toffset: %.6f %.6f %.6f\nradius: %.6f GA\n", @@ -269,12 +275,11 @@ void do_mag_calibration(int mavlink_fd) mavlink_log_info(mavlink_fd, "mag calibration done"); - tune_positive(); + return OK; /* third beep by cal end routine */ } else { mavlink_log_info(mavlink_fd, "mag calibration FAILED (NaN in sphere fit)"); + return ERROR; } - - close(sub_mag); -}
\ No newline at end of file +} |