AP_NavEKF: add and use AP_BEACON_ENABLED

This commit is contained in:
Peter Barker 2022-01-28 11:09:44 +11:00 committed by Peter Barker
parent 5cb6906968
commit 88e164aed3

View File

@ -443,10 +443,17 @@ bool AP_NavEKF_Source::pre_arm_check(bool requires_position, char *failure_msg,
return false;
}
if (beacon_required && (dal.beacon() == nullptr || !dal.beacon()->enabled())) {
if (beacon_required) {
#if AP_BEACON_ENABLED
const bool beacon_available = (dal.beacon() != nullptr && dal.beacon()->enabled());
#else
const bool beacon_available = false;
#endif
if (!beacon_available) {
hal.util->snprintf(failure_msg, failure_msg_len, ekf_requires_msg, "Beacon");
return false;
}
}
if (compass_required && (dal.compass().get_num_enabled() == 0)) {
hal.util->snprintf(failure_msg, failure_msg_len, ekf_requires_msg, "Compass");