From 04583d46af0246e12bf29609bd676b40b6096662 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 16 Sep 2017 01:00:31 -0500 Subject: [PATCH] Move M0_M1 to cpp --- Marlin/src/Marlin.cpp | 4 ---- Marlin/src/gcode/gcode.cpp | 3 +-- Marlin/src/gcode/lcd/{M0_M1.h => M0_M1.cpp} | 19 ++++++++++++++++--- 3 files changed, 17 insertions(+), 9 deletions(-) rename Marlin/src/gcode/lcd/{M0_M1.h => M0_M1.cpp} (86%) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 3e2ea77147..6a30cd6d51 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -357,10 +357,6 @@ void suicide() { ***************** GCode Handlers ***************** **************************************************/ -#if HAS_RESUME_CONTINUE - #include "gcode/lcd/M0_M1.h" -#endif - #if ENABLED(SPINDLE_LASER_ENABLE) #include "gcode/control/M3-M5.h" #endif diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index be5fe3d4f0..08265d8980 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_M0_M1(); extern void gcode_M3_M4(bool is_M3); extern void gcode_M5(); extern void gcode_M17(); @@ -413,7 +412,7 @@ void GcodeSuite::process_next_command() { #if HAS_RESUME_CONTINUE case 0: // M0: Unconditional stop - Wait for user button press on LCD case 1: // M1: Conditional stop - Wait for user button press on LCD - gcode_M0_M1(); + M0_M1(); break; #endif // ULTIPANEL diff --git a/Marlin/src/gcode/lcd/M0_M1.h b/Marlin/src/gcode/lcd/M0_M1.cpp similarity index 86% rename from Marlin/src/gcode/lcd/M0_M1.h rename to Marlin/src/gcode/lcd/M0_M1.cpp index c535be15e3..b09c2a9d55 100644 --- a/Marlin/src/gcode/lcd/M0_M1.h +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -20,13 +20,24 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if HAS_RESUME_CONTINUE + #include "../gcode.h" +#include "../../module/stepper.h" + +#if ENABLED(ULTIPANEL) + #include "../../lcd/ultralcd.h" +#endif + +#include "../../sd/cardreader.h" /** * M0: Unconditional stop - Wait for user button press on LCD * M1: Conditional stop - Wait for user button press on LCD */ -void gcode_M0_M1() { +void GcodeSuite::M0_M1() { const char * const args = parser.string_arg; millis_t ms = 0; @@ -64,10 +75,10 @@ void gcode_M0_M1() { wait_for_user = true; stepper.synchronize(); - gcode.refresh_cmd_timeout(); + refresh_cmd_timeout(); if (ms > 0) { - ms += gcode.previous_cmd_ms; // wait until this time for a click + ms += previous_cmd_ms; // wait until this time for a click while (PENDING(millis(), ms) && wait_for_user) idle(); } else { @@ -84,3 +95,5 @@ void gcode_M0_M1() { wait_for_user = false; KEEPALIVE_STATE(IN_HANDLER); } + +#endif // HAS_RESUME_CONTINUE