From dda50fffed97358df996d937cf00fcc8a4645aae Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Thu, 12 Aug 2021 11:50:37 +0200 Subject: [PATCH] AP_Arming: call fettec prearm checks --- libraries/AP_Arming/AP_Arming.cpp | 20 ++++++++++++++++++++ libraries/AP_Arming/AP_Arming.h | 2 ++ 2 files changed, 22 insertions(+) diff --git a/libraries/AP_Arming/AP_Arming.cpp b/libraries/AP_Arming/AP_Arming.cpp index f56c23b36c..3f72694d6a 100644 --- a/libraries/AP_Arming/AP_Arming.cpp +++ b/libraries/AP_Arming/AP_Arming.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #if HAL_MAX_CAN_PROTOCOL_DRIVERS #include @@ -995,6 +996,24 @@ bool AP_Arming::osd_checks(bool display_failure) const return true; } +bool AP_Arming::fettec_checks(bool display_failure) const +{ +#if HAL_AP_FETTEC_ONEWIRE_ENABLED + const AP_FETtecOneWire *f = AP_FETtecOneWire::get_singleton(); + if (f == nullptr) { + return true; + } + + // check camera is ready + char fail_msg[MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1]; + if (!f->pre_arm_check(fail_msg, ARRAY_SIZE(fail_msg))) { + check_failed(ARMING_CHECK_ALL, display_failure, "FETtec: %s", fail_msg); + return false; + } +#endif + return true; +} + // request an auxiliary authorisation id. This id should be used in subsequent calls to set_aux_auth_passed/failed // returns true on success bool AP_Arming::get_aux_auth_id(uint8_t& auth_id) @@ -1156,6 +1175,7 @@ bool AP_Arming::pre_arm_checks(bool report) & proximity_checks(report) & camera_checks(report) & osd_checks(report) + & fettec_checks(report) & visodom_checks(report) & aux_auth_checks(report) & disarm_switch_checks(report) diff --git a/libraries/AP_Arming/AP_Arming.h b/libraries/AP_Arming/AP_Arming.h index 6368bd60a9..de00cb6df9 100644 --- a/libraries/AP_Arming/AP_Arming.h +++ b/libraries/AP_Arming/AP_Arming.h @@ -180,6 +180,8 @@ protected: bool can_checks(bool report); + bool fettec_checks(bool display_failure) const; + virtual bool proximity_checks(bool report) const; bool servo_checks(bool report) const;