Browse Source

Move M18_M84, M85 to cpp

Scott Lahteine 8 years ago
parent
commit
381b17e6a9

+ 2
- 6
Marlin/src/Marlin.cpp View File

@@ -170,8 +170,8 @@ volatile bool wait_for_heatup = true;
170 170
 #endif
171 171
 
172 172
 // Inactivity shutdown
173
-static millis_t max_inactive_time = 0;
174
-static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
173
+millis_t max_inactive_time = 0,
174
+         stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
175 175
 
176 176
 #if ENABLED(Z_DUAL_ENDSTOPS)
177 177
   float z_endstop_adj;
@@ -359,10 +359,6 @@ bool pin_is_protected(const int8_t pin) {
359 359
   return false;
360 360
 }
361 361
 
362
-#include "gcode/control/M18_M84.h"
363
-
364
-#include "gcode/control/M85.h"
365
-
366 362
 #include "gcode/config/M92.h"
367 363
 
368 364
 #if ENABLED(M100_FREE_MEMORY_WATCHER)

+ 3
- 0
Marlin/src/Marlin.h View File

@@ -185,6 +185,9 @@ extern volatile bool wait_for_heatup;
185 185
   linear_fit* lsf_linear_fit(double x[], double y[], double z[], const int);
186 186
 #endif
187 187
 
188
+// Inactivity shutdown timer
189
+extern millis_t max_inactive_time, stepper_inactive_time;
190
+
188 191
 #if ENABLED(Z_DUAL_ENDSTOPS)
189 192
   extern float z_endstop_adj;
190 193
 #endif

Marlin/src/gcode/control/M18_M84.h → Marlin/src/gcode/control/M18_M84.cpp View File

@@ -20,14 +20,19 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../gcode.h"
24
+#include "../../Marlin.h" // for stepper_inactive_time
25
+#include "../../module/stepper.h"
26
+
23 27
 #if ENABLED(AUTO_BED_LEVELING_UBL) && ENABLED(ULTRA_LCD)
24
-  extern bool defer_return_to_status;
28
+  #include "../../feature/bedlevel/bedlevel.h"
29
+  #include "../../lcd/ultralcd.h"
25 30
 #endif
26 31
 
27 32
 /**
28 33
  * M18, M84: Disable stepper motors
29 34
  */
30
-void gcode_M18_M84() {
35
+void GcodeSuite::M18_M84() {
31 36
   if (parser.seenval('S')) {
32 37
     stepper_inactive_time = parser.value_millis_from_seconds();
33 38
   }

Marlin/src/gcode/control/M85.h → Marlin/src/gcode/control/M85.cpp View File

@@ -20,12 +20,14 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../gcode.h"
24
+#include "../../Marlin.h" // for max_inactive_time
25
+
23 26
 /**
24 27
  * M85: Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
25 28
  */
26
-void gcode_M85() {
29
+void GcodeSuite::M85() {
27 30
 
28 31
   if (parser.seen('S')) max_inactive_time = parser.value_millis_from_seconds();
29 32
 
30 33
 }
31
-

+ 3
- 8
Marlin/src/gcode/gcode.cpp View File

@@ -116,8 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
116 116
 //
117 117
 // Placeholders for non-migrated codes
118 118
 //
119
-extern void gcode_M18_M84();
120
-extern void gcode_M85();
121 119
 extern void gcode_M92();
122 120
 extern void gcode_M100();
123 121
 extern void gcode_M114();
@@ -497,12 +495,9 @@ void GcodeSuite::process_next_command() {
497 495
       case 83: M83(); break;      // M83: Set E axis relative mode
498 496
 
499 497
       case 18: // M18 => M84
500
-      case 84: // M84: Disable all steppers or set timeout
501
-        gcode_M18_M84();
502
-        break;
503
-      case 85: // M85: Set inactivity stepper shutdown timeout
504
-        gcode_M85();
505
-        break;
498
+      case 84: M18_M84(); break;  // M84: Disable all steppers or set timeout
499
+      case 85: M85(); break;      // M85: Set inactivity stepper shutdown timeout
500
+
506 501
       case 92: // M92: Set the steps-per-unit for one or more axes
507 502
         gcode_M92();
508 503
         break;

+ 2
- 0
Marlin/src/lcd/ultralcd.h View File

@@ -80,6 +80,8 @@
80 80
 
81 81
   #if ENABLED(ULTIPANEL)
82 82
 
83
+    extern bool defer_return_to_status;
84
+
83 85
     // Function pointer to menu functions.
84 86
     typedef void (*screenFunc_t)();
85 87
 

Loading…
Cancel
Save