From 8ac74d40171524eb50fd6dda9ef382f290f19b3e Mon Sep 17 00:00:00 2001 From: bdring Date: Tue, 24 Nov 2020 09:45:18 -0600 Subject: [PATCH] Fix Spindle State broken in earlier PR --- Grbl_Esp32/src/Spindles/PWMSpindle.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Grbl_Esp32/src/Spindles/PWMSpindle.cpp b/Grbl_Esp32/src/Spindles/PWMSpindle.cpp index 3b47c72d..3e71ee7b 100644 --- a/Grbl_Esp32/src/Spindles/PWMSpindle.cpp +++ b/Grbl_Esp32/src/Spindles/PWMSpindle.cpp @@ -155,7 +155,7 @@ namespace Spindles { return; // Block during abort. } - if (_current_state == SpindleState::Disable) { // Halt or set spindle direction and rpm. + if (state == SpindleState::Disable) { // Halt or set spindle direction and rpm. sys.spindle_speed = 0; stop(); if (use_delays && (_current_state != state)) { @@ -164,9 +164,9 @@ namespace Spindles { //grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "SpinDown Done"); } } else { - set_dir_pin(_current_state == SpindleState::Cw); + set_dir_pin(state == SpindleState::Cw); set_rpm(rpm); - set_enable_pin(_current_state != SpindleState::Disable); // must be done after setting rpm for enable features to work + set_enable_pin(state != SpindleState::Disable); // must be done after setting rpm for enable features to work if (use_delays && (_current_state != state)) { //grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "SpinUp Start %d", rpm); mc_dwell(spindle_delay_spinup->get());