Browse Source

Move M428 to cpp

Scott Lahteine 8 years ago
parent
commit
aab5489962
3 changed files with 14 additions and 9 deletions
  1. 0
    4
      Marlin/src/Marlin.cpp
  2. 1
    4
      Marlin/src/gcode/gcode.cpp
  3. 13
    1
      Marlin/src/gcode/geometry/M428.cpp

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

@@ -359,10 +359,6 @@ void quickstop_stepper() {
359 359
   SYNC_PLAN_POSITION_KINEMATIC();
360 360
 }
361 361
 
362
-#if HAS_M206_COMMAND
363
-  #include "gcode/geometry/M428.h"
364
-#endif
365
-
366 362
 #include "gcode/eeprom/M500.h"
367 363
 #include "gcode/eeprom/M501.h"
368 364
 #include "gcode/eeprom/M502.h"

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

@@ -122,7 +122,6 @@ extern void gcode_M165();
122 122
 extern void gcode_M350();
123 123
 extern void gcode_M351();
124 124
 extern void gcode_M355();
125
-extern void gcode_M428();
126 125
 extern void gcode_M500();
127 126
 extern void gcode_M501();
128 127
 extern void gcode_M502();
@@ -631,9 +630,7 @@ void GcodeSuite::process_next_command() {
631 630
       #endif
632 631
 
633 632
       #if HAS_M206_COMMAND
634
-        case 428: // M428: Apply current_position to home_offset
635
-          gcode_M428();
636
-          break;
633
+        case 428: M428(); break;  // M428: Apply current_position to home_offset
637 634
       #endif
638 635
 
639 636
       case 500: // M500: Store settings in EEPROM

Marlin/src/gcode/geometry/M428.h → Marlin/src/gcode/geometry/M428.cpp View File

@@ -20,6 +20,16 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if HAS_M206_COMMAND
26
+
27
+#include "../gcode.h"
28
+#include "../../module/motion.h"
29
+#include "../../lcd/ultralcd.h"
30
+#include "../../libs/buzzer.h"
31
+#include "../../Marlin.h" // for axis_homed
32
+
23 33
 /**
24 34
  * M428: Set home_offset based on the distance between the
25 35
  *       current_position and the nearest "reference point."
@@ -31,7 +41,7 @@
31 41
  *
32 42
  *       Use M206 to set these values directly.
33 43
  */
34
-void gcode_M428() {
44
+void GcodeSuite::M428() {
35 45
   bool err = false;
36 46
   LOOP_XYZ(i) {
37 47
     if (axis_homed[i]) {
@@ -59,3 +69,5 @@ void gcode_M428() {
59 69
     BUZZ(100, 698);
60 70
   }
61 71
 }
72
+
73
+#endif // HAS_M206_COMMAND

Loading…
Cancel
Save