1
0
mirror of https://github.com/bdring/Grbl_Esp32.git synced 2025-09-03 03:13:25 +02:00
This commit is contained in:
bdring
2020-11-23 16:17:06 -06:00
parent da29a6c8cf
commit 4859b952b1
2 changed files with 27 additions and 10 deletions

View File

@@ -62,11 +62,13 @@ bool atc_ETS();
bool set_ATC_open(bool open); bool set_ATC_open(bool open);
void gc_exec_linef(bool sync_after, const char* format, ...); void gc_exec_linef(bool sync_after, const char* format, ...);
bool atc_manual_change(); bool atc_manual_change();
bool atc_ETS_dustoff();
void user_machine_init() { void user_machine_init() {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "ATC Machine Init"); grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "ATC Machine Init");
pinMode(ATC_RELEASE_PIN, OUTPUT); pinMode(ATC_RELEASE_PIN, OUTPUT);
pinMode(ETS_DUST_OFF, OUTPUT);
// the tool setter // the tool setter
tool[ETS_INDEX].mpos[X_AXIS] = 108; tool[ETS_INDEX].mpos[X_AXIS] = 108;
@@ -93,10 +95,10 @@ void user_machine_init() {
} }
bool user_tool_change(uint8_t new_tool) { bool user_tool_change(uint8_t new_tool) {
bool spindle_was_on = false; bool spindle_was_on = false;
bool was_incremental_mode = 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. 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 float saved_mpos[MAX_N_AXIS] = {}; // the position before the tool change
if (new_tool == current_tool) { // if no change, we are done if (new_tool == current_tool) { // if no change, we are done
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "ATC existing tool requested:%d", new_tool); grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "ATC existing tool requested:%d", new_tool);
@@ -128,7 +130,6 @@ bool user_tool_change(uint8_t new_tool) {
if (current_time < spindle_spin_delay) { if (current_time < spindle_spin_delay) {
vTaskDelay(spindle_spin_delay - current_time); vTaskDelay(spindle_spin_delay - current_time);
} }
} }
// ============= Start of tool change ==================== // ============= Start of tool change ====================
@@ -269,6 +270,8 @@ bool atc_ETS() {
gc_exec_linef(true, "G53G0X%0.3fY%0.3f", tool[ETS_INDEX].mpos[X_AXIS], tool[ETS_INDEX].mpos[Y_AXIS]); gc_exec_linef(true, "G53G0X%0.3fY%0.3f", tool[ETS_INDEX].mpos[X_AXIS], tool[ETS_INDEX].mpos[Y_AXIS]);
} }
atc_ETS_dustoff();
float wco = gc_state.coord_system[Z_AXIS] + gc_state.coord_offset[Z_AXIS] + gc_state.tool_length_offset; float wco = gc_state.coord_system[Z_AXIS] + gc_state.coord_offset[Z_AXIS] + gc_state.tool_length_offset;
probe_to = tool[ETS_INDEX].mpos[Z_AXIS] - wco; probe_to = tool[ETS_INDEX].mpos[Z_AXIS] - wco;
@@ -279,7 +282,11 @@ bool atc_ETS() {
// Was probe successful? // Was probe successful?
if (sys.state == State::Alarm) { if (sys.state == State::Alarm) {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "ATC Missing Tool?"); if (sys_rt_exec_alarm == ExecAlarm::ProbeFailInitial) {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "ATC Probe Switch Error");
} else {
grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "ATC Missing Tool?");
}
return false; // fail return false; // fail
} }
@@ -310,6 +317,13 @@ bool set_ATC_open(bool open) {
return true; return true;
} }
// give a squirt of air to clear top of Tool Setter
bool atc_ETS_dustoff() {
digitalWrite(ETS_DUST_OFF, HIGH);
gc_exec_linef(true, "G4P%0.2f", 0.250);
digitalWrite(ETS_DUST_OFF, LOW);
}
bool atc_manual_change() { bool atc_manual_change() {
// if (gc_state.modal.spindle != SpindleState::Disable) { // if (gc_state.modal.spindle != SpindleState::Disable) {
// grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Cannot use ATC with spindle on"); // grbl_msg_sendf(CLIENT_SERIAL, MsgLevel::Info, "Cannot use ATC with spindle on");

View File

@@ -96,10 +96,13 @@
#endif #endif
#define INVERT_CONTROL_PIN_MASK B0 #define INVERT_CONTROL_PIN_MASK B0
// 5V output CNC module in socket #4 // Quad MOSFET module on socket #4
// https://github.com/bdring/6-Pack_CNC_Controller/wiki/4x-5V-Buffered-Output-Module // https://github.com/bdring/6-Pack_CNC_Controller/wiki/Quad-MOSFET-Module
#define ATC_RELEASE_PIN GPIO_NUM_14 #define ATC_RELEASE_PIN GPIO_NUM_14
#define COOLANT_MIST_PIN GPIO_NUM_13 #define ATC_DUST_OFF GPIO_NUM_13
#define ETS_DUST_OFF GPIO_NUM_15
// GPIO_NUM_12
//#define SPINDLE_OUTPUT_PIN GPIO_NUM_14 // relay as spindle on module socket #2 //#define SPINDLE_OUTPUT_PIN GPIO_NUM_14 // relay as spindle on module socket #2
#define DEFAULT_SPINDLE_DELAY_SPINUP 2.25 #define DEFAULT_SPINDLE_DELAY_SPINUP 2.25