|
|
@ -1728,10 +1728,9 @@ 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
|
|
|
|
|
|
|
|
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)
|
|
|
|
// 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) {
|
|
|
|
float z_dest = (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)
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
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;
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(QUICK_HOME)
|
|
|
|
feedrate = homing_feedrate[Z_AXIS];
|
|
|
|
|
|
|
|
|
|
|
|
if (home_all_axis || (homeX && homeY)) { // First diagonal move
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
current_position[X_AXIS] = current_position[Y_AXIS] = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DUAL_X_CARRIAGE)
|
|
|
|
#if HAS_BED_PROBE
|
|
|
|
int x_axis_home_dir = x_home_dir(active_extruder);
|
|
|
|
do_blocking_move_to_z(z_dest);
|
|
|
|
extruder_duplication_enabled = false;
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
int x_axis_home_dir = home_dir(X_AXIS);
|
|
|
|
line_to_z(z_dest);
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
SYNC_PLAN_POSITION_KINEMATIC();
|
|
|
|
#endif // MIN_Z_HEIGHT_FOR_HOMING
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
#if ENABLED(QUICK_HOME)
|
|
|
|
set_axis_is_at_home(Y_AXIS);
|
|
|
|
|
|
|
|
SYNC_PLAN_POSITION_KINEMATIC();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
bool quick_homed = home_all_axis || (homeX && homeY);
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("> QUICK_HOME 1", current_position);
|
|
|
|
if (quick_homed) quick_home_xy();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
destination[X_AXIS] = current_position[X_AXIS];
|
|
|
|
#else
|
|
|
|
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];
|
|
|
|
const bool quick_homed = false;
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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);
|
|
|
|