Edit hard limit check at start of homing cycle

This commit is contained in:
Sonny Jeon
2014-09-20 10:41:31 -06:00
parent 041109410a
commit 39cf822944
3 changed files with 8 additions and 7 deletions

View File

@@ -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;