From 32b6a3ad123cc62e432e8a34d8c105063561a352 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Tue, 1 May 2018 04:20:45 -0500
Subject: [PATCH] Fewer includes of vector_3.h

---
 Marlin/Marlin_main.cpp | 8 +-------
 Marlin/planner.h       | 2 +-
 Marlin/ubl.h           | 1 -
 Marlin/ubl_G29.cpp     | 2 ++
 Marlin/vector_3.cpp    | 2 +-
 5 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp
index 8704d781d1..a5a60e2dd1 100644
--- a/Marlin/Marlin_main.cpp
+++ b/Marlin/Marlin_main.cpp
@@ -271,7 +271,7 @@
   #include "power.h"
 #endif
 
-#if HAS_ABL
+#if ABL_PLANAR
   #include "vector_3.h"
   #if ENABLED(AUTO_BED_LEVELING_LINEAR)
     #include "least_squares_fit.h"
@@ -773,12 +773,6 @@ void report_current_position_detail();
     print_xyz(prefix, suffix, xyz[X_AXIS], xyz[Y_AXIS], xyz[Z_AXIS]);
   }
 
-  #if HAS_ABL
-    void print_xyz(const char* prefix, const char* suffix, const vector_3 &xyz) {
-      print_xyz(prefix, suffix, xyz.x, xyz.y, xyz.z);
-    }
-  #endif
-
   #define DEBUG_POS(SUFFIX,VAR) do { \
     print_xyz(PSTR("  " STRINGIFY(VAR) "="), PSTR(" : " SUFFIX "\n"), VAR); }while(0)
 #endif
diff --git a/Marlin/planner.h b/Marlin/planner.h
index 61af55fc81..af845600a5 100644
--- a/Marlin/planner.h
+++ b/Marlin/planner.h
@@ -36,7 +36,7 @@
 #include "enum.h"
 #include "Marlin.h"
 
-#if HAS_ABL
+#if ABL_PLANAR
   #include "vector_3.h"
 #endif
 
diff --git a/Marlin/ubl.h b/Marlin/ubl.h
index 90d6cd26a7..5a401df2f8 100644
--- a/Marlin/ubl.h
+++ b/Marlin/ubl.h
@@ -30,7 +30,6 @@
 #include "Marlin.h"
 #include "planner.h"
 #include "math.h"
-#include "vector_3.h"
 #include "configuration_store.h"
 
 #define UBL_VERSION "1.01"
diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp
index 3acd867e6b..d28edc161b 100644
--- a/Marlin/ubl_G29.cpp
+++ b/Marlin/ubl_G29.cpp
@@ -1491,6 +1491,8 @@
 
   #if HAS_BED_PROBE
 
+    #include "vector_3.h"
+
     void unified_bed_leveling::tilt_mesh_based_on_probed_grid(const bool do_3_pt_leveling) {
       constexpr int16_t x_min = max(MIN_PROBE_X, MESH_MIN_X),
                         x_max = min(MAX_PROBE_X, MESH_MAX_X),
diff --git a/Marlin/vector_3.cpp b/Marlin/vector_3.cpp
index aebc8c9737..4bfcdeb933 100644
--- a/Marlin/vector_3.cpp
+++ b/Marlin/vector_3.cpp
@@ -41,7 +41,7 @@
 
 #include "MarlinConfig.h"
 
-#if HAS_ABL
+#if ABL_PLANAR || (HAS_BED_PROBE && ENABLED(AUTO_BED_LEVELING_UBL))
 
 #include "vector_3.h"
 #include "serial.h"