diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index bf32f7bc82..ede4653aed 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -374,12 +374,6 @@ bool pin_is_protected(const int8_t pin) { return false; } -#if DISABLED(EMERGENCY_PARSER) - #include "gcode/control/M108.h" - #include "gcode/control/M112.h" - #include "gcode/control/M410.h" -#endif - #if HAS_TEMP_BED #include "gcode/temperature/M190.h" #endif diff --git a/Marlin/src/gcode/control/M108.h b/Marlin/src/gcode/control/M108.cpp similarity index 83% rename from Marlin/src/gcode/control/M108.h rename to Marlin/src/gcode/control/M108.cpp index e370f9421c..238025283e 100644 --- a/Marlin/src/gcode/control/M108.h +++ b/Marlin/src/gcode/control/M108.cpp @@ -20,11 +20,20 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if DISABLED(EMERGENCY_PARSER) + +#include "../gcode.h" +#include "../../Marlin.h" // for wait_for_heatup + /** * M108: Stop the waiting for heaters in M109, M190, M303. Does not affect the target temperature. */ -void gcode_M108() { +void GcodeSuite::M108() { wait_for_heatup = false; } + +#endif // !EMERGENCY_PARSER diff --git a/Marlin/src/gcode/control/M112.h b/Marlin/src/gcode/control/M112.cpp similarity index 83% rename from Marlin/src/gcode/control/M112.h rename to Marlin/src/gcode/control/M112.cpp index 2f86ff12bf..40b99ee1be 100644 --- a/Marlin/src/gcode/control/M112.h +++ b/Marlin/src/gcode/control/M112.cpp @@ -20,11 +20,20 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if DISABLED(EMERGENCY_PARSER) + +#include "../gcode.h" +#include "../../Marlin.h" // for kill + /** * M112: Emergency Stop */ -void gcode_M112() { +void GcodeSuite::M112() { kill(PSTR(MSG_KILLED)); } + +#endif // !EMERGENCY_PARSER diff --git a/Marlin/src/gcode/control/M410.h b/Marlin/src/gcode/control/M410.cpp similarity index 84% rename from Marlin/src/gcode/control/M410.h rename to Marlin/src/gcode/control/M410.cpp index b023ddec6e..f2c12e672d 100644 --- a/Marlin/src/gcode/control/M410.h +++ b/Marlin/src/gcode/control/M410.cpp @@ -20,14 +20,23 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if DISABLED(EMERGENCY_PARSER) + +#include "../gcode.h" +#include "../../Marlin.h" // for quickstop_stepper + /** * M410: Quickstop - Abort all planned moves * * This will stop the carriages mid-move, so most likely they * will be out of sync with the stepper position after this. */ -void gcode_M410() { +void GcodeSuite::M410() { quickstop_stepper(); } + +#endif // !EMERGENCY_PARSER diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 081a17015f..6f18733ef3 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -124,10 +124,8 @@ extern void gcode_M83(); extern void gcode_M85(); extern void gcode_M92(); extern void gcode_M100(); -extern void gcode_M108(); extern void gcode_M110(); extern void gcode_M111(); -extern void gcode_M112(); extern void gcode_M113(); extern void gcode_M114(); extern void gcode_M115(); @@ -178,7 +176,6 @@ extern void gcode_M381(); extern void gcode_M400(); extern void gcode_M401(); extern void gcode_M402(); -extern void gcode_M410(); extern void gcode_M428(); extern void gcode_M500(); extern void gcode_M501(); @@ -462,19 +459,9 @@ void GcodeSuite::process_next_command() { break; #if DISABLED(EMERGENCY_PARSER) - - case 108: // M108: Cancel Waiting - gcode_M108(); - break; - - case 112: // M112: Emergency Stop - gcode_M112(); - break; - - case 410: // M410 quickstop - Abort all the planned moves. - gcode_M410(); - break; - + case 108: M108(); break; // M108: Cancel Waiting + case 112: M112(); break; // M112: Emergency Stop + case 410: M410(); break; // M410: Quickstop - Abort all the planned moves. #endif #if ENABLED(HOST_KEEPALIVE_FEATURE) diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 6a25d46d25..26ff734429 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -466,6 +466,8 @@ private: #if DISABLED(EMERGENCY_PARSER) static void M108(); + static void M112(); + static void M410(); #endif static void M109(); @@ -473,10 +475,6 @@ private: static void M110(); static void M111(); - #if DISABLED(EMERGENCY_PARSER) - static void M112(); - #endif - #if ENABLED(HOST_KEEPALIVE_FEATURE) static void M113(); #endif @@ -638,10 +636,6 @@ private: static void M407(); #endif - #if DISABLED(EMERGENCY_PARSER) - static void M410(); - #endif - #if HAS_LEVELING static void M420(); static void M421();