From 21eba742c018d26bb105e0ab49ef11484a84bf2a Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 7 Mar 2024 21:04:28 +1100 Subject: [PATCH] AC_Sprayer: create and use an AP_Sprayer_config.h --- libraries/AC_Sprayer/AC_Sprayer.cpp | 3 ++- libraries/AC_Sprayer/AC_Sprayer.h | 10 ++++------ libraries/AC_Sprayer/AC_Sprayer_config.h | 7 +++++++ 3 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 libraries/AC_Sprayer/AC_Sprayer_config.h diff --git a/libraries/AC_Sprayer/AC_Sprayer.cpp b/libraries/AC_Sprayer/AC_Sprayer.cpp index c6b026eb5628df..5b903fac63102d 100644 --- a/libraries/AC_Sprayer/AC_Sprayer.cpp +++ b/libraries/AC_Sprayer/AC_Sprayer.cpp @@ -1,7 +1,8 @@ -#include "AC_Sprayer.h" +#include "AC_Sprayer_config.h" #if HAL_SPRAYER_ENABLED +#include "AC_Sprayer.h" #include #include #include diff --git a/libraries/AC_Sprayer/AC_Sprayer.h b/libraries/AC_Sprayer/AC_Sprayer.h index 240e354d22070f..e4f0ba425ac6a9 100644 --- a/libraries/AC_Sprayer/AC_Sprayer.h +++ b/libraries/AC_Sprayer/AC_Sprayer.h @@ -14,6 +14,10 @@ **/ #pragma once +#include "AC_Sprayer_config.h" + +#if HAL_SPRAYER_ENABLED + #include #include #include @@ -25,12 +29,6 @@ #define AC_SPRAYER_DEFAULT_TURN_ON_DELAY 100 ///< delay between when we reach the minimum speed and we begin spraying. This reduces the likelihood of constantly turning on/off the pump #define AC_SPRAYER_DEFAULT_SHUT_OFF_DELAY 1000 ///< shut-off delay in milli seconds. This reduces the likelihood of constantly turning on/off the pump -#ifndef HAL_SPRAYER_ENABLED -#define HAL_SPRAYER_ENABLED 1 -#endif - -#if HAL_SPRAYER_ENABLED - /// @class AC_Sprayer /// @brief Object managing a crop sprayer comprised of a spinner and a pump both controlled by pwm class AC_Sprayer { diff --git a/libraries/AC_Sprayer/AC_Sprayer_config.h b/libraries/AC_Sprayer/AC_Sprayer_config.h new file mode 100644 index 00000000000000..4bb39f35fdf5f6 --- /dev/null +++ b/libraries/AC_Sprayer/AC_Sprayer_config.h @@ -0,0 +1,7 @@ +#pragma once + +#include + +#ifndef HAL_SPRAYER_ENABLED +#define HAL_SPRAYER_ENABLED 1 +#endif