Move M3-M5 to cpp
This commit is contained in:
parent
04583d46af
commit
33e00b6cd6
|
@ -357,10 +357,6 @@ void suicide() {
|
||||||
***************** GCode Handlers *****************
|
***************** GCode Handlers *****************
|
||||||
**************************************************/
|
**************************************************/
|
||||||
|
|
||||||
#if ENABLED(SPINDLE_LASER_ENABLE)
|
|
||||||
#include "gcode/control/M3-M5.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gcode/control/M17.h"
|
#include "gcode/control/M17.h"
|
||||||
|
|
||||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||||
|
|
|
@ -20,6 +20,13 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
|
#if ENABLED(SPINDLE_LASER_ENABLE)
|
||||||
|
|
||||||
|
#include "../gcode.h"
|
||||||
|
#include "../../module/stepper.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M3: Spindle Clockwise
|
* M3: Spindle Clockwise
|
||||||
* M4: Spindle Counter-clockwise
|
* M4: Spindle Counter-clockwise
|
||||||
|
@ -70,7 +77,7 @@ inline void ocr_val_mode() {
|
||||||
analogWrite(SPINDLE_LASER_PWM_PIN, spindle_laser_power);
|
analogWrite(SPINDLE_LASER_PWM_PIN, spindle_laser_power);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gcode_M3_M4(bool is_M3) {
|
void GcodeSuite::M3_M4(bool is_M3) {
|
||||||
|
|
||||||
stepper.synchronize(); // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle
|
stepper.synchronize(); // wait until previous movement commands (G0/G0/G2/G3) have completed before playing with the spindle
|
||||||
#if SPINDLE_DIR_CHANGE
|
#if SPINDLE_DIR_CHANGE
|
||||||
|
@ -120,8 +127,10 @@ void gcode_M3_M4(bool is_M3) {
|
||||||
/**
|
/**
|
||||||
* M5 turn off spindle
|
* M5 turn off spindle
|
||||||
*/
|
*/
|
||||||
void gcode_M5() {
|
void GcodeSuite::M5() {
|
||||||
stepper.synchronize();
|
stepper.synchronize();
|
||||||
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT);
|
WRITE(SPINDLE_LASER_ENABLE_PIN, !SPINDLE_LASER_ENABLE_INVERT);
|
||||||
delay_for_power_down();
|
delay_for_power_down();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // SPINDLE_LASER_ENABLE
|
|
@ -116,8 +116,6 @@ void GcodeSuite::dwell(millis_t time) {
|
||||||
//
|
//
|
||||||
// Placeholders for non-migrated codes
|
// Placeholders for non-migrated codes
|
||||||
//
|
//
|
||||||
extern void gcode_M3_M4(bool is_M3);
|
|
||||||
extern void gcode_M5();
|
|
||||||
extern void gcode_M17();
|
extern void gcode_M17();
|
||||||
extern void gcode_M18_M84();
|
extern void gcode_M18_M84();
|
||||||
extern void gcode_M20();
|
extern void gcode_M20();
|
||||||
|
@ -417,16 +415,12 @@ void GcodeSuite::process_next_command() {
|
||||||
#endif // ULTIPANEL
|
#endif // ULTIPANEL
|
||||||
|
|
||||||
#if ENABLED(SPINDLE_LASER_ENABLE)
|
#if ENABLED(SPINDLE_LASER_ENABLE)
|
||||||
case 3:
|
// These synchronize with movement commands...
|
||||||
gcode_M3_M4(true); // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW
|
case 3: M3_M4(true ); break; // M3: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CW
|
||||||
break; // synchronizes with movement commands
|
case 4: M3_M4(false); break; // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW
|
||||||
case 4:
|
case 5: M5(); break; // M5 - turn spindle/laser off
|
||||||
gcode_M3_M4(false); // M4: turn spindle/laser on, set laser/spindle power/speed, set rotation direction CCW
|
|
||||||
break; // synchronizes with movement commands
|
|
||||||
case 5:
|
|
||||||
gcode_M5(); // M5 - turn spindle/laser off
|
|
||||||
break; // synchronizes with movement commands
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case 17: // M17: Enable all stepper motors
|
case 17: // M17: Enable all stepper motors
|
||||||
gcode_M17();
|
gcode_M17();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue