diff --git a/Grbl_Esp32/Custom/atc.cpp b/Grbl_Esp32/Custom/atc.cpp index ca6df33b..e2fab435 100644 --- a/Grbl_Esp32/Custom/atc.cpp +++ b/Grbl_Esp32/Custom/atc.cpp @@ -94,7 +94,7 @@ void user_machine_init() { bool user_tool_change(uint8_t new_tool) { bool spindle_was_on = false; - bool was_incremental = false; // started in G91 mode + bool was_incremental_mode = false; // started in G91 mode uint64_t spindle_spin_delay; // used to make sure spindle has fully spun down and up. float saved_mpos[MAX_N_AXIS] = {}; // the position before the tool change @@ -111,10 +111,10 @@ bool user_tool_change(uint8_t new_tool) { protocol_buffer_synchronize(); // wait for all previous moves to complete system_convert_array_steps_to_mpos(saved_mpos, sys_position); // save current position so we can return to it - // see if we need to switch out of incremental mode + // see if we need to switch out of incremental (G91) mode if (gc_state.modal.distance == Distance::Incremental) { gc_exec_linef(false, "G90"); - was_incremental = true; + was_incremental_mode = true; } // is spindle on? Turn it off and determine when the spin down should be done. @@ -128,6 +128,7 @@ bool user_tool_change(uint8_t new_tool) { if (current_time < spindle_spin_delay) { vTaskDelay(spindle_spin_delay - current_time); } + } // ============= Start of tool change ==================== @@ -178,7 +179,7 @@ bool user_tool_change(uint8_t new_tool) { false, "G53G0X%0.3fY%0.3fZ%0.3f", saved_mpos[X_AXIS], saved_mpos[Y_AXIS], saved_mpos[Z_AXIS] + gc_state.tool_length_offset); } // was was_incremental on? If so, return to that state - if (was_incremental) { + if (was_incremental_mode) { gc_exec_linef(false, "G91"); } diff --git a/Grbl_Esp32/src/Machines/6_pack_5160_ATC_Carve.h b/Grbl_Esp32/src/Machines/6_pack_5160_ATC_Carve.h index 6a55a913..18d6dc49 100644 --- a/Grbl_Esp32/src/Machines/6_pack_5160_ATC_Carve.h +++ b/Grbl_Esp32/src/Machines/6_pack_5160_ATC_Carve.h @@ -102,8 +102,8 @@ #define COOLANT_MIST_PIN GPIO_NUM_13 //#define SPINDLE_OUTPUT_PIN GPIO_NUM_14 // relay as spindle on module socket #2 -#define DEFAULT_SPINDLE_DELAY_SPINUP 5.0 -#define DEFAULT_SPINDLE_DELAY_SPINDOWN 5.0 +#define DEFAULT_SPINDLE_DELAY_SPINUP 2.25 +#define DEFAULT_SPINDLE_DELAY_SPINDOWN 6.0 // diff --git a/Grbl_Esp32/src/Spindles/PWMSpindle.cpp b/Grbl_Esp32/src/Spindles/PWMSpindle.cpp index 53c87720..3b47c72d 100644 --- a/Grbl_Esp32/src/Spindles/PWMSpindle.cpp +++ b/Grbl_Esp32/src/Spindles/PWMSpindle.cpp @@ -155,8 +155,6 @@ namespace Spindles { return; // Block during abort. } - _current_state = state; - if (_current_state == SpindleState::Disable) { // Halt or set spindle direction and rpm. sys.spindle_speed = 0; stop();