RC_Channel: make emitting nice strings on aux functions a selectable feature

This commit is contained in:
Peter Barker 2022-10-06 21:44:29 +11:00 committed by Peter Barker
parent 93db267204
commit 8e7d87447c
2 changed files with 9 additions and 5 deletions

View File

@ -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) {

View File

@ -6,6 +6,10 @@
#include <AP_Param/AP_Param.h>
#include <AP_Math/AP_Math.h>
#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;