Browse Source

Move M0_M1 to cpp

Scott Lahteine 6 years ago
parent
commit
04583d46af
3 changed files with 17 additions and 9 deletions
  1. 0
    4
      Marlin/src/Marlin.cpp
  2. 1
    2
      Marlin/src/gcode/gcode.cpp
  3. 16
    3
      Marlin/src/gcode/lcd/M0_M1.cpp

+ 0
- 4
Marlin/src/Marlin.cpp View File

@@ -357,10 +357,6 @@ void suicide() {
357 357
  ***************** GCode Handlers *****************
358 358
  **************************************************/
359 359
 
360
-#if HAS_RESUME_CONTINUE
361
-  #include "gcode/lcd/M0_M1.h"
362
-#endif
363
-
364 360
 #if ENABLED(SPINDLE_LASER_ENABLE)
365 361
   #include "gcode/control/M3-M5.h"
366 362
 #endif

+ 1
- 2
Marlin/src/gcode/gcode.cpp View File

@@ -116,7 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
116 116
 //
117 117
 // Placeholders for non-migrated codes
118 118
 //
119
-extern void gcode_M0_M1();
120 119
 extern void gcode_M3_M4(bool is_M3);
121 120
 extern void gcode_M5();
122 121
 extern void gcode_M17();
@@ -413,7 +412,7 @@ void GcodeSuite::process_next_command() {
413 412
       #if HAS_RESUME_CONTINUE
414 413
         case 0: // M0: Unconditional stop - Wait for user button press on LCD
415 414
         case 1: // M1: Conditional stop - Wait for user button press on LCD
416
-          gcode_M0_M1();
415
+          M0_M1();
417 416
           break;
418 417
       #endif // ULTIPANEL
419 418
 

Marlin/src/gcode/lcd/M0_M1.h → Marlin/src/gcode/lcd/M0_M1.cpp View File

@@ -20,13 +20,24 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if HAS_RESUME_CONTINUE
26
+
23 27
 #include "../gcode.h"
28
+#include "../../module/stepper.h"
29
+
30
+#if ENABLED(ULTIPANEL)
31
+  #include "../../lcd/ultralcd.h"
32
+#endif
33
+
34
+#include "../../sd/cardreader.h"
24 35
 
25 36
 /**
26 37
  * M0: Unconditional stop - Wait for user button press on LCD
27 38
  * M1: Conditional stop   - Wait for user button press on LCD
28 39
  */
29
-void gcode_M0_M1() {
40
+void GcodeSuite::M0_M1() {
30 41
   const char * const args = parser.string_arg;
31 42
 
32 43
   millis_t ms = 0;
@@ -64,10 +75,10 @@ void gcode_M0_M1() {
64 75
   wait_for_user = true;
65 76
 
66 77
   stepper.synchronize();
67
-  gcode.refresh_cmd_timeout();
78
+  refresh_cmd_timeout();
68 79
 
69 80
   if (ms > 0) {
70
-    ms += gcode.previous_cmd_ms;  // wait until this time for a click
81
+    ms += previous_cmd_ms;  // wait until this time for a click
71 82
     while (PENDING(millis(), ms) && wait_for_user) idle();
72 83
   }
73 84
   else {
@@ -84,3 +95,5 @@ void gcode_M0_M1() {
84 95
   wait_for_user = false;
85 96
   KEEPALIVE_STATE(IN_HANDLER);
86 97
 }
98
+
99
+#endif // HAS_RESUME_CONTINUE

Loading…
Cancel
Save