diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2012-11-14 15:17:30 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2012-11-14 15:17:30 +0100 |
commit | 722af669fea5dcb6719438326f8272cbb8ca69ee (patch) | |
tree | da15265a4c7384a944e24fcd71d53fdd8963f905 | |
parent | aeea27d16a6e7d92f7caf1c6a272a5f4bfa9a721 (diff) | |
download | px4-firmware-722af669fea5dcb6719438326f8272cbb8ca69ee.tar.gz px4-firmware-722af669fea5dcb6719438326f8272cbb8ca69ee.tar.bz2 px4-firmware-722af669fea5dcb6719438326f8272cbb8ca69ee.zip |
Better integrate calibration check
-rw-r--r-- | apps/drivers/hmc5883/hmc5883.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/apps/drivers/hmc5883/hmc5883.cpp b/apps/drivers/hmc5883/hmc5883.cpp index 81bc8954b..a1587b783 100644 --- a/apps/drivers/hmc5883/hmc5883.cpp +++ b/apps/drivers/hmc5883/hmc5883.cpp @@ -634,8 +634,7 @@ HMC5883::ioctl(struct file *filp, int cmd, unsigned long arg) case MAGIOCSSCALE: /* set new scale factors */ memcpy(&_scale, (mag_scale *)arg, sizeof(_scale)); - (void)check_calibration(); - return 0; + return check_calibration(); case MAGIOCGSCALE: /* copy out scale factors */ @@ -1012,7 +1011,12 @@ int HMC5883::calibrate(struct file *filp, unsigned enable) out: if (ret == OK) { - warnx("mag scale calibration successfully finished."); + if (!check_calibration()) { + warnx("mag scale calibration successfully finished."); + } else { + warnx("mag scale calibration finished with invalid results."); + ret == ERROR; + } } else { warnx("mag scale calibration failed."); |