Move M0_M1 to cpp

This commit is contained in:
Scott Lahteine 2017-09-16 01:00:31 -05:00
parent 04376975ce
commit 04583d46af
3 changed files with 17 additions and 9 deletions

View file

@ -357,10 +357,6 @@ void suicide() {
***************** GCode Handlers ***************** ***************** GCode Handlers *****************
**************************************************/ **************************************************/
#if HAS_RESUME_CONTINUE
#include "gcode/lcd/M0_M1.h"
#endif
#if ENABLED(SPINDLE_LASER_ENABLE) #if ENABLED(SPINDLE_LASER_ENABLE)
#include "gcode/control/M3-M5.h" #include "gcode/control/M3-M5.h"
#endif #endif

View file

@ -116,7 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
// //
// Placeholders for non-migrated codes // Placeholders for non-migrated codes
// //
extern void gcode_M0_M1();
extern void gcode_M3_M4(bool is_M3); extern void gcode_M3_M4(bool is_M3);
extern void gcode_M5(); extern void gcode_M5();
extern void gcode_M17(); extern void gcode_M17();
@ -413,7 +412,7 @@ void GcodeSuite::process_next_command() {
#if HAS_RESUME_CONTINUE #if HAS_RESUME_CONTINUE
case 0: // M0: Unconditional stop - Wait for user button press on LCD case 0: // M0: Unconditional stop - Wait for user button press on LCD
case 1: // M1: Conditional 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; break;
#endif // ULTIPANEL #endif // ULTIPANEL

View file

@ -20,13 +20,24 @@
* *
*/ */
#include "../../inc/MarlinConfig.h"
#if HAS_RESUME_CONTINUE
#include "../gcode.h" #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 * M0: Unconditional stop - Wait for user button press on LCD
* M1: Conditional 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; const char * const args = parser.string_arg;
millis_t ms = 0; millis_t ms = 0;
@ -64,10 +75,10 @@ void gcode_M0_M1() {
wait_for_user = true; wait_for_user = true;
stepper.synchronize(); stepper.synchronize();
gcode.refresh_cmd_timeout(); refresh_cmd_timeout();
if (ms > 0) { 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(); while (PENDING(millis(), ms) && wait_for_user) idle();
} }
else { else {
@ -84,3 +95,5 @@ void gcode_M0_M1() {
wait_for_user = false; wait_for_user = false;
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
} }
#endif // HAS_RESUME_CONTINUE