diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 08ba0c26e1..c96bdaf096 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -352,10 +352,6 @@ bool pin_is_protected(const int8_t pin) { return false; } -#if HAS_BED_PROBE - #include "gcode/probe/M401_M402.h" -#endif - void quickstop_stepper() { stepper.quick_stop(); stepper.synchronize(); diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index e4923509a8..69dd1d4371 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -122,8 +122,6 @@ extern void gcode_M165(); extern void gcode_M350(); extern void gcode_M351(); extern void gcode_M355(); -extern void gcode_M401(); -extern void gcode_M402(); extern void gcode_M428(); extern void gcode_M500(); extern void gcode_M501(); @@ -601,13 +599,9 @@ void GcodeSuite::process_next_command() { case 400: M400(); break; // M400: Finish all moves #if HAS_BED_PROBE - case 401: // M401: Deploy probe - gcode_M401(); - break; - case 402: // M402: Stow probe - gcode_M402(); - break; - #endif // HAS_BED_PROBE + case 401: M401(); break; // M401: Deploy probe + case 402: M402(); break; // M402: Stow probe + #endif #if ENABLED(FILAMENT_WIDTH_SENSOR) case 404: // M404: Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width diff --git a/Marlin/src/gcode/probe/M401_M402.h b/Marlin/src/gcode/probe/M401_M402.cpp similarity index 81% rename from Marlin/src/gcode/probe/M401_M402.h rename to Marlin/src/gcode/probe/M401_M402.cpp index 95f2456b29..df6711ee11 100644 --- a/Marlin/src/gcode/probe/M401_M402.h +++ b/Marlin/src/gcode/probe/M401_M402.cpp @@ -20,13 +20,21 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if HAS_BED_PROBE + +#include "../gcode.h" +#include "../../module/probe.h" + /** * M401: Engage Z Servo endstop if available */ -void gcode_M401() { DEPLOY_PROBE(); } +void GcodeSuite::M401() { DEPLOY_PROBE(); } /** * M402: Retract Z Servo endstop if enabled */ -void gcode_M402() { STOW_PROBE(); } +void GcodeSuite::M402() { STOW_PROBE(); } +#endif // HAS_BED_PROBE