Browse Source

Move M350_M351 to cpp

Scott Lahteine 7 years ago
parent
commit
59608086e6

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

@@ -358,11 +358,6 @@ void quickstop_stepper() {
358 358
   SYNC_PLAN_POSITION_KINEMATIC();
359 359
 }
360 360
 
361
-#if HAS_MICROSTEPS
362
-  #include "gcode/control/M350.h"
363
-  #include "gcode/control/M351.h"
364
-#endif
365
-
366 361
 #include "gcode/feature/caselight/M355.h"
367 362
 
368 363
 #if ENABLED(MIXING_EXTRUDER)

+ 0
- 33
Marlin/src/gcode/control/M350.h View File

@@ -1,33 +0,0 @@
1
-/**
2
- * Marlin 3D Printer Firmware
3
- * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
- *
5
- * Based on Sprinter and grbl.
6
- * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation, either version 3 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
-
23
-/**
24
- * M350: Set axis microstepping modes. S sets mode for all drivers.
25
- *
26
- * Warning: Steps-per-unit remains unchanged.
27
- */
28
-void gcode_M350() {
29
-  if (parser.seen('S')) for (int i = 0; i <= 4; i++) stepper.microstep_mode(i, parser.value_byte());
30
-  LOOP_XYZE(i) if (parser.seen(axis_codes[i])) stepper.microstep_mode(i, parser.value_byte());
31
-  if (parser.seen('B')) stepper.microstep_mode(4, parser.value_byte());
32
-  stepper.microstep_readings();
33
-}

Marlin/src/gcode/control/M351.h → Marlin/src/gcode/control/M350_M351.cpp View File

@@ -20,11 +20,30 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if HAS_MICROSTEPS
26
+
27
+#include "../gcode.h"
28
+#include "../../module/stepper.h"
29
+
30
+/**
31
+ * M350: Set axis microstepping modes. S sets mode for all drivers.
32
+ *
33
+ * Warning: Steps-per-unit remains unchanged.
34
+ */
35
+void GcodeSuite::M350() {
36
+  if (parser.seen('S')) for (uint8_t i = 0; i <= 4; i++) stepper.microstep_mode(i, parser.value_byte());
37
+  LOOP_XYZE(i) if (parser.seen(axis_codes[i])) stepper.microstep_mode(i, parser.value_byte());
38
+  if (parser.seen('B')) stepper.microstep_mode(4, parser.value_byte());
39
+  stepper.microstep_readings();
40
+}
41
+
23 42
 /**
24 43
  * M351: Toggle MS1 MS2 pins directly with axis codes X Y Z E B
25 44
  *       S# determines MS1 or MS2, X# sets the pin high/low.
26 45
  */
27
-void gcode_M351() {
46
+void GcodeSuite::M351() {
28 47
   if (parser.seenval('S')) switch (parser.value_byte()) {
29 48
     case 1:
30 49
       LOOP_XYZE(i) if (parser.seenval(axis_codes[i])) stepper.microstep_ms(i, parser.value_byte(), -1);
@@ -37,3 +56,5 @@ void gcode_M351() {
37 56
   }
38 57
   stepper.microstep_readings();
39 58
 }
59
+
60
+#endif // HAS_MICROSTEPS

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

@@ -119,8 +119,6 @@ void GcodeSuite::dwell(millis_t time) {
119 119
 extern void gcode_M163();
120 120
 extern void gcode_M164();
121 121
 extern void gcode_M165();
122
-extern void gcode_M350();
123
-extern void gcode_M351();
124 122
 extern void gcode_M355();
125 123
 extern void gcode_M999();
126 124
 extern void gcode_T(uint8_t tmp_extruder);
@@ -674,16 +672,9 @@ void GcodeSuite::process_next_command() {
674 672
       #endif
675 673
 
676 674
       #if HAS_MICROSTEPS
677
-
678
-        case 350: // M350: Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
679
-          gcode_M350();
680
-          break;
681
-
682
-        case 351: // M351: Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
683
-          gcode_M351();
684
-          break;
685
-
686
-      #endif // HAS_MICROSTEPS
675
+        case 350: M350(); break;    // M350: Set microstepping mode. Warning: Steps per unit remains unchanged. S code sets stepping mode for all drivers.
676
+        case 351: M351(); break;    // M351: Toggle MS1 MS2 pins directly, S# determines MS1 or MS2, X# sets the pin high/low.
677
+      #endif
687 678
 
688 679
       case 355: // M355 set case light brightness
689 680
         gcode_M355();

Loading…
Cancel
Save