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:
commit
799c60cadc
@ -783,14 +783,11 @@
|
|||||||
#define XY_PROBE_SPEED 4000
|
#define XY_PROBE_SPEED 4000
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef Z_RAISE_PROBE_DEPLOY_STOW
|
#if Z_RAISE_BETWEEN_PROBINGS > Z_RAISE_PROBE_DEPLOY_STOW
|
||||||
#if defined(Z_RAISE_BEFORE_PROBING) && defined(Z_RAISE_AFTER_PROBING)
|
#define _Z_RAISE_PROBE_DEPLOY_STOW Z_RAISE_BETWEEN_PROBINGS
|
||||||
#define Z_RAISE_PROBE_DEPLOY_STOW (max(Z_RAISE_BEFORE_PROBING, Z_RAISE_AFTER_PROBING))
|
#else
|
||||||
#else
|
#define _Z_RAISE_PROBE_DEPLOY_STOW Z_RAISE_PROBE_DEPLOY_STOW
|
||||||
#error "You must set Z_RAISE_PROBE_DEPLOY_STOW in your configuration."
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
#define _Z_RAISE_PROBE_DEPLOY_STOW (max(Z_RAISE_PROBE_DEPLOY_STOW, Z_RAISE_BETWEEN_PROBINGS))
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1728,9 +1728,8 @@ static void clean_up_after_endstop_or_probe_move() {
|
|||||||
if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
|
if ((Z_HOME_DIR) < 0 && zprobe_zoffset < 0)
|
||||||
z_dest -= zprobe_zoffset;
|
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);
|
do_blocking_move_to_z(z_dest);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //HAS_BED_PROBE
|
#endif //HAS_BED_PROBE
|
||||||
@ -2764,6 +2763,57 @@ inline void gcode_G4() {
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
* G28: Home all axes according to settings
|
||||||
*
|
*
|
||||||
@ -2815,16 +2865,9 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
setup_for_endstop_move();
|
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)
|
#if ENABLED(DELTA)
|
||||||
/**
|
/**
|
||||||
* A delta can only safely home all axis at the same time
|
* A delta can only safely home all axes at the same time
|
||||||
* all axis have to home at the same time
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Pretend the current position is 0,0,0
|
// 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);
|
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 Z_HOME_DIR > 0 // If homing away from BED do Z first
|
||||||
|
|
||||||
if (home_all_axis || homeZ) {
|
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
|
#elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
|
||||||
|
|
||||||
#if HAS_BED_PROBE
|
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
||||||
do_probe_raise(MIN_Z_HEIGHT_FOR_HOMING);
|
float z_dest = (current_position[Z_AXIS] += MIN_Z_HEIGHT_FOR_HOMING);
|
||||||
destination[Z_AXIS] = current_position[Z_AXIS];
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
#else
|
if (DEBUGGING(LEVELING)) {
|
||||||
// Raise Z before homing any other axes and z is not already high enough (never lower z)
|
SERIAL_ECHOPAIR("Raise Z (before homing) to ", z_dest);
|
||||||
if (current_position[Z_AXIS] <= MIN_Z_HEIGHT_FOR_HOMING) {
|
SERIAL_EOL;
|
||||||
destination[Z_AXIS] = MIN_Z_HEIGHT_FOR_HOMING;
|
|
||||||
feedrate = planner.max_feedrate[Z_AXIS] * 60; // feedrate (mm/m) = max_feedrate (mm/s)
|
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
||||||
if (DEBUGGING(LEVELING)) {
|
|
||||||
SERIAL_ECHOPAIR("Raise Z (before homing) to ", (MIN_Z_HEIGHT_FOR_HOMING));
|
|
||||||
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
|
#endif
|
||||||
#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 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;
|
#else
|
||||||
|
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
const bool quick_homed = false;
|
||||||
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();
|
#endif
|
||||||
|
|
||||||
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)
|
#if ENABLED(HOME_Y_BEFORE_X)
|
||||||
|
|
||||||
// Home Y
|
// Home Y
|
||||||
if (home_all_axis || homeY) {
|
if (!quick_homed && (home_all_axis || homeY)) {
|
||||||
HOMEAXIS(Y);
|
HOMEAXIS(Y);
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Home X
|
// Home X
|
||||||
if (home_all_axis || homeX) {
|
if (!quick_homed && (home_all_axis || homeX)) {
|
||||||
#if ENABLED(DUAL_X_CARRIAGE)
|
#if ENABLED(DUAL_X_CARRIAGE)
|
||||||
int tmp_extruder = active_extruder;
|
int tmp_extruder = active_extruder;
|
||||||
extruder_duplication_enabled = false;
|
extruder_duplication_enabled = false;
|
||||||
@ -2985,7 +2983,7 @@ inline void gcode_G28() {
|
|||||||
|
|
||||||
#if DISABLED(HOME_Y_BEFORE_X)
|
#if DISABLED(HOME_Y_BEFORE_X)
|
||||||
// Home Y
|
// Home Y
|
||||||
if (home_all_axis || homeY) {
|
if (!quick_homed && (home_all_axis || homeY)) {
|
||||||
HOMEAXIS(Y);
|
HOMEAXIS(Y);
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> homeY", current_position);
|
||||||
|
@ -293,6 +293,21 @@
|
|||||||
//#endif
|
//#endif
|
||||||
#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
|
#else
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user