Homing and limit updates. Minor bug fixes.

- Updated new homing cycle to error out when a pull-off motion detects
the limit is still active.

- Created a limits_get_state() function to centralize it. It reports
state as a bit-wise booleans according to axis numbering.

- Updated the print uint8 functions. Generalized it to allow both base2
and base10 printouts, while allowing base2 prints with N_AXIS digits
for limit state status reports. Doing this saved about 100bytes of
flash as well.

- Applied CoreXY status reporting bug fix by @phd0. Thanks!
This commit is contained in:
Sonny Jeon
2015-05-23 11:57:30 -06:00
parent e704862f11
commit f85c481ded
10 changed files with 172 additions and 70 deletions

View File

@ -225,9 +225,7 @@ void mc_homing_cycle()
// 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.
#ifdef LIMITS_TWO_SWITCHES_ON_AXES
uint8_t limit_state = (LIMIT_PIN & LIMIT_MASK);
if (bit_isfalse(settings.flags,BITFLAG_INVERT_LIMIT_PINS)) { limit_state ^= LIMIT_MASK; }
if (limit_state) {
if (limits_get_state()) {
mc_reset(); // Issue system reset and ensure spindle and coolant are shutdown.
bit_true_atomic(sys.rt_exec_alarm, (EXEC_ALARM_HARD_LIMIT|EXEC_CRITICAL_EVENT));
return;
@ -256,7 +254,7 @@ void mc_homing_cycle()
// Gcode parser position was circumvented by the limits_go_home() routine, so sync position now.
gc_sync_position();
// If hard limits feature enabled, re-enable hard limits pin change register after homing cycle.
limits_init();
}