Hard limits, homing direction, pull-off limits after homing, status reports in mm or inches, system alarm, and more.
- Thank you statement added for Alden Hart of Synthetos. - Hard limits option added, which also works with homing by pulling off the switches to help prevent unintended triggering. Hard limits use a interrupt to sense a falling edge pin change and immediately go into alarm mode, which stops everything and forces the user to issue a reset (Ctrl-x) or reboot. - Auto cycle start now a configuration option. - Alarm mode: A new method to kill all Grbl processes in the event of something catastrophic or potentially catastropic. Just works with hard limits for now, but will be expanded to include g-code errors (most likely) and other events. - Updated status reports to be configurable in inches or mm mode. Much more to do here, but this is the first step. - New settings: auto cycle start, hard limit enable, homing direction mask (which works the same as the stepper mask), homing pulloff distance (or distance traveled from homed machine zero to prevent accidental limit trip). - Minor memory liberation and calculation speed ups.
This commit is contained in:
@ -196,9 +196,30 @@ void mc_dwell(float seconds)
|
||||
// Execute homing cycle to locate and set machine zero.
|
||||
void mc_go_home()
|
||||
{
|
||||
limits_go_home();
|
||||
plan_synchronize(); // Empty all motions in buffer before homing.
|
||||
PCICR &= ~(1 << LIMIT_INT); // Disable hard limits pin change interrupt
|
||||
|
||||
limits_go_home(); // Perform homing routine.
|
||||
|
||||
// Upon completion, reset all internal position vectors (g-code parser, planner, system)
|
||||
gc_clear_position();
|
||||
plan_clear_position();
|
||||
clear_vector_float(sys.position);
|
||||
|
||||
// If hard limits enabled, move all axes off limit switches before enabling the hard limit
|
||||
// pin change interrupt. This should help prevent the switches from falsely tripping.
|
||||
// NOTE: G-code parser was circumvented so its position needs to be updated explicitly.
|
||||
if (bit_istrue(settings.flags,BITFLAG_HARD_LIMIT_ENABLE)) {
|
||||
int8_t x_dir, y_dir, z_dir;
|
||||
x_dir = y_dir = z_dir = 1;
|
||||
if (bit_istrue(settings.homing_dir_mask,bit(X_DIRECTION_BIT))) { x_dir = -1; }
|
||||
if (bit_istrue(settings.homing_dir_mask,bit(Y_DIRECTION_BIT))) { y_dir = -1; }
|
||||
if (bit_istrue(settings.homing_dir_mask,bit(Z_DIRECTION_BIT))) { z_dir = -1; }
|
||||
mc_line(x_dir*settings.homing_pulloff, y_dir*settings.homing_pulloff,
|
||||
z_dir*settings.homing_pulloff, settings.homing_feed_rate, false);
|
||||
st_cycle_start(); // Nothing should be in the buffer except this motion.
|
||||
plan_synchronize(); // Make sure the motion completes.
|
||||
gc_set_current_position(sys.position[X_AXIS],sys.position[Y_AXIS],sys.position[Z_AXIS]);
|
||||
PCICR |= (1 << LIMIT_INT); // Re-enable hard limits.
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user