|
|
@ -389,7 +389,7 @@ static const char *injected_commands_P = NULL;
|
|
|
|
* Feed rates are often configured with mm/m
|
|
|
|
* Feed rates are often configured with mm/m
|
|
|
|
* but the planner and stepper like mm/s units.
|
|
|
|
* but the planner and stepper like mm/s units.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
float constexpr homing_feedrate_mm_s[] = {
|
|
|
|
static const float homing_feedrate_mm_s[] PROGMEM = {
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
MMM_TO_MMS(HOMING_FEEDRATE_Z), MMM_TO_MMS(HOMING_FEEDRATE_Z),
|
|
|
|
MMM_TO_MMS(HOMING_FEEDRATE_Z), MMM_TO_MMS(HOMING_FEEDRATE_Z),
|
|
|
|
#else
|
|
|
|
#else
|
|
|
@ -397,6 +397,8 @@ float constexpr homing_feedrate_mm_s[] = {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
MMM_TO_MMS(HOMING_FEEDRATE_Z), 0
|
|
|
|
MMM_TO_MMS(HOMING_FEEDRATE_Z), 0
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
FORCE_INLINE float homing_feedrate(const AxisEnum a) { return pgm_read_float(&homing_feedrate_mm_s[a]); }
|
|
|
|
|
|
|
|
|
|
|
|
float feedrate_mm_s = MMM_TO_MMS(1500.0);
|
|
|
|
float feedrate_mm_s = MMM_TO_MMS(1500.0);
|
|
|
|
static float saved_feedrate_mm_s;
|
|
|
|
static float saved_feedrate_mm_s;
|
|
|
|
int feedrate_percentage = 100, saved_feedrate_percentage,
|
|
|
|
int feedrate_percentage = 100, saved_feedrate_percentage,
|
|
|
@ -1504,7 +1506,7 @@ inline float get_homing_bump_feedrate(const AxisEnum axis) {
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHO_START;
|
|
|
|
SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1");
|
|
|
|
SERIAL_ECHOLNPGM("Warning: Homing Bump Divisor < 1");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return homing_feedrate_mm_s[axis] / hbd;
|
|
|
|
return homing_feedrate(axis) / hbd;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -1631,7 +1633,7 @@ void do_blocking_move_to(const float &x, const float &y, const float &z, const f
|
|
|
|
// If Z needs to raise, do it before moving XY
|
|
|
|
// If Z needs to raise, do it before moving XY
|
|
|
|
if (destination[Z_AXIS] < z) {
|
|
|
|
if (destination[Z_AXIS] < z) {
|
|
|
|
destination[Z_AXIS] = z;
|
|
|
|
destination[Z_AXIS] = z;
|
|
|
|
prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : homing_feedrate_mm_s[Z_AXIS]);
|
|
|
|
prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
destination[X_AXIS] = x;
|
|
|
|
destination[X_AXIS] = x;
|
|
|
@ -1641,14 +1643,14 @@ void do_blocking_move_to(const float &x, const float &y, const float &z, const f
|
|
|
|
// If Z needs to lower, do it after moving XY
|
|
|
|
// If Z needs to lower, do it after moving XY
|
|
|
|
if (destination[Z_AXIS] > z) {
|
|
|
|
if (destination[Z_AXIS] > z) {
|
|
|
|
destination[Z_AXIS] = z;
|
|
|
|
destination[Z_AXIS] = z;
|
|
|
|
prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : homing_feedrate_mm_s[Z_AXIS]);
|
|
|
|
prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
// If Z needs to raise, do it before moving XY
|
|
|
|
// If Z needs to raise, do it before moving XY
|
|
|
|
if (current_position[Z_AXIS] < z) {
|
|
|
|
if (current_position[Z_AXIS] < z) {
|
|
|
|
feedrate_mm_s = fr_mm_s ? fr_mm_s : homing_feedrate_mm_s[Z_AXIS];
|
|
|
|
feedrate_mm_s = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS);
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1660,7 +1662,7 @@ void do_blocking_move_to(const float &x, const float &y, const float &z, const f
|
|
|
|
|
|
|
|
|
|
|
|
// If Z needs to lower, do it after moving XY
|
|
|
|
// If Z needs to lower, do it after moving XY
|
|
|
|
if (current_position[Z_AXIS] > z) {
|
|
|
|
if (current_position[Z_AXIS] > z) {
|
|
|
|
feedrate_mm_s = fr_mm_s ? fr_mm_s : homing_feedrate_mm_s[Z_AXIS];
|
|
|
|
feedrate_mm_s = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS);
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
current_position[Z_AXIS] = z;
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -2778,11 +2780,11 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
|
|
|
|
SYNC_PLAN_POSITION_KINEMATIC();
|
|
|
|
SYNC_PLAN_POSITION_KINEMATIC();
|
|
|
|
current_position[axis] = distance;
|
|
|
|
current_position[axis] = distance;
|
|
|
|
inverse_kinematics(current_position);
|
|
|
|
inverse_kinematics(current_position);
|
|
|
|
planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], current_position[E_AXIS], fr_mm_s ? fr_mm_s : homing_feedrate_mm_s[axis], active_extruder);
|
|
|
|
planner.buffer_line(delta[A_AXIS], delta[B_AXIS], delta[C_AXIS], current_position[E_AXIS], fr_mm_s ? fr_mm_s : homing_feedrate(axis), active_extruder);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
sync_plan_position();
|
|
|
|
sync_plan_position();
|
|
|
|
current_position[axis] = distance;
|
|
|
|
current_position[axis] = distance;
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], fr_mm_s ? fr_mm_s : homing_feedrate_mm_s[axis], active_extruder);
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], fr_mm_s ? fr_mm_s : homing_feedrate(axis), active_extruder);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
@ -3397,7 +3399,7 @@ inline void gcode_G4() {
|
|
|
|
const float mlx = max_length(X_AXIS),
|
|
|
|
const float mlx = max_length(X_AXIS),
|
|
|
|
mly = max_length(Y_AXIS),
|
|
|
|
mly = max_length(Y_AXIS),
|
|
|
|
mlratio = mlx > mly ? mly / mlx : mlx / mly,
|
|
|
|
mlratio = mlx > mly ? mly / mlx : mlx / mly,
|
|
|
|
fr_mm_s = min(homing_feedrate_mm_s[X_AXIS], homing_feedrate_mm_s[Y_AXIS]) * sqrt(sq(mlratio) + 1.0);
|
|
|
|
fr_mm_s = min(homing_feedrate(X_AXIS), homing_feedrate(Y_AXIS)) * sqrt(sq(mlratio) + 1.0);
|
|
|
|
|
|
|
|
|
|
|
|
do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
|
|
|
|
do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
@ -3540,7 +3542,7 @@ inline void gcode_G4() {
|
|
|
|
|
|
|
|
|
|
|
|
// Move all carriages together linearly until an endstop is hit.
|
|
|
|
// Move all carriages together linearly until an endstop is hit.
|
|
|
|
current_position[X_AXIS] = current_position[Y_AXIS] = current_position[Z_AXIS] = (Z_MAX_LENGTH + 10);
|
|
|
|
current_position[X_AXIS] = current_position[Y_AXIS] = current_position[Z_AXIS] = (Z_MAX_LENGTH + 10);
|
|
|
|
feedrate_mm_s = homing_feedrate_mm_s[X_AXIS];
|
|
|
|
feedrate_mm_s = homing_feedrate(X_AXIS);
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
|
endstops.hit_on_purpose(); // clear endstop hit flags
|
|
|
@ -3853,7 +3855,7 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
const float old_feedrate_mm_s = feedrate_mm_s;
|
|
|
|
const float old_feedrate_mm_s = feedrate_mm_s;
|
|
|
|
|
|
|
|
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0
|
|
|
|
feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS];
|
|
|
|
feedrate_mm_s = homing_feedrate(Z_AXIS);
|
|
|
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT;
|
|
|
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT;
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -3864,7 +3866,7 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
|
|
|
|
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0
|
|
|
|
#if MANUAL_PROBE_HEIGHT > 0
|
|
|
|
feedrate_mm_s = homing_feedrate_mm_s[Z_AXIS];
|
|
|
|
feedrate_mm_s = homing_feedrate(Z_AXIS);
|
|
|
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS); // just slightly over the bed
|
|
|
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS); // just slightly over the bed
|
|
|
|
line_to_current_position();
|
|
|
|
line_to_current_position();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -3900,7 +3902,7 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
#if ENABLED(MESH_G28_REST_ORIGIN)
|
|
|
|
#if ENABLED(MESH_G28_REST_ORIGIN)
|
|
|
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
|
|
|
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS);
|
|
|
|
set_destination_to_current();
|
|
|
|
set_destination_to_current();
|
|
|
|
line_to_destination(homing_feedrate_mm_s[Z_AXIS]);
|
|
|
|
line_to_destination(homing_feedrate(Z_AXIS));
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5502,7 +5504,7 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
// If any axis has enough movement, do the move
|
|
|
|
// If any axis has enough movement, do the move
|
|
|
|
LOOP_XYZ(i)
|
|
|
|
LOOP_XYZ(i)
|
|
|
|
if (fabs(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
|
|
|
|
if (fabs(destination[i] - current_position[i]) >= G38_MINIMUM_MOVE) {
|
|
|
|
if (!parser.seen('F')) feedrate_mm_s = homing_feedrate_mm_s[i];
|
|
|
|
if (!parser.seen('F')) feedrate_mm_s = homing_feedrate(i);
|
|
|
|
// If G38.2 fails throw an error
|
|
|
|
// If G38.2 fails throw an error
|
|
|
|
if (!G38_run_probe() && is_38_2) {
|
|
|
|
if (!G38_run_probe() && is_38_2) {
|
|
|
|
SERIAL_ERROR_START;
|
|
|
|
SERIAL_ERROR_START;
|
|
|
|