|
|
|
@ -253,8 +253,8 @@ void set_current_from_steppers_for_axis(const AxisEnum axis) {
|
|
|
|
|
* Move the planner to the current position from wherever it last moved
|
|
|
|
|
* (or from wherever it has been told it is located).
|
|
|
|
|
*/
|
|
|
|
|
void line_to_current_position() {
|
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], feedrate_mm_s, active_extruder);
|
|
|
|
|
void line_to_current_position(const float &fr_mm_s/*=feedrate_mm_s*/) {
|
|
|
|
|
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], fr_mm_s, active_extruder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -270,7 +270,7 @@ void buffer_line_to_destination(const float fr_mm_s) {
|
|
|
|
|
/**
|
|
|
|
|
* Calculate delta, start a line, and set current_position to destination
|
|
|
|
|
*/
|
|
|
|
|
void prepare_uninterpolated_move_to_destination(const float fr_mm_s/*=0.0*/) {
|
|
|
|
|
void prepare_uninterpolated_move_to_destination(const float &fr_mm_s/*=0.0*/) {
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_uninterpolated_move_to_destination", destination);
|
|
|
|
|
#endif
|
|
|
|
@ -297,19 +297,18 @@ void buffer_line_to_destination(const float fr_mm_s) {
|
|
|
|
|
* Plan a move to (X, Y, Z) and set the current_position
|
|
|
|
|
*/
|
|
|
|
|
void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s/*=0.0*/) {
|
|
|
|
|
const float old_feedrate_mm_s = feedrate_mm_s;
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
if (DEBUGGING(LEVELING)) print_xyz(PSTR(">>> do_blocking_move_to"), NULL, rx, ry, rz);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
const float z_feedrate = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS);
|
|
|
|
|
const float z_feedrate = fr_mm_s ? fr_mm_s : homing_feedrate(Z_AXIS),
|
|
|
|
|
xy_feedrate = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DELTA)
|
|
|
|
|
|
|
|
|
|
if (!position_is_reachable(rx, ry)) return;
|
|
|
|
|
|
|
|
|
|
feedrate_mm_s = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
|
|
|
|
|
REMEMBER(fr, feedrate_mm_s, xy_feedrate);
|
|
|
|
|
|
|
|
|
|
set_destination_from_current(); // sync destination at the start
|
|
|
|
|
|
|
|
|
@ -373,7 +372,7 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f
|
|
|
|
|
|
|
|
|
|
destination[X_AXIS] = rx;
|
|
|
|
|
destination[Y_AXIS] = ry;
|
|
|
|
|
prepare_uninterpolated_move_to_destination(fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S);
|
|
|
|
|
prepare_uninterpolated_move_to_destination(xy_feedrate);
|
|
|
|
|
|
|
|
|
|
// If Z needs to lower, do it after moving XY
|
|
|
|
|
if (destination[Z_AXIS] > rz) {
|
|
|
|
@ -385,27 +384,22 @@ void do_blocking_move_to(const float rx, const float ry, const float rz, const f
|
|
|
|
|
|
|
|
|
|
// If Z needs to raise, do it before moving XY
|
|
|
|
|
if (current_position[Z_AXIS] < rz) {
|
|
|
|
|
feedrate_mm_s = z_feedrate;
|
|
|
|
|
current_position[Z_AXIS] = rz;
|
|
|
|
|
line_to_current_position();
|
|
|
|
|
line_to_current_position(z_feedrate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
feedrate_mm_s = fr_mm_s ? fr_mm_s : XY_PROBE_FEEDRATE_MM_S;
|
|
|
|
|
current_position[X_AXIS] = rx;
|
|
|
|
|
current_position[Y_AXIS] = ry;
|
|
|
|
|
line_to_current_position();
|
|
|
|
|
line_to_current_position(xy_feedrate);
|
|
|
|
|
|
|
|
|
|
// If Z needs to lower, do it after moving XY
|
|
|
|
|
if (current_position[Z_AXIS] > rz) {
|
|
|
|
|
feedrate_mm_s = z_feedrate;
|
|
|
|
|
current_position[Z_AXIS] = rz;
|
|
|
|
|
line_to_current_position();
|
|
|
|
|
line_to_current_position(z_feedrate);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
feedrate_mm_s = old_feedrate_mm_s;
|
|
|
|
|
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< do_blocking_move_to");
|
|
|
|
|
#endif
|
|
|
|
@ -423,31 +417,20 @@ void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// Prepare to do endstop or probe moves
|
|
|
|
|
// with custom feedrates.
|
|
|
|
|
//
|
|
|
|
|
// - Save current feedrates
|
|
|
|
|
// - Reset the rate multiplier
|
|
|
|
|
// Prepare to do endstop or probe moves with custom feedrates.
|
|
|
|
|
// - Save / restore current feedrate and multiplier
|
|
|
|
|
//
|
|
|
|
|
void bracket_probe_move(const bool before) {
|
|
|
|
|
static float saved_feedrate_mm_s;
|
|
|
|
|
static int16_t saved_feedrate_percentage;
|
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
|
if (DEBUGGING(LEVELING)) DEBUG_POS("bracket_probe_move", current_position);
|
|
|
|
|
#endif
|
|
|
|
|
if (before) {
|
|
|
|
|
saved_feedrate_mm_s = feedrate_mm_s;
|
|
|
|
|
saved_feedrate_percentage = feedrate_percentage;
|
|
|
|
|
feedrate_percentage = 100;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
feedrate_mm_s = saved_feedrate_mm_s;
|
|
|
|
|
feedrate_percentage = saved_feedrate_percentage;
|
|
|
|
|
}
|
|
|
|
|
static float saved_feedrate_mm_s;
|
|
|
|
|
static int16_t saved_feedrate_percentage;
|
|
|
|
|
void setup_for_endstop_or_probe_move() {
|
|
|
|
|
saved_feedrate_mm_s = feedrate_mm_s;
|
|
|
|
|
saved_feedrate_percentage = feedrate_percentage;
|
|
|
|
|
feedrate_percentage = 100;
|
|
|
|
|
}
|
|
|
|
|
void clean_up_after_endstop_or_probe_move() {
|
|
|
|
|
feedrate_mm_s = saved_feedrate_mm_s;
|
|
|
|
|
feedrate_percentage = saved_feedrate_percentage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setup_for_endstop_or_probe_move() { bracket_probe_move(true); }
|
|
|
|
|
void clean_up_after_endstop_or_probe_move() { bracket_probe_move(false); }
|
|
|
|
|
|
|
|
|
|
#if HAS_SOFTWARE_ENDSTOPS
|
|
|
|
|
|
|
|
|
|