From 5b3e49babdcf8f90c7f6d2ed1bc4e61d11db9d75 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 16 Sep 2017 13:24:32 -0500 Subject: [PATCH] Move M108, M112, M410 to cpp --- Marlin/src/Marlin.cpp | 6 ------ Marlin/src/gcode/control/{M108.h => M108.cpp} | 11 ++++++++++- Marlin/src/gcode/control/{M112.h => M112.cpp} | 11 ++++++++++- Marlin/src/gcode/control/{M410.h => M410.cpp} | 11 ++++++++++- Marlin/src/gcode/gcode.cpp | 19 +++---------------- Marlin/src/gcode/gcode.h | 10 ++-------- 6 files changed, 35 insertions(+), 33 deletions(-) rename Marlin/src/gcode/control/{M108.h => M108.cpp} (83%) rename Marlin/src/gcode/control/{M112.h => M112.cpp} (83%) rename Marlin/src/gcode/control/{M410.h => M410.cpp} (84%) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index bf32f7bc8..ede4653ae 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 e370f9421..238025283 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 2f86ff12b..40b99ee1b 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 b023ddec6..f2c12e672 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 081a17015..6f18733ef 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 6a25d46d2..26ff73442 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();