Ensble/disable hardware endstops in G28 globally.

For moving away from the endstops we do not have to disable them.
They are not tested anyway.
This commit is contained in:
AnHardt 2016-07-08 15:49:10 +02:00
parent f69434d81c
commit eff7912243

View File

@ -2390,21 +2390,11 @@ static void homeaxis(AxisEnum axis) {
current_position[axis] = 0; current_position[axis] = 0;
sync_plan_position(); sync_plan_position();
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
#endif
endstops.enable(false); // Disable endstops while moving away
// Move away from the endstop by the axis HOME_BUMP_MM // Move away from the endstop by the axis HOME_BUMP_MM
destination[axis] = -home_bump_mm(axis) * axis_home_dir; destination[axis] = -home_bump_mm(axis) * axis_home_dir;
line_to_destination(); line_to_destination();
stepper.synchronize(); stepper.synchronize();
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)");
#endif
endstops.enable(true); // Enable endstops for next homing move
// Slow down the feedrate for the next move // Slow down the feedrate for the next move
set_homing_bump_feedrate(axis); set_homing_bump_feedrate(axis);
@ -2445,10 +2435,6 @@ static void homeaxis(AxisEnum axis) {
#if ENABLED(DELTA) #if ENABLED(DELTA)
// retrace by the amount specified in endstop_adj // retrace by the amount specified in endstop_adj
if (endstop_adj[axis] * axis_home_dir < 0) { if (endstop_adj[axis] * axis_home_dir < 0) {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(false)");
#endif
endstops.enable(false); // Disable endstops while moving away
sync_plan_position(); sync_plan_position();
destination[axis] = endstop_adj[axis]; destination[axis] = endstop_adj[axis];
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
@ -2459,19 +2445,7 @@ static void homeaxis(AxisEnum axis) {
#endif #endif
line_to_destination(); line_to_destination();
stepper.synchronize(); stepper.synchronize();
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)");
#endif
endstops.enable(true); // Enable endstops for next homing move
} }
#if ENABLED(DEBUG_LEVELING_FEATURE)
else {
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("> endstop_adj * axis_home_dir = ", endstop_adj[axis] * axis_home_dir);
SERIAL_EOL;
}
}
#endif
#endif #endif
// Set the axis position to its home position (plus home offsets) // Set the axis position to its home position (plus home offsets)
@ -2840,7 +2814,11 @@ inline void gcode_G28() {
#endif #endif
setup_for_endstop_or_probe_move(); setup_for_endstop_or_probe_move();
endstops.enable(); #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.enable(true)");
#endif
endstops.enable(true); // Enable endstops for next homing move
#if ENABLED(DELTA) #if ENABLED(DELTA)
/** /**
@ -3061,7 +3039,11 @@ inline void gcode_G28() {
#endif // !DELTA (gcode_G28) #endif // !DELTA (gcode_G28)
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> endstops.not_homing()");
#endif
endstops.not_homing(); endstops.not_homing();
endstops.hit_on_purpose(); // clear endstop hit flags
// Enable mesh leveling again // Enable mesh leveling again
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
@ -3101,8 +3083,6 @@ inline void gcode_G28() {
clean_up_after_endstop_or_probe_move(); clean_up_after_endstop_or_probe_move();
endstops.hit_on_purpose(); // clear endstop hit flags
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G28"); if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< gcode_G28");
#endif #endif