diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 812f14b62a..d5fe37c05c 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -357,10 +357,6 @@ void suicide() { ***************** GCode Handlers ***************** **************************************************/ -#if HAS_MESH - #include "gcode/probe/G42.h" -#endif - #include "gcode/geometry/G92.h" #if HAS_RESUME_CONTINUE diff --git a/Marlin/src/gcode/probe/G42.h b/Marlin/src/gcode/bedlevel/G42.cpp similarity index 91% rename from Marlin/src/gcode/probe/G42.h rename to Marlin/src/gcode/bedlevel/G42.cpp index 374887700d..c46415b7db 100644 --- a/Marlin/src/gcode/probe/G42.h +++ b/Marlin/src/gcode/bedlevel/G42.cpp @@ -20,10 +20,19 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if HAS_MESH + +#include "../gcode.h" +#include "../../Marlin.h" // for IsRunning() +#include "../../module/motion.h" +#include "../../feature/bedlevel/bedlevel.h" + /** * G42: Move X & Y axes to mesh coordinates (I & J) */ -void gcode_G42() { +void GcodeSuite::G42() { if (IsRunning()) { const bool hasI = parser.seenval('I'); const int8_t ix = hasI ? parser.value_int() : 0; @@ -65,3 +74,5 @@ void gcode_G42() { #endif } } + +#endif // HAS_MESH diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index ec302ace46..7698523ac9 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_G42(); extern void gcode_G92(); extern void gcode_M0_M1(); extern void gcode_M3_M4(bool is_M3); @@ -400,9 +399,7 @@ void GcodeSuite::process_next_command() { break; #if HAS_MESH - case 42: - gcode_G42(); - break; + case 42: G42(); break; // G42: Coordinated move to a mesh point #endif #if ENABLED(DEBUG_GCODE_PARSER) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 66cd59232d..6a25d46d25 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -64,7 +64,7 @@ * G32 - Undock sled (Z_PROBE_SLED only) * G33 - Delta Auto-Calibration (Requires DELTA_AUTO_CALIBRATION) * G38 - Probe in any direction using the Z_MIN_PROBE (Requires G38_PROBE_TARGET) - * G42 - Coordinated move to a mesh point (Requires AUTO_BED_LEVELING_UBL) + * G42 - Coordinated move to a mesh point (Requires HAS_MESH) * G90 - Use Absolute Coordinates * G91 - Use Relative Coordinates * G92 - Set current position to coordinates given