From eaad780820a0132aef87a02b0ca5fc82810a4b64 Mon Sep 17 00:00:00 2001 From: bdring Date: Sat, 8 Dec 2018 14:08:37 -0600 Subject: [PATCH] fixed M4 mode. M4 is now Supported if SPINDLE_DIR_PIN is defined or laser mode is on. --- Grbl_Esp32/gcode.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Grbl_Esp32/gcode.cpp b/Grbl_Esp32/gcode.cpp index 7f92e72f..7c25361c 100644 --- a/Grbl_Esp32/gcode.cpp +++ b/Grbl_Esp32/gcode.cpp @@ -264,15 +264,19 @@ uint8_t gc_execute_line(char *line, uint8_t client) switch(int_value) { case 3: gc_block.modal.spindle = SPINDLE_ENABLE_CW; - break; - case 4: - #ifdef SPINDLE_DIR_PIN - gc_block.modal.spindle = SPINDLE_ENABLE_CCW; - #else - FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); + break; + case 4: // Supported if SPINDLE_DIR_PIN is defined or laser mode is on. + #ifndef SPINDLE_DIR_PIN + // if laser mode is not on then this is an unsupported command + if bit_isfalse(settings.flags,BITFLAG_LASER_MODE) { + FAIL(STATUS_GCODE_UNSUPPORTED_COMMAND); + break; + } #endif - break; - case 5: gc_block.modal.spindle = SPINDLE_DISABLE; break; + gc_block.modal.spindle = SPINDLE_ENABLE_CCW; + break; + case 5: + gc_block.modal.spindle = SPINDLE_DISABLE; break; } break; case 7: case 8: case 9: