diff --git a/libraries/AP_LandingGear/AP_LandingGear.cpp b/libraries/AP_LandingGear/AP_LandingGear.cpp index 807b4350f9..b7a7bc3ebb 100644 --- a/libraries/AP_LandingGear/AP_LandingGear.cpp +++ b/libraries/AP_LandingGear/AP_LandingGear.cpp @@ -1,4 +1,7 @@ #include "AP_LandingGear.h" + +#if AP_LANDINGGEAR_ENABLED + #include #include #include @@ -10,6 +13,10 @@ #include #endif +#if defined(APM_BUILD_TYPE) +// - this is just here to encourage the build system to supply the "legacy build defines". The actual dependecy is in the AP_LandingGear.h and AP_LandingGear_config.h headers +#endif + extern const AP_HAL::HAL& hal; const AP_Param::GroupInfo AP_LandingGear::var_info[] = { @@ -331,3 +338,5 @@ void AP_LandingGear::deploy_for_landing() deploy(); } } + +#endif diff --git a/libraries/AP_LandingGear/AP_LandingGear.h b/libraries/AP_LandingGear/AP_LandingGear.h index da81d3fe03..6cafc77d5a 100644 --- a/libraries/AP_LandingGear/AP_LandingGear.h +++ b/libraries/AP_LandingGear/AP_LandingGear.h @@ -2,6 +2,10 @@ /// @brief Landing gear control library #pragma once +#include "AP_LandingGear_config.h" + +#if AP_LANDINGGEAR_ENABLED + #include #include @@ -123,3 +127,5 @@ private: static AP_LandingGear *_singleton; }; + +#endif // AP_LANDINGGEAR_ENABLED diff --git a/libraries/AP_LandingGear/AP_LandingGear_config.h b/libraries/AP_LandingGear/AP_LandingGear_config.h new file mode 100644 index 0000000000..e6e1015ffe --- /dev/null +++ b/libraries/AP_LandingGear/AP_LandingGear_config.h @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +// historical compatability; only Copters get it - and Plane on +// non-minimized boards. +#ifndef AP_LANDINGGEAR_ENABLED +#define AP_LANDINGGEAR_ENABLED (APM_BUILD_COPTER_OR_HELI || (!HAL_MINIMIZE_FEATURES && APM_BUILD_TYPE(APM_BUILD_ArduPlane))) +#endif