Further cleanup of G28 for probes

2.0.x
AnHardt 9 years ago committed by Scott Lahteine
parent 39883d03fc
commit e480ee0054

@ -1713,10 +1713,7 @@ static void clean_up_after_endstop_or_probe_move() {
z_dest -= zprobe_zoffset; z_dest -= zprobe_zoffset;
if (z_dest > current_position[Z_AXIS]) { if (z_dest > current_position[Z_AXIS]) {
float old_feedrate = feedrate;
feedrate = homing_feedrate[Z_AXIS];
do_blocking_move_to_z(z_dest); do_blocking_move_to_z(z_dest);
feedrate = old_feedrate;
} }
} }
@ -1795,9 +1792,7 @@ static void clean_up_after_endstop_or_probe_move() {
if (endstops.z_probe_enabled) return; if (endstops.z_probe_enabled) return;
// Make room for probe // Make room for probe
#if _Z_RAISE_PROBE_DEPLOY_STOW > 0 do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
#endif
#if ENABLED(Z_PROBE_SLED) #if ENABLED(Z_PROBE_SLED)
@ -1899,9 +1894,7 @@ static void clean_up_after_endstop_or_probe_move() {
if (!endstops.z_probe_enabled) return; if (!endstops.z_probe_enabled) return;
// Make more room for the servo // Make more room for the servo
#if _Z_RAISE_PROBE_DEPLOY_STOW > 0 do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
do_probe_raise(_Z_RAISE_PROBE_DEPLOY_STOW);
#endif
#if ENABLED(Z_PROBE_SLED) #if ENABLED(Z_PROBE_SLED)
@ -2839,28 +2832,33 @@ inline void gcode_G28() {
#elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0 #elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
// Raise Z before homing any other axes and z is not already high enough (never lower z) #if HAS_BED_PROBE
if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) { do_probe_raise(MIN_Z_HEIGHT_FOR_HOMING);
destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING; destination[Z_AXIS] = current_position[Z_AXIS];
feedrate = planner.max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s) #else
#if ENABLED(DEBUG_LEVELING_FEATURE) // Raise Z before homing any other axes and z is not already high enough (never lower z)
if (DEBUGGING(LEVELING)) { if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING)); destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
SERIAL_EOL; feedrate = planner.max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
DEBUG_POS("> (home_all_axis || homeZ)", current_position); #if ENABLED(DEBUG_LEVELING_FEATURE)
DEBUG_POS("> (home_all_axis || homeZ)", destination); if (DEBUGGING(LEVELING)) {
} SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
#endif SERIAL_EOL;
line_to_destination(); DEBUG_POS("> (home_all_axis || homeZ)", current_position);
stepper.synchronize(); DEBUG_POS("> (home_all_axis || homeZ)", destination);
}
#endif
line_to_destination();
stepper.synchronize();
/** /**
* Update the current Z position even if it currently not real from * Update the current Z position even if it currently not real from
* Z-home otherwise each call to line_to_destination() will want to * Z-home otherwise each call to line_to_destination() will want to
* move Z-axis by MIN_Z_HEIGHT_FOR_HOMING. * move Z-axis by MIN_Z_HEIGHT_FOR_HOMING.
*/ */
current_position[Z_AXIS] = destination[Z_AXIS]; current_position[Z_AXIS] = destination[Z_AXIS];
} }
#endif
#endif #endif
#if ENABLED(QUICK_HOME) #if ENABLED(QUICK_HOME)
@ -2917,7 +2915,12 @@ inline void gcode_G28() {
#if ENABLED(HOME_Y_BEFORE_X) #if ENABLED(HOME_Y_BEFORE_X)
// Home Y // Home Y
if (home_all_axis || homeY) HOMEAXIS(Y); if (home_all_axis || homeY) {
HOMEAXIS(Y);
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
#endif
}
#endif #endif
// Home X // Home X

Loading…
Cancel
Save