Browse Source

Move M666 to cpp

Scott Lahteine 8 years ago
parent
commit
6c7bad8bc3
3 changed files with 18 additions and 12 deletions
  1. 0
    4
      Marlin/src/Marlin.cpp
  2. 17
    4
      Marlin/src/gcode/calibrate/M666.cpp
  3. 1
    4
      Marlin/src/gcode/gcode.cpp

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

@@ -355,10 +355,6 @@ bool pin_is_protected(const int8_t pin) {
355 355
   return false;
356 356
 }
357 357
 
358
-#if ENABLED(DELTA) || ENABLED(Z_DUAL_ENDSTOPS)
359
-  #include "gcode/calibrate/M666.h"
360
-#endif
361
-
362 358
 #include "gcode/control/M211.h"
363 359
 
364 360
 #include "gcode/config/M220.h"

Marlin/src/gcode/calibrate/M666.h → Marlin/src/gcode/calibrate/M666.cpp View File

@@ -20,15 +20,24 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(DELTA) || ENABLED(Z_DUAL_ENDSTOPS)
26
+
27
+#include "../gcode.h"
28
+
23 29
 #if ENABLED(DELTA)
24 30
 
31
+  #include "../../module/delta.h"
32
+  #include "../../module/motion.h"
33
+
25 34
   /**
26 35
    * M666: Set delta endstop adjustment
27 36
    */
28
-  void gcode_M666() {
37
+  void GcodeSuite::M666() {
29 38
     #if ENABLED(DEBUG_LEVELING_FEATURE)
30 39
       if (DEBUGGING(LEVELING)) {
31
-        SERIAL_ECHOLNPGM(">>> gcode_M666");
40
+        SERIAL_ECHOLNPGM(">>> M666");
32 41
       }
33 42
     #endif
34 43
     LOOP_XYZ(i) {
@@ -44,7 +53,7 @@
44 53
     }
45 54
     #if ENABLED(DEBUG_LEVELING_FEATURE)
46 55
       if (DEBUGGING(LEVELING)) {
47
-        SERIAL_ECHOLNPGM("<<< gcode_M666");
56
+        SERIAL_ECHOLNPGM("<<< M666");
48 57
       }
49 58
     #endif
50 59
     // normalize endstops so all are <=0; set the residue to delta height
@@ -55,12 +64,16 @@
55 64
 
56 65
 #elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
57 66
 
67
+  #include "../../Marlin.h" // for z_endstop_adj
68
+
58 69
   /**
59 70
    * M666: For Z Dual Endstop setup, set z axis offset to the z2 axis.
60 71
    */
61
-  void gcode_M666() {
72
+  void GcodeSuite::M666() {
62 73
     if (parser.seen('Z')) z_endstop_adj = parser.value_linear_units();
63 74
     SERIAL_ECHOLNPAIR("Z Endstop Adjustment set to (mm):", z_endstop_adj);
64 75
   }
65 76
 
66 77
 #endif
78
+
79
+#endif // DELTA || Z_DUAL_ENDSTOPS

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

@@ -151,7 +151,6 @@ extern void gcode_M502();
151 151
 extern void gcode_M503();
152 152
 extern void gcode_M540();
153 153
 extern void gcode_M605();
154
-extern void gcode_M666();
155 154
 extern void gcode_M702();
156 155
 extern void gcode_M900();
157 156
 extern void gcode_M906();
@@ -544,9 +543,7 @@ void GcodeSuite::process_next_command() {
544 543
       #endif
545 544
 
546 545
       #if ENABLED(DELTA) || ENABLED(Z_DUAL_ENDSTOPS)
547
-        case 666: // M666: Set delta or dual endstop adjustment
548
-          gcode_M666();
549
-          break;
546
+        case 666: M666(); break;  // M666: Set delta or dual endstop adjustment
550 547
       #endif
551 548
 
552 549
       #if ENABLED(FWRETRACT)

Loading…
Cancel
Save