diff --git a/ArduCopter/ArduCopter.cpp b/ArduCopter/ArduCopter.cpp index 6c17a8b4ba..3a3c911ee2 100644 --- a/ArduCopter/ArduCopter.cpp +++ b/ArduCopter/ArduCopter.cpp @@ -341,7 +341,9 @@ void Copter::ten_hz_logging_loop() attitude_control->control_monitor_log(); Log_Write_Proximity(); #if BEACON_ENABLED == ENABLED - DataFlash.Log_Write_Beacon(g2.beacon); + if (g2.beacon.enabled()) { + DataFlash.Log_Write_Beacon(g2.beacon); + } #endif } #if FRAME_CONFIG == HELI_FRAME diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index 0c21a96d47..00b6cead10 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -59,7 +59,6 @@ #include // RC Channel Library #include // AP Motors library #include // statistics library -#include #include // RSSI Library #include // Filter library #include // APM FIFO Buffer @@ -71,7 +70,6 @@ #include // ArduCopter waypoint navigation library #include // circle navigation library #include // ArduPilot Mega Declination Helper Library -#include // Arducopter stop at fence library #include // main loop scheduler #include // RC input mapping library #include // Notify library @@ -97,6 +95,12 @@ #include "AP_Arming.h" // libraries which are dependent on #defines in defines.h and/or config.h +#if BEACON_ENABLED == ENABLED + #include +#endif +#if AC_AVOID_ENABLED == ENABLED + #include +#endif #if SPRAYER == ENABLED # include #endif @@ -520,7 +524,11 @@ private: #endif #if AC_AVOID_ENABLED == ENABLED +# if BEACON_ENABLED == ENABLED AC_Avoid avoid{ahrs, fence, g2.proximity, &g2.beacon}; +# else + AC_Avoid avoid{ahrs, fence, g2.proximity}; +# endif #endif // Rally library diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 45bdec11e2..08e6bde337 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -668,10 +668,6 @@ #error Terrain requires ModeAuto which is disabled #endif -#if AC_AVOID_ENABLED && !BEACON_ENABLED - #error AC_Avoid requires Beacon which is disabled -#endif - ////////////////////////////////////////////////////////////////////////////// // Developer Items //