From 8e7d87447c2c59b808d8bd83f78b55dd0e1c9427 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 6 Oct 2022 21:44:29 +1100 Subject: [PATCH] RC_Channel: make emitting nice strings on aux functions a selectable feature --- libraries/RC_Channel/RC_Channel.cpp | 6 +++--- libraries/RC_Channel/RC_Channel.h | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/libraries/RC_Channel/RC_Channel.cpp b/libraries/RC_Channel/RC_Channel.cpp index 6cf316c1eb..7d86f082e5 100644 --- a/libraries/RC_Channel/RC_Channel.cpp +++ b/libraries/RC_Channel/RC_Channel.cpp @@ -551,7 +551,7 @@ void RC_Channel::init_aux_function(const aux_func_t ch_option, const AuxSwitchPo } } -#if !HAL_MINIMIZE_FEATURES +#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED const RC_Channel::LookupTable RC_Channel::lookuptable[] = { { AUX_FUNC::SAVE_WP,"SaveWaypoint"}, @@ -616,7 +616,7 @@ const char *RC_Channel::string_for_aux_function(AUX_FUNC function) const return nullptr; } -#endif // HAL_MINIMIZE_FEATURES +#endif // AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED /* read an aux channel. Return true if a switch has changed @@ -646,7 +646,7 @@ bool RC_Channel::read_aux() return false; } -#if !HAL_MINIMIZE_FEATURES +#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED // announce the change to the GCS: const char *aux_string = string_for_aux_function(_option); if (aux_string != nullptr) { diff --git a/libraries/RC_Channel/RC_Channel.h b/libraries/RC_Channel/RC_Channel.h index 37c0765489..9192272003 100644 --- a/libraries/RC_Channel/RC_Channel.h +++ b/libraries/RC_Channel/RC_Channel.h @@ -6,6 +6,10 @@ #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 @@ -288,7 +292,7 @@ public: // wrapper function around do_aux_function which allows us to log bool run_aux_function(aux_func_t ch_option, AuxSwitchPos pos, AuxFuncTriggerSource source); -#if !HAL_MINIMIZE_FEATURES +#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED const char *string_for_aux_function(AUX_FUNC function) const; #endif // pwm value under which we consider that Radio value is invalid @@ -390,7 +394,7 @@ private: void read_mode_switch(); bool debounce_completed(int8_t position); -#if !HAL_MINIMIZE_FEATURES +#if AP_RC_CHANNEL_AUX_FUNCTION_STRINGS_ENABLED // Structure to lookup switch change announcements struct LookupTable{ AUX_FUNC option;