Overhauled state machine. New safety door feature.
- Overhauled the state machine and cleaned up its overall operation. This involved creating a new ‘suspend’ state for what all external commands, except real-time commands, are ignored. All hold type states enter this suspend state. - Removed ‘auto cycle start’ setting from Grbl. This was not used by users in its intended way and is somewhat redundant, as GUI manage the cycle start by streaming. It also muddled up how Grbl should interpret how and when to execute a g-code block. Removing it made everything much much simpler. - Fixed a program pause bug when used with other buffer_sync commands. - New safety door feature for OEMs. Immediately forces a feed hold and then de-energizes the machine. Resuming is blocked until the door is closed. When it is, it re-energizes the system and then resumes on the normal toolpath. - Safety door input pin is optional and uses the feed hold pin on A1. Enabled by config.h define. - Spindle and coolant re-energizing upon a safety door resume has a programmable delay time to allow for complete spin up to rpm and turning on the coolant before resuming motion. - Safety door-style feed holds can be used instead of regular feed hold (doesn’t de-energize the machine) with a ‘@‘ character. If the safety door input pin is not enabled, the system can be resumed at any time.
This commit is contained in:
@ -202,7 +202,11 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
st_prep_buffer(); // Check and prep segment buffer. NOTE: Should take no longer than 200us.
|
||||
// Check only for user reset. No time to run protocol_execute_realtime() in this loop.
|
||||
|
||||
if (sys.rt_exec_state & EXEC_RESET) { protocol_execute_realtime(); return; }
|
||||
if (sys.rt_exec_state & (EXEC_SAFETY_DOOR | EXEC_RESET)) { // Abort homing and alarm upon safety door.
|
||||
if (sys.rt_exec_state & EXEC_SAFETY_DOOR) { mc_reset(); }
|
||||
protocol_execute_realtime();
|
||||
return;
|
||||
}
|
||||
} while (STEP_MASK & axislock);
|
||||
|
||||
st_reset(); // Immediately force kill steppers and reset step segment buffer.
|
||||
@ -285,7 +289,7 @@ void limits_go_home(uint8_t cycle_mask)
|
||||
|
||||
// Initiate pull-off using main motion control routines.
|
||||
// TODO : Clean up state routines so that this motion still shows homing state.
|
||||
sys.state = STATE_QUEUED;
|
||||
sys.state = STATE_IDLE;
|
||||
bit_true_atomic(sys.rt_exec_state, EXEC_CYCLE_START);
|
||||
protocol_execute_realtime();
|
||||
protocol_buffer_synchronize(); // Complete pull-off motion.
|
||||
@ -326,7 +330,7 @@ void limits_soft_check(float *target)
|
||||
do {
|
||||
protocol_execute_realtime();
|
||||
if (sys.abort) { return; }
|
||||
} while ( sys.state != STATE_IDLE || sys.state != STATE_QUEUED);
|
||||
} while ( sys.state != STATE_IDLE );
|
||||
}
|
||||
|
||||
mc_reset(); // Issue system reset and ensure spindle and coolant are shutdown.
|
||||
|
Reference in New Issue
Block a user