diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index 21928b0fcf..5dd56c8f54 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -891,7 +891,7 @@ void RC_Channel::do_aux_function_avoid_adsb(const AuxSwitchPos ch_flag) void RC_Channel::do_aux_function_avoid_proximity(const AuxSwitchPos ch_flag) { -#if !APM_BUILD_TYPE(APM_BUILD_ArduPlane) +#if AP_AVOIDANCE_ENABLED && !APM_BUILD_TYPE(APM_BUILD_ArduPlane) AC_Avoid *avoid = AP::ac_avoid(); if (avoid == nullptr) { return;