From 00ba5e4992ee17f2d49f85f41f5586fcbaf4ec43 Mon Sep 17 00:00:00 2001
From: Andrew Tridgell <andrew@tridgell.net>
Date: Sat, 18 Jan 2020 09:57:23 +1100
Subject: [PATCH] AC_Sprayer: make configurable in hwdef.dat

---
 libraries/AC_Sprayer/AC_Sprayer.cpp | 3 +++
 libraries/AC_Sprayer/AC_Sprayer.h   | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/libraries/AC_Sprayer/AC_Sprayer.cpp b/libraries/AC_Sprayer/AC_Sprayer.cpp
index a935f22adc..9b678135b5 100644
--- a/libraries/AC_Sprayer/AC_Sprayer.cpp
+++ b/libraries/AC_Sprayer/AC_Sprayer.cpp
@@ -1,5 +1,7 @@
 #include "AC_Sprayer.h"
 
+#if HAL_SPRAYER_ENABLED
+
 #include <AP_AHRS/AP_AHRS.h>
 #include <AP_HAL/AP_HAL.h>
 #include <AP_Math/AP_Math.h>
@@ -198,3 +200,4 @@ AC_Sprayer *sprayer()
 }
 
 };
+#endif // HAL_SPRAYER_ENABLED
diff --git a/libraries/AC_Sprayer/AC_Sprayer.h b/libraries/AC_Sprayer/AC_Sprayer.h
index 921af586b5..e86b06cbd6 100644
--- a/libraries/AC_Sprayer/AC_Sprayer.h
+++ b/libraries/AC_Sprayer/AC_Sprayer.h
@@ -25,6 +25,12 @@
 #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 !HAL_MINIMIZE_FEATURES
+#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 {
@@ -86,3 +92,4 @@ private:
 namespace AP {
     AC_Sprayer *sprayer();
 };
+#endif // HAL_SPRAYER_ENABLED