|
|
@ -332,11 +332,23 @@ bool AP_Arming::ins_checks(bool report) |
|
|
|
|
|
|
|
|
|
|
|
bool AP_Arming::compass_checks(bool report) |
|
|
|
bool AP_Arming::compass_checks(bool report) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Compass &_compass = AP::compass(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if compass is calibrating
|
|
|
|
|
|
|
|
if (_compass.is_calibrating()) { |
|
|
|
|
|
|
|
check_failed(ARMING_CHECK_COMPASS, report, "Compass calibration running"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if compass has calibrated and requires reboot
|
|
|
|
|
|
|
|
if (_compass.compass_cal_requires_reboot()) { |
|
|
|
|
|
|
|
check_failed(ARMING_CHECK_COMPASS, report, "Compass calibrated requires reboot"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((checks_to_perform) & ARMING_CHECK_ALL || |
|
|
|
if ((checks_to_perform) & ARMING_CHECK_ALL || |
|
|
|
(checks_to_perform) & ARMING_CHECK_COMPASS) { |
|
|
|
(checks_to_perform) & ARMING_CHECK_COMPASS) { |
|
|
|
|
|
|
|
|
|
|
|
Compass &_compass = AP::compass(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// avoid Compass::use_for_yaw(void) as it implicitly calls healthy() which can
|
|
|
|
// avoid Compass::use_for_yaw(void) as it implicitly calls healthy() which can
|
|
|
|
// incorrectly skip the remaining checks, pass the primary instance directly
|
|
|
|
// incorrectly skip the remaining checks, pass the primary instance directly
|
|
|
|
if (!_compass.use_for_yaw(_compass.get_primary())) { |
|
|
|
if (!_compass.use_for_yaw(_compass.get_primary())) { |
|
|
@ -354,18 +366,6 @@ bool AP_Arming::compass_checks(bool report) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//check if compass is calibrating
|
|
|
|
|
|
|
|
if (_compass.is_calibrating()) { |
|
|
|
|
|
|
|
check_failed(ARMING_CHECK_COMPASS, report, "Compass calibration running"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//check if compass has calibrated and requires reboot
|
|
|
|
|
|
|
|
if (_compass.compass_cal_requires_reboot()) { |
|
|
|
|
|
|
|
check_failed(ARMING_CHECK_COMPASS, report, "Compass calibrated requires reboot"); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check for unreasonable compass offsets
|
|
|
|
// check for unreasonable compass offsets
|
|
|
|
const Vector3f offsets = _compass.get_offsets(); |
|
|
|
const Vector3f offsets = _compass.get_offsets(); |
|
|
|
if (offsets.length() > _compass.get_offsets_max()) { |
|
|
|
if (offsets.length() > _compass.get_offsets_max()) { |
|
|
|