Merge pull request #494 from ashelly/homing-alarm

Alarm if limits engaged on homing start.
This commit is contained in:
Sonny Jeon 2014-09-20 08:52:15 -06:00
commit 041109410a

View File

@ -240,6 +240,18 @@ void mc_dwell(float seconds)
// executing the homing cycle. This prevents incorrect buffered plans after homing. // executing the homing cycle. This prevents incorrect buffered plans after homing.
void mc_homing_cycle() 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) {
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;
}
sys.state = STATE_HOMING; // Set system state variable sys.state = STATE_HOMING; // Set system state variable
limits_disable(); // Disable hard limits pin change register for cycle duration limits_disable(); // Disable hard limits pin change register for cycle duration