From 84ddae56a8202ba0a9484e914d75e738db754550 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Fri, 15 Sep 2017 23:44:29 -0500
Subject: [PATCH] Move G38 to cpp

---
 Marlin/src/Marlin.cpp                     |  4 ----
 Marlin/src/gcode/gcode.cpp                |  3 +--
 Marlin/src/gcode/gcode.h                  |  2 +-
 Marlin/src/gcode/probe/{G38.h => G38.cpp} | 15 +++++++++++++--
 4 files changed, 15 insertions(+), 9 deletions(-)
 rename Marlin/src/gcode/probe/{G38.h => G38.cpp} (90%)

diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp
index a249f60a45..812f14b62a 100644
--- a/Marlin/src/Marlin.cpp
+++ b/Marlin/src/Marlin.cpp
@@ -357,10 +357,6 @@ void suicide() {
  ***************** GCode Handlers *****************
  **************************************************/
 
-#if ENABLED(G38_PROBE_TARGET)
-  #include "gcode/probe/G38.h"
-#endif
-
 #if HAS_MESH
   #include "gcode/probe/G42.h"
 #endif
diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp
index 947b3dd71e..ec302ace46 100644
--- a/Marlin/src/gcode/gcode.cpp
+++ b/Marlin/src/gcode/gcode.cpp
@@ -116,7 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
 //
 // Placeholders for non-migrated codes
 //
-extern void gcode_G38(bool is_38_2);
 extern void gcode_G42();
 extern void gcode_G92();
 extern void gcode_M0_M1();
@@ -385,7 +384,7 @@ void GcodeSuite::process_next_command() {
       #if ENABLED(G38_PROBE_TARGET)
         case 38: // G38.2 & G38.3
           if (parser.subcode == 2 || parser.subcode == 3)
-            gcode_G38(parser.subcode == 2);
+            G38(parser.subcode == 2);
           break;
       #endif
 
diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h
index 90c1aabb6e..66cd59232d 100644
--- a/Marlin/src/gcode/gcode.h
+++ b/Marlin/src/gcode/gcode.h
@@ -375,7 +375,7 @@ private:
   #endif
 
   #if ENABLED(G38_PROBE_TARGET)
-    static void G38(bool is_38_2);
+    static void G38(const bool is_38_2);
   #endif
 
   #if HAS_MESH
diff --git a/Marlin/src/gcode/probe/G38.h b/Marlin/src/gcode/probe/G38.cpp
similarity index 90%
rename from Marlin/src/gcode/probe/G38.h
rename to Marlin/src/gcode/probe/G38.cpp
index 976569d8f1..71e022cd83 100644
--- a/Marlin/src/gcode/probe/G38.h
+++ b/Marlin/src/gcode/probe/G38.cpp
@@ -20,8 +20,17 @@
  *
  */
 
+#include "../../inc/MarlinConfig.h"
+
+#if ENABLED(G38_PROBE_TARGET)
+
 #include "../gcode.h"
 
+#include "../../module/endstops.h"
+#include "../../module/motion.h"
+#include "../../module/stepper.h"
+#include "../../module/probe.h"
+
 static bool G38_run_probe() {
 
   bool G38_pass_fail = false;
@@ -88,9 +97,9 @@ static bool G38_run_probe() {
  *
  * Like G28 except uses Z min probe for all axes
  */
-void gcode_G38(bool is_38_2) {
+void GcodeSuite::G38(const bool is_38_2) {
   // Get X Y Z E F
-  gcode.get_destination_from_command();
+  get_destination_from_command();
 
   setup_for_endstop_or_probe_move();
 
@@ -108,3 +117,5 @@ void gcode_G38(bool is_38_2) {
 
   clean_up_after_endstop_or_probe_move();
 }
+
+#endif // G38_PROBE_TARGET