AP_Arming: added OpenDroneID support

This commit is contained in:
Andrew Tridgell 2022-08-28 18:13:16 +10:00
parent 86e7c09cf0
commit ae65dd6988
2 changed files with 24 additions and 1 deletions

View File

@ -199,6 +199,21 @@ void AP_Arming::check_failed(bool report, const char *fmt, ...) const
va_end(arg_list);
}
// OpenDroneID Checks
bool AP_Arming::opendroneid_checks(bool display_failure)
{
#if AP_OPENDRONEID_ENABLED
auto &opendroneid = AP::opendroneid();
char failure_msg[50] {};
if (!opendroneid.pre_arm_check(failure_msg, sizeof(failure_msg))) {
check_failed(display_failure, "OpenDroneID: %s", failure_msg);
return false;
}
#endif
return true;
}
bool AP_Arming::barometer_checks(bool report)
{
if ((checks_to_perform & ARMING_CHECK_ALL) ||
@ -1180,7 +1195,8 @@ bool AP_Arming::pre_arm_checks(bool report)
& visodom_checks(report)
& aux_auth_checks(report)
& disarm_switch_checks(report)
& fence_checks(report);
& fence_checks(report)
& opendroneid_checks(report);
}
bool AP_Arming::arm_checks(AP_Arming::Method method)
@ -1243,6 +1259,11 @@ bool AP_Arming::arm(AP_Arming::Method method, const bool do_arming_checks)
return false;
}
if (!opendroneid_checks(true)) {
AP::logger().arming_failure();
return false;
}
if ((!do_arming_checks && mandatory_checks(true)) || (pre_arm_checks(true) && arm_checks(method))) {
armed = true;

View File

@ -140,6 +140,8 @@ protected:
virtual bool barometer_checks(bool report);
virtual bool opendroneid_checks(bool display_failure);
bool airspeed_checks(bool report);
bool logging_checks(bool report);