diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index 15e349e795..bd5d65e261 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -17,6 +17,10 @@ * RC_Channel.cpp - class for one RC channel input */ +#include "RC_Channel_config.h" + +#if AP_RC_CHANNEL_ENABLED + #include #include @@ -1721,3 +1725,5 @@ void RC_Channels::convert_options(const RC_Channel::aux_func_t old_option, const } } } + +#endif // AP_RC_CHANNEL_ENABLED diff --git a/libraries/RC_Channel/RC_Channel.h b/libraries/RC_Channel/RC_Channel.h index 581a2dbdbd..e8fedae4c7 100644 --- a/libraries/RC_Channel/RC_Channel.h +++ b/libraries/RC_Channel/RC_Channel.h @@ -2,15 +2,15 @@ /// @brief RC_Channel manager, with EEPROM-backed storage of constants. #pragma once +#include "RC_Channel_config.h" + +#if AP_RC_CHANNEL_ENABLED + #include #include #include #include -#ifndef AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED -#define AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED 1 -#endif - #define NUM_RC_CHANNELS 16 /// @class RC_Channel @@ -680,3 +680,5 @@ private: }; RC_Channels &rc(); + +#endif // AP_RC_CHANNEL_ENABLED diff --git a/libraries/RC_Channel/RC_Channel_config.h b/libraries/RC_Channel/RC_Channel_config.h new file mode 100644 index 0000000000..493f8cf3a6 --- /dev/null +++ b/libraries/RC_Channel/RC_Channel_config.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +#ifndef AP_RC_CHANNEL_ENABLED +#define AP_RC_CHANNEL_ENABLED 1 +#endif + +#ifndef AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED +#define AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED AP_RC_CHANNEL_ENABLED +#endif diff --git a/libraries/RC_Channel/RC_Channels.cpp b/libraries/RC_Channel/RC_Channels.cpp index 21915176b1..7a24050881 100644 --- a/libraries/RC_Channel/RC_Channels.cpp +++ b/libraries/RC_Channel/RC_Channels.cpp @@ -18,6 +18,10 @@ * */ +#include "RC_Channel_config.h" + +#if AP_RC_CHANNEL_ENABLED + #include #include @@ -307,3 +311,5 @@ RC_Channels &rc() { return *RC_Channels::get_singleton(); } + +#endif // AP_RC_CHANNEL_ENABLED diff --git a/libraries/RC_Channel/RC_Channels_VarInfo.h b/libraries/RC_Channel/RC_Channels_VarInfo.h index 41fee86789..814a17e17a 100644 --- a/libraries/RC_Channel/RC_Channels_VarInfo.h +++ b/libraries/RC_Channel/RC_Channels_VarInfo.h @@ -1,5 +1,9 @@ #pragma once +#include "RC_Channel_config.h" + +#if AP_RC_CHANNEL_ENABLED + #include "RC_Channel.h" @@ -109,3 +113,5 @@ const AP_Param::GroupInfo RC_Channels::var_info[] = { AP_GROUPEND }; + +#endif // AP_RC_CHANNEL_ENABLED