diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index 2d620deb83..0827e2a09c 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -174,15 +174,14 @@ #error AP_OAPathPlanner relies on AP_FENCE_ENABLED which is disabled #endif -// Local modules -#ifdef USER_PARAMS_ENABLED -#include "UserParameters.h" -#endif -#include "Parameters.h" #if HAL_ADSB_ENABLED #include "avoidance_adsb.h" #endif - +// Local modules +#include "Parameters.h" +#if USER_PARAMS_ENABLED +#include "UserParameters.h" +#endif #include "mode.h" class Copter : public AP_Vehicle { diff --git a/ArduCopter/Parameters.cpp b/ArduCopter/Parameters.cpp index 0f5b6ba6bb..7c09a42b07 100644 --- a/ArduCopter/Parameters.cpp +++ b/ArduCopter/Parameters.cpp @@ -894,7 +894,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = { AP_SUBGROUPINFO(follow, "FOLL", 27, ParametersG2, AP_Follow), #endif -#ifdef USER_PARAMS_ENABLED +#if USER_PARAMS_ENABLED == ENABLED AP_SUBGROUPINFO(user_parameters, "USR", 28, ParametersG2, UserParameters), #endif @@ -1260,7 +1260,7 @@ ParametersG2::ParametersG2(void) #if MODE_FOLLOW_ENABLED == ENABLED ,follow() #endif -#ifdef USER_PARAMS_ENABLED +#if USER_PARAMS_ENABLED == ENABLED ,user_parameters() #endif #if AUTOTUNE_ENABLED == ENABLED diff --git a/ArduCopter/Parameters.h b/ArduCopter/Parameters.h index e1f207400f..e59bf22387 100644 --- a/ArduCopter/Parameters.h +++ b/ArduCopter/Parameters.h @@ -591,7 +591,7 @@ public: AP_Follow follow; #endif -#ifdef USER_PARAMS_ENABLED +#if USER_PARAMS_ENABLED == ENABLED // User custom parameters UserParameters user_parameters; #endif diff --git a/ArduCopter/UserParameters.cpp b/ArduCopter/UserParameters.cpp index 37e61f8ab5..61f1b7122b 100644 --- a/ArduCopter/UserParameters.cpp +++ b/ArduCopter/UserParameters.cpp @@ -1,5 +1,7 @@ #include "UserParameters.h" +#include "config.h" +#if USER_PARAMS_ENABLED == ENABLED // "USR" + 13 chars remaining for param name const AP_Param::GroupInfo UserParameters::var_info[] = { @@ -16,3 +18,4 @@ UserParameters::UserParameters() { AP_Param::setup_object_defaults(this, var_info); } +#endif // USER_PARAMS_ENABLED diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 8b2010c0d2..329678e1b8 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -27,6 +27,7 @@ /// change in your local copy of APM_Config.h. /// #include "APM_Config.h" +#include #include @@ -642,3 +643,7 @@ #ifndef AC_PAYLOAD_PLACE_ENABLED #define AC_PAYLOAD_PLACE_ENABLED 1 #endif + +#ifndef USER_PARAMS_ENABLED + #define USER_PARAMS_ENABLED DISABLED +#endif diff --git a/ArduCopter/toy_mode.h b/ArduCopter/toy_mode.h index f955462b91..13bb12454f 100644 --- a/ArduCopter/toy_mode.h +++ b/ArduCopter/toy_mode.h @@ -1,5 +1,9 @@ #pragma once +#include +#include +#include "mode.h" + /* class to support "toy" mode for simplified user interaction for large volume consumer vehicles