Merge pull request #4217 from thinkyhead/rc_fix_homing_raise

Don't do_probe_raise with MIN_Z_HEIGHT_FOR_HOMING
This commit is contained in:
Scott Lahteine 2016-07-06 14:39:37 -07:00 committed by GitHub
commit 799c60cadc
3 changed files with 101 additions and 91 deletions

View file

@ -783,15 +783,12 @@
#define XY_PROBE_SPEED 4000
#endif
#endif
#ifndef Z_RAISE_PROBE_DEPLOY_STOW
#if defined(Z_RAISE_BEFORE_PROBING) && defined(Z_RAISE_AFTER_PROBING)
#define Z_RAISE_PROBE_DEPLOY_STOW (max(Z_RAISE_BEFORE_PROBING, Z_RAISE_AFTER_PROBING))
#if Z_RAISE_BETWEEN_PROBINGS > Z_RAISE_PROBE_DEPLOY_STOW
#define _Z_RAISE_PROBE_DEPLOY_STOW Z_RAISE_BETWEEN_PROBINGS
#else
#error "You must set Z_RAISE_PROBE_DEPLOY_STOW in your configuration."
#define _Z_RAISE_PROBE_DEPLOY_STOW Z_RAISE_PROBE_DEPLOY_STOW
#endif
#endif
#define _Z_RAISE_PROBE_DEPLOY_STOW (max(Z_RAISE_PROBE_DEPLOY_STOW, Z_RAISE_BETWEEN_PROBINGS))
#endif
/**
* Delta radius/rod trimmers

View file

@ -1728,10 +1728,9 @@ static void clean_up_after_endstop_or_probe_move() {
if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
z_dest -= zprobe_zoffset;
if (z_dest > current_position[Z_AXIS]) {
if (z_dest > current_position[Z_AXIS])
do_blocking_move_to_z(z_dest);
}
}
#endif //HAS_BED_PROBE
@ -2764,6 +2763,57 @@ inline void gcode_G4() {
}
#endif
#if ENABLED(QUICK_HOME)
static void quick_home_xy() {
current_position[X_AXIS] = current_position[Y_AXIS] = 0;
#if ENABLED(DUAL_X_CARRIAGE)
int x_axis_home_dir = x_home_dir(active_extruder);
extruder_duplication_enabled = false;
#else
int x_axis_home_dir = home_dir(X_AXIS);
#endif
SYNC_PLAN_POSITION_KINEMATIC();
float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS),
mlratio = mlx > mly ? mly / mlx : mlx / mly;
destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir;
destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
line_to_destination();
stepper.synchronize();
set_axis_is_at_home(X_AXIS);
set_axis_is_at_home(Y_AXIS);
SYNC_PLAN_POSITION_KINEMATIC();
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position);
#endif
destination[X_AXIS] = current_position[X_AXIS];
destination[Y_AXIS] = current_position[Y_AXIS];
line_to_destination();
stepper.synchronize();
endstops.hit_on_purpose(); // clear endstop hit flags
current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS];
#if DISABLED(SCARA)
current_position[Z_AXIS] = destination[Z_AXIS];
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 2", current_position);
#endif
}
#endif // QUICK_HOME
/**
* G28: Home all axes according to settings
*
@ -2815,16 +2865,9 @@ inline void gcode_G28() {
setup_for_endstop_move();
/**
* Directly after a reset this is all 0. Later we get a hint if we have
* to raise z or not.
*/
set_destination_to_current();
#if ENABLED(DELTA)
/**
* A delta can only safely home all axis at the same time
* all axis have to home at the same time
* A delta can only safely home all axes at the same time
*/
// Pretend the current position is 0,0,0
@ -2860,6 +2903,8 @@ inline void gcode_G28() {
home_all_axis = (!homeX && !homeY && !homeZ) || (homeX && homeY && homeZ);
set_destination_to_current();
#if Z_HOME_DIR > 0 // If homing away from BED do Z first
if (home_all_axis || homeZ) {
@ -2871,98 +2916,51 @@ inline void gcode_G28() {
#elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
#if HAS_BED_PROBE
do_probe_raise(MIN_Z_HEIGHT_FOR_HOMING);
destination[Z_AXIS] = current_position[Z_AXIS];
#else
// Raise Z before homing any other axes and z is not already high enough (never lower z)
if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
feedrate = planner.max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
float z_dest = (current_position[Z_AXIS] += MIN_Z_HEIGHT_FOR_HOMING);
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
SERIAL_ECHOPAIR("Raise Z (before homing) to ", z_dest);
SERIAL_EOL;
DEBUG_POS("> (home_all_axis || homeZ)", current_position);
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
* Z-home otherwise each call to line_to_destination() will want to
* move Z-axis by MIN_Z_HEIGHT_FOR_HOMING.
*/
current_position[Z_AXIS] = destination[Z_AXIS];
}
#endif
feedrate = homing_feedrate[Z_AXIS];
#if HAS_BED_PROBE
do_blocking_move_to_z(z_dest);
#else
line_to_z(z_dest);
stepper.synchronize();
#endif
#endif // MIN_Z_HEIGHT_FOR_HOMING
#if ENABLED(QUICK_HOME)
if (home_all_axis || (homeX && homeY)) { // First diagonal move
bool quick_homed = home_all_axis || (homeX && homeY);
if (quick_homed) quick_home_xy();
current_position[X_AXIS] = current_position[Y_AXIS] = 0;
#if ENABLED(DUAL_X_CARRIAGE)
int x_axis_home_dir = x_home_dir(active_extruder);
extruder_duplication_enabled = false;
#else
int x_axis_home_dir = home_dir(X_AXIS);
const bool quick_homed = false;
#endif
SYNC_PLAN_POSITION_KINEMATIC();
float mlx = max_length(X_AXIS), mly = max_length(Y_AXIS),
mlratio = mlx > mly ? mly / mlx : mlx / mly;
destination[X_AXIS] = 1.5 * mlx * x_axis_home_dir;
destination[Y_AXIS] = 1.5 * mly * home_dir(Y_AXIS);
feedrate = min(homing_feedrate[X_AXIS], homing_feedrate[Y_AXIS]) * sqrt(mlratio * mlratio + 1);
line_to_destination();
stepper.synchronize();
set_axis_is_at_home(X_AXIS);
set_axis_is_at_home(Y_AXIS);
SYNC_PLAN_POSITION_KINEMATIC();
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position);
#endif
destination[X_AXIS] = current_position[X_AXIS];
destination[Y_AXIS] = current_position[Y_AXIS];
line_to_destination();
stepper.synchronize();
endstops.hit_on_purpose(); // clear endstop hit flags
current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS];
#if DISABLED(SCARA)
current_position[Z_AXIS] = destination[Z_AXIS];
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 2", current_position);
#endif
}
#endif // QUICK_HOME
#if ENABLED(HOME_Y_BEFORE_X)
// Home Y
if (home_all_axis || homeY) {
if (!quick_homed && (home_all_axis || homeY)) {
HOMEAXIS(Y);
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
#endif
}
#endif
// Home X
if (home_all_axis || homeX) {
if (!quick_homed && (home_all_axis || homeX)) {
#if ENABLED(DUAL_X_CARRIAGE)
int tmp_extruder = active_extruder;
extruder_duplication_enabled = false;
@ -2985,7 +2983,7 @@ inline void gcode_G28() {
#if DISABLED(HOME_Y_BEFORE_X)
// Home Y
if (home_all_axis || homeY) {
if (!quick_homed && (home_all_axis || homeY)) {
HOMEAXIS(Y);
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);

View file

@ -293,6 +293,21 @@
//#endif
#endif
/**
* Make sure Z raise values are set
*/
#if defined(Z_RAISE_BEFORE_PROBING) || defined(Z_RAISE_AFTER_PROBING)
#error "Z_RAISE_(BEFORE|AFTER)_PROBING are deprecated. Use Z_RAISE_PROBE_DEPLOY_STOW instead."
#elif !defined(Z_RAISE_PROBE_DEPLOY_STOW)
#error "You must set Z_RAISE_PROBE_DEPLOY_STOW in your configuration."
#elif !defined(Z_RAISE_BETWEEN_PROBINGS)
#error "You must set Z_RAISE_BETWEEN_PROBINGS in your configuration."
#elif Z_RAISE_PROBE_DEPLOY_STOW < 1
#error "Probes need Z_RAISE_PROBE_DEPLOY_STOW >= 1."
#elif Z_RAISE_BETWEEN_PROBINGS < 1
#error "Probes need Z_RAISE_BETWEEN_PROBINGS >= 1."
#endif
#else
/**