From fc722b5efc7d035d8c5c7bd8f9e4d3666e0cdbd6 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 19 Sep 2023 19:51:08 +1000 Subject: [PATCH] AP_Tuning: add and use AP_TUNING_ENABLED --- ArduPlane/Plane.h | 5 +++++ ArduPlane/radio.cpp | 2 ++ libraries/AP_Tuning/AP_Tuning.cpp | 6 ++++++ libraries/AP_Tuning/AP_Tuning.h | 6 ++++++ libraries/AP_Tuning/AP_Tuning_config.h | 7 +++++++ 5 files changed, 26 insertions(+) create mode 100644 libraries/AP_Tuning/AP_Tuning_config.h diff --git a/ArduPlane/Plane.h b/ArduPlane/Plane.h index 5042cd4899..1385e5cbc4 100644 --- a/ArduPlane/Plane.h +++ b/ArduPlane/Plane.h @@ -91,7 +91,10 @@ #include "GCS_Mavlink.h" #include "GCS_Plane.h" #include "quadplane.h" +#include +#if AP_TUNING_ENABLED #include "tuning.h" +#endif // Configuration #include "config.h" @@ -793,8 +796,10 @@ private: QuadPlane quadplane{ahrs}; #endif +#if AP_TUNING_ENABLED // support for transmitter tuning AP_Tuning_Plane tuning; +#endif static const struct LogStructure log_structure[]; diff --git a/ArduPlane/radio.cpp b/ArduPlane/radio.cpp index 7a28ca11f5..cb7e68ff22 100644 --- a/ArduPlane/radio.cpp +++ b/ArduPlane/radio.cpp @@ -210,8 +210,10 @@ void Plane::read_radio() quadplane.tailsitter.check_input(); #endif +#if AP_TUNING_ENABLED // check for transmitter tuning changes tuning.check_input(control_mode->mode_number()); +#endif } int16_t Plane::rudder_input(void) diff --git a/libraries/AP_Tuning/AP_Tuning.cpp b/libraries/AP_Tuning/AP_Tuning.cpp index 17364bd325..b07aec2d8e 100644 --- a/libraries/AP_Tuning/AP_Tuning.cpp +++ b/libraries/AP_Tuning/AP_Tuning.cpp @@ -1,3 +1,7 @@ +#include "AP_Tuning_config.h" + +#if AP_TUNING_ENABLED + #include "AP_Tuning.h" #include @@ -334,3 +338,5 @@ const char *AP_Tuning::get_tuning_name(uint8_t parm) } return "UNKNOWN"; } + +#endif // AP_TUNING_ENABLED diff --git a/libraries/AP_Tuning/AP_Tuning.h b/libraries/AP_Tuning/AP_Tuning.h index 9be466391b..88ffda0c4b 100644 --- a/libraries/AP_Tuning/AP_Tuning.h +++ b/libraries/AP_Tuning/AP_Tuning.h @@ -1,5 +1,9 @@ #pragma once +#include "AP_Tuning_config.h" + +#if AP_TUNING_ENABLED + #include #include "stdint.h" @@ -100,3 +104,5 @@ protected: // parmset is in vehicle subclass var table AP_Int16 parmset; }; + +#endif // AP_TUNING_ENABLED diff --git a/libraries/AP_Tuning/AP_Tuning_config.h b/libraries/AP_Tuning/AP_Tuning_config.h new file mode 100644 index 0000000000..69045eb0af --- /dev/null +++ b/libraries/AP_Tuning/AP_Tuning_config.h @@ -0,0 +1,7 @@ +#pragma once + +#include + +#ifndef AP_TUNING_ENABLED +#define AP_TUNING_ENABLED 1 +#endif