Browse Source

Move M3-M5 to cpp

Scott Lahteine 7 years ago
parent
commit
33e00b6cd6
3 changed files with 18 additions and 19 deletions
  1. 0
    4
      Marlin/src/Marlin.cpp
  2. 13
    4
      Marlin/src/gcode/control/M3-M5.cpp
  3. 5
    11
      Marlin/src/gcode/gcode.cpp

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

357
  ***************** GCode Handlers *****************
357
  ***************** GCode Handlers *****************
358
  **************************************************/
358
  **************************************************/
359
 
359
 
360
-#if ENABLED(SPINDLE_LASER_ENABLE)
361
-  #include "gcode/control/M3-M5.h"
362
-#endif
363
-
364
 #include "gcode/control/M17.h"
360
 #include "gcode/control/M17.h"
365
 
361
 
366
 #if ENABLED(ADVANCED_PAUSE_FEATURE)
362
 #if ENABLED(ADVANCED_PAUSE_FEATURE)

Marlin/src/gcode/control/M3-M5.h → Marlin/src/gcode/control/M3-M5.cpp View File

20
  *
20
  *
21
  */
21
  */
22
 
22
 
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if ENABLED(SPINDLE_LASER_ENABLE)
26
+
27
+#include "../gcode.h"
28
+#include "../../module/stepper.h"
29
+
23
 /**
30
 /**
24
  * M3: Spindle Clockwise
31
  * M3: Spindle Clockwise
25
  * M4: Spindle Counter-clockwise
32
  * M4: Spindle Counter-clockwise
70
   analogWrite(SPINDLE_LASER_PWM_PIN, spindle_laser_power);
77
   analogWrite(SPINDLE_LASER_PWM_PIN, spindle_laser_power);
71
 }
78
 }
72
 
79
 
73
-void gcode_M3_M4(bool is_M3) {
80
+void GcodeSuite::M3_M4(bool is_M3) {
74
 
81
 
75
   stepper.synchronize();   // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle
82
   stepper.synchronize();   // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle
76
   #if SPINDLE_DIR_CHANGE
83
   #if SPINDLE_DIR_CHANGE
118
 }
125
 }
119
 
126
 
120
 /**
127
 /**
121
-* M5 turn off spindle
122
-*/
123
-void gcode_M5() {
128
+ * M5 turn off spindle
129
+ */
130
+void GcodeSuite::M5() {
124
   stepper.synchronize();
131
   stepper.synchronize();
125
   WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT);
132
   WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT);
126
   delay_for_power_down();
133
   delay_for_power_down();
127
 }
134
 }
135
+
136
+#endif // SPINDLE_LASER_ENABLE

+ 5
- 11
Marlin/src/gcode/gcode.cpp View File

116
 //
116
 //
117
 // Placeholders for non-migrated codes
117
 // Placeholders for non-migrated codes
118
 //
118
 //
119
-extern void gcode_M3_M4(bool is_M3);
120
-extern void gcode_M5();
121
 extern void gcode_M17();
119
 extern void gcode_M17();
122
 extern void gcode_M18_M84();
120
 extern void gcode_M18_M84();
123
 extern void gcode_M20();
121
 extern void gcode_M20();
417
       #endif // ULTIPANEL
415
       #endif // ULTIPANEL
418
 
416
 
419
       #if ENABLED(SPINDLE_LASER_ENABLE)
417
       #if ENABLED(SPINDLE_LASER_ENABLE)
420
-        case 3:
421
-          gcode_M3_M4(true);   // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW
422
-          break;               // synchronizes with movement commands
423
-        case 4:
424
-          gcode_M3_M4(false);  // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW
425
-          break;               // synchronizes with movement commands
426
-        case 5:
427
-          gcode_M5();     // M5 - turn spindle/laser off
428
-          break;          // synchronizes with movement commands
418
+        // These synchronize with movement commands...
419
+        case 3: M3_M4(true ); break;  // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW
420
+        case 4: M3_M4(false); break;  // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW
421
+        case 5: M5(); break;          // M5 - turn spindle/laser off
429
       #endif
422
       #endif
423
+
430
       case 17: // M17: Enable all stepper motors
424
       case 17: // M17: Enable all stepper motors
431
         gcode_M17();
425
         gcode_M17();
432
         break;
426
         break;

Loading…
Cancel
Save