do_blocking_move_*() no longer depend on HAS_BED_PROBE

This commit is contained in:
João Brázio 2016-07-15 00:26:37 +01:00
parent 8bf6861af8
commit e71a631f8f

View File

@ -1624,86 +1624,86 @@ static void clean_up_after_endstop_or_probe_move() {
refresh_cmd_timeout(); refresh_cmd_timeout();
} }
#if HAS_BED_PROBE #if ENABLED(DELTA)
#if ENABLED(DELTA) /**
/** * Calculate delta, start a line, and set current_position to destination
* Calculate delta, start a line, and set current_position to destination */
*/ void prepare_move_to_destination_raw() {
void prepare_move_to_destination_raw() { #if ENABLED(DEBUG_LEVELING_FEATURE)
#if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_move_to_destination_raw", destination);
if (DEBUGGING(LEVELING)) DEBUG_POS("prepare_move_to_destination_raw", destination); #endif
#endif refresh_cmd_timeout();
refresh_cmd_timeout(); calculate_delta(destination);
calculate_delta(destination); planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder);
planner.buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], destination[E_AXIS], (feedrate / 60) * (feedrate_multiplier / 100.0), active_extruder); set_current_to_destination();
set_current_to_destination(); }
} #endif
/**
* Plan a move to (X, Y, Z) and set the current_position
* The final current_position may not be the one that was requested
*/
static void do_blocking_move_to(float x, float y, float z, float feed_rate = 0.0) {
float old_feedrate = feedrate;
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) print_xyz(PSTR("do_blocking_move_to"), "", x, y, z);
#endif #endif
/** #if ENABLED(DELTA)
* Plan a move to (X, Y, Z) and set the current_position
* The final current_position may not be the one that was requested
*/
static void do_blocking_move_to(float x, float y, float z, float feed_rate = 0.0) {
float old_feedrate = feedrate;
#if ENABLED(DEBUG_LEVELING_FEATURE) feedrate = (feed_rate != 0.0) ? feed_rate : XY_PROBE_FEEDRATE;
if (DEBUGGING(LEVELING)) print_xyz(PSTR("do_blocking_move_to"), "", x, y, z);
#endif
#if ENABLED(DELTA) destination[X_AXIS] = x;
destination[Y_AXIS] = y;
destination[Z_AXIS] = z;
feedrate = (feed_rate != 0.0) ? feed_rate : XY_PROBE_FEEDRATE; if (x == current_position[X_AXIS] && y == current_position[Y_AXIS])
prepare_move_to_destination_raw(); // this will also set_current_to_destination
else
prepare_move_to_destination(); // this will also set_current_to_destination
destination[X_AXIS] = x; #else
destination[Y_AXIS] = y;
destination[Z_AXIS] = z;
if (x == current_position[X_AXIS] && y == current_position[Y_AXIS]) // If Z needs to raise, do it before moving XY
prepare_move_to_destination_raw(); // this will also set_current_to_destination if (current_position[Z_AXIS] < z) {
else feedrate = (feed_rate != 0.0) ? feed_rate : homing_feedrate[Z_AXIS];
prepare_move_to_destination(); // this will also set_current_to_destination current_position[Z_AXIS] = z;
#else
// If Z needs to raise, do it before moving XY
if (current_position[Z_AXIS] < z) {
feedrate = (feed_rate != 0.0) ? feed_rate : homing_feedrate[Z_AXIS];
current_position[Z_AXIS] = z;
line_to_current_position();
}
feedrate = (feed_rate != 0.0) ? feed_rate : XY_PROBE_FEEDRATE;
current_position[X_AXIS] = x;
current_position[Y_AXIS] = y;
line_to_current_position(); line_to_current_position();
}
// If Z needs to lower, do it after moving XY feedrate = (feed_rate != 0.0) ? feed_rate : XY_PROBE_FEEDRATE;
if (current_position[Z_AXIS] > z) { current_position[X_AXIS] = x;
feedrate = (feed_rate != 0.0) ? feed_rate : homing_feedrate[Z_AXIS]; current_position[Y_AXIS] = y;
current_position[Z_AXIS] = z; line_to_current_position();
line_to_current_position();
}
#endif // If Z needs to lower, do it after moving XY
if (current_position[Z_AXIS] > z) {
feedrate = (feed_rate != 0.0) ? feed_rate : homing_feedrate[Z_AXIS];
current_position[Z_AXIS] = z;
line_to_current_position();
}
stepper.synchronize(); #endif
feedrate = old_feedrate; stepper.synchronize();
}
inline void do_blocking_move_to_x(float x, float feed_rate = 0.0) { feedrate = old_feedrate;
do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], feed_rate); }
}
inline void do_blocking_move_to_y(float y) { inline void do_blocking_move_to_x(float x, float feed_rate = 0.0) {
do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]); do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], feed_rate);
} }
inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) { inline void do_blocking_move_to_y(float y) {
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate); do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]);
} }
inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
}
#if HAS_BED_PROBE
/** /**
* Raise Z to a minimum height to make room for a probe to move * Raise Z to a minimum height to make room for a probe to move
*/ */