mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-27 10:17:45 +08:00
Better integrate calibration check
This commit is contained in:
@@ -634,8 +634,7 @@ HMC5883::ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
case MAGIOCSSCALE:
|
case MAGIOCSSCALE:
|
||||||
/* set new scale factors */
|
/* set new scale factors */
|
||||||
memcpy(&_scale, (mag_scale *)arg, sizeof(_scale));
|
memcpy(&_scale, (mag_scale *)arg, sizeof(_scale));
|
||||||
(void)check_calibration();
|
return check_calibration();
|
||||||
return 0;
|
|
||||||
|
|
||||||
case MAGIOCGSCALE:
|
case MAGIOCGSCALE:
|
||||||
/* copy out scale factors */
|
/* copy out scale factors */
|
||||||
@@ -1012,7 +1011,12 @@ int HMC5883::calibrate(struct file *filp, unsigned enable)
|
|||||||
out:
|
out:
|
||||||
|
|
||||||
if (ret == OK) {
|
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 {
|
} else {
|
||||||
warnx("mag scale calibration failed.");
|
warnx("mag scale calibration failed.");
|
||||||
|
|||||||
Reference in New Issue
Block a user