diff options
author | sjwilks <sjwilks@gmail.com> | 2013-03-18 15:32:37 -0700 |
---|---|---|
committer | sjwilks <sjwilks@gmail.com> | 2013-03-18 15:32:37 -0700 |
commit | 1c9bc8e19d398a4d1fd1995f26ef63d7d3c55360 (patch) | |
tree | 770d37cbc0b9e414e065e4b5b1427af539f85a48 | |
parent | 3ea44e4a2921f0bfb21bc2abfdfeb40869b5cb0c (diff) | |
parent | 9849d22e4fec1d21cc77c54fec658cfaf16f8185 (diff) | |
download | px4-firmware-1c9bc8e19d398a4d1fd1995f26ef63d7d3c55360.tar.gz px4-firmware-1c9bc8e19d398a4d1fd1995f26ef63d7d3c55360.tar.bz2 px4-firmware-1c9bc8e19d398a4d1fd1995f26ef63d7d3c55360.zip |
Merge pull request #231 from PX4/calibration_warning
Added MAVLink-transmitted calibration warning about bad sensor calibrati...
-rw-r--r-- | apps/systemcmds/preflight_check/preflight_check.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/systemcmds/preflight_check/preflight_check.c b/apps/systemcmds/preflight_check/preflight_check.c index f25f812ae..9ac6f0b5e 100644 --- a/apps/systemcmds/preflight_check/preflight_check.c +++ b/apps/systemcmds/preflight_check/preflight_check.c @@ -54,6 +54,8 @@ #include <drivers/drv_accel.h> #include <drivers/drv_baro.h> +#include <mavlink/mavlink_log.h> + __EXPORT int preflight_check_main(int argc, char *argv[]); static int led_toggle(int leds, int led); static int led_on(int leds, int led); @@ -75,6 +77,8 @@ int preflight_check_main(int argc, char *argv[]) bool system_ok = true; int fd; + /* open text message output path */ + int mavlink_fd = open(MAVLINK_LOG_DEVICE, 0); int ret; /* give the system some time to sample the sensors in the background */ @@ -86,6 +90,7 @@ int preflight_check_main(int argc, char *argv[]) fd = open(MAG_DEVICE_PATH, 0); if (fd < 0) { warn("failed to open magnetometer - start with 'hmc5883 start' or 'lsm303d start'"); + mavlink_log_critical(mavlink_fd, "SENSOR FAIL: NO MAG"); system_ok = false; goto system_eval; } @@ -93,6 +98,7 @@ int preflight_check_main(int argc, char *argv[]) if (ret != OK) { warnx("magnetometer calibration missing or bad - calibrate magnetometer first"); + mavlink_log_critical(mavlink_fd, "SENSOR FAIL: MAG CALIBRATION"); system_ok = false; goto system_eval; } @@ -105,6 +111,7 @@ int preflight_check_main(int argc, char *argv[]) if (ret != OK) { warnx("accel self test failed"); + mavlink_log_critical(mavlink_fd, "SENSOR FAIL: ACCEL CHECK"); system_ok = false; goto system_eval; } @@ -117,6 +124,7 @@ int preflight_check_main(int argc, char *argv[]) if (ret != OK) { warnx("gyro self test failed"); + mavlink_log_critical(mavlink_fd, "SENSOR FAIL: GYRO CHECK"); system_ok = false; goto system_eval; } |