Edit hard limit check at start of homing cycle
This commit is contained in:
parent
041109410a
commit
39cf822944
1
gcode.h
1
gcode.h
@ -164,6 +164,7 @@ typedef struct {
|
||||
float spindle_speed; // RPM
|
||||
float feed_rate; // Millimeters/min
|
||||
uint8_t tool; // Tracks tool number. NOT USED.
|
||||
// int32_t line_number; // Last line number sent
|
||||
|
||||
float position[N_AXIS]; // Where the interpreter considers the tool to be at this point in the code
|
||||
|
||||
|
1
limits.c
1
limits.c
@ -122,6 +122,7 @@ void limits_disable()
|
||||
// mask, which prevents the stepper algorithm from executing step pulses. Homing motions typically
|
||||
// circumvent the processes for executing motions in normal operation.
|
||||
// NOTE: Only the abort runtime command can interrupt this process.
|
||||
// TODO: Move limit pin-specific calls to a general function for portability.
|
||||
void limits_go_home(uint8_t cycle_mask)
|
||||
{
|
||||
if (sys.abort) { return; } // Block if system reset has been issued.
|
||||
|
@ -240,13 +240,12 @@ void mc_dwell(float seconds)
|
||||
// executing the homing cycle. This prevents incorrect buffered plans after homing.
|
||||
void mc_homing_cycle()
|
||||
{
|
||||
uint8_t limits_on;
|
||||
if (bit_istrue(settings.flags,BITFLAG_INVERT_LIMIT_PINS)) {
|
||||
limits_on = ((~LIMIT_PIN) & LIMIT_MASK);
|
||||
} else {
|
||||
limits_on = (LIMIT_PIN & LIMIT_MASK);
|
||||
}
|
||||
if (limits_on) {
|
||||
// Check and abort homing cycle, if hard limits are already enabled. Helps prevent problems
|
||||
// with machines with limits wired on both ends of travel to one limit pin.
|
||||
// TODO: Move the pin-specific LIMIT_PIN call to limits.c as a function.
|
||||
uint8_t limit_state = (LIMIT_PIN & LIMIT_MASK);
|
||||
if (bit_isfalse(settings.flags,BITFLAG_INVERT_LIMIT_PINS)) { limit_state ^= LIMIT_MASK; }
|
||||
if (limit_state) {
|
||||
mc_reset(); // Issue system reset and ensure spindle and coolant are shutdown.
|
||||
bit_true_atomic(sys.execute, (EXEC_ALARM | EXEC_CRIT_EVENT)); // Indicate homing limit critical event
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user