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

@ -164,6 +164,7 @@ typedef struct {
float spindle_speed; // RPM float spindle_speed; // RPM
float feed_rate; // Millimeters/min float feed_rate; // Millimeters/min
uint8_t tool; // Tracks tool number. NOT USED. 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 float position[N_AXIS]; // Where the interpreter considers the tool to be at this point in the code

View File

@ -122,6 +122,7 @@ void limits_disable()
// mask, which prevents the stepper algorithm from executing step pulses. Homing motions typically // mask, which prevents the stepper algorithm from executing step pulses. Homing motions typically
// circumvent the processes for executing motions in normal operation. // circumvent the processes for executing motions in normal operation.
// NOTE: Only the abort runtime command can interrupt this process. // 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) void limits_go_home(uint8_t cycle_mask)
{ {
if (sys.abort) { return; } // Block if system reset has been issued. if (sys.abort) { return; } // Block if system reset has been issued.

View File

@ -240,13 +240,12 @@ 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; // Check and abort homing cycle, if hard limits are already enabled. Helps prevent problems
if (bit_istrue(settings.flags,BITFLAG_INVERT_LIMIT_PINS)) { // with machines with limits wired on both ends of travel to one limit pin.
limits_on = ((~LIMIT_PIN) & LIMIT_MASK); // TODO: Move the pin-specific LIMIT_PIN call to limits.c as a function.
} else { uint8_t limit_state = (LIMIT_PIN & LIMIT_MASK);
limits_on = (LIMIT_PIN & LIMIT_MASK); if (bit_isfalse(settings.flags,BITFLAG_INVERT_LIMIT_PINS)) { limit_state ^= LIMIT_MASK; }
} if (limit_state) {
if (limits_on) {
mc_reset(); // Issue system reset and ensure spindle and coolant are shutdown. 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 bit_true_atomic(sys.execute, (EXEC_ALARM | EXEC_CRIT_EVENT)); // Indicate homing limit critical event
return; return;