From 6c7bad8bc334aac0c82ddc0ed818dc6ed0c0a90f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Sep 2017 02:25:52 -0500 Subject: [PATCH] Move M666 to cpp --- Marlin/src/Marlin.cpp | 4 ---- .../src/gcode/calibrate/{M666.h => M666.cpp} | 21 +++++++++++++++---- Marlin/src/gcode/gcode.cpp | 5 +---- 3 files changed, 18 insertions(+), 12 deletions(-) rename Marlin/src/gcode/calibrate/{M666.h => M666.cpp} (83%) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index b409ff090..b3f9cf243 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -355,10 +355,6 @@ bool pin_is_protected(const int8_t pin) { return false; } -#if ENABLED(DELTA) || ENABLED(Z_DUAL_ENDSTOPS) - #include "gcode/calibrate/M666.h" -#endif - #include "gcode/control/M211.h" #include "gcode/config/M220.h" diff --git a/Marlin/src/gcode/calibrate/M666.h b/Marlin/src/gcode/calibrate/M666.cpp similarity index 83% rename from Marlin/src/gcode/calibrate/M666.h rename to Marlin/src/gcode/calibrate/M666.cpp index a79e3b90b..2dcdc76b9 100644 --- a/Marlin/src/gcode/calibrate/M666.h +++ b/Marlin/src/gcode/calibrate/M666.cpp @@ -20,15 +20,24 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if ENABLED(DELTA) || ENABLED(Z_DUAL_ENDSTOPS) + +#include "../gcode.h" + #if ENABLED(DELTA) + #include "../../module/delta.h" + #include "../../module/motion.h" + /** * M666: Set delta endstop adjustment */ - void gcode_M666() { + void GcodeSuite::M666() { #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM(">>> gcode_M666"); + SERIAL_ECHOLNPGM(">>> M666"); } #endif LOOP_XYZ(i) { @@ -44,7 +53,7 @@ } #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPGM("<<< gcode_M666"); + SERIAL_ECHOLNPGM("<<< M666"); } #endif // normalize endstops so all are <=0; set the residue to delta height @@ -55,12 +64,16 @@ #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS) + #include "../../Marlin.h" // for z_endstop_adj + /** * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis. */ - void gcode_M666() { + void GcodeSuite::M666() { if (parser.seen('Z')) z_endstop_adj = parser.value_linear_units(); SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj); } #endif + +#endif // DELTA || Z_DUAL_ENDSTOPS diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 3546a706e..30433e131 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -151,7 +151,6 @@ extern void gcode_M502(); extern void gcode_M503(); extern void gcode_M540(); extern void gcode_M605(); -extern void gcode_M666(); extern void gcode_M702(); extern void gcode_M900(); extern void gcode_M906(); @@ -544,9 +543,7 @@ void GcodeSuite::process_next_command() { #endif #if ENABLED(DELTA) || ENABLED(Z_DUAL_ENDSTOPS) - case 666: // M666: Set delta or dual endstop adjustment - gcode_M666(); - break; + case 666: M666(); break; // M666: Set delta or dual endstop adjustment #endif #if ENABLED(FWRETRACT)