Merge pull request #4314 from AnHardt/use-d_b_m_t-in-g28

Use do_blicking_move_to*() in G28
This commit is contained in:
Scott Lahteine 2016-07-15 20:22:02 -07:00 committed by GitHub
commit e563634a25

View File

@ -1726,6 +1726,10 @@ inline void do_blocking_move_to_y(float y) {
do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]); do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]);
} }
inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
do_blocking_move_to(x, y, 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_z(float z, float feed_rate = 0.0) {
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate); do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
} }
@ -2127,10 +2131,6 @@ inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
return current_position[Z_AXIS]; return current_position[Z_AXIS];
} }
inline void do_blocking_move_to_xy(float x, float y, float feed_rate = 0.0) {
do_blocking_move_to(x, y, current_position[Z_AXIS], feed_rate);
}
// //
// - Move to the given XY // - Move to the given XY
// - Deploy the probe, if not already deployed // - Deploy the probe, if not already deployed
@ -2902,20 +2902,17 @@ inline void gcode_G28() {
if (home_all_axis || homeX || homeY) { if (home_all_axis || homeX || homeY) {
// 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)
float z_dest = home_offset[Z_AXIS] + MIN_Z_HEIGHT_FOR_HOMING; destination[Z_AXIS] = home_offset[Z_AXIS] + MIN_Z_HEIGHT_FOR_HOMING;
if (z_dest > current_position[Z_AXIS]) { if (destination[Z_AXIS] > current_position[Z_AXIS]) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
SERIAL_ECHOPAIR("Raise Z (before homing) to ", z_dest); SERIAL_ECHOPAIR("Raise Z (before homing) to ", destination[Z_AXIS]);
SERIAL_EOL; SERIAL_EOL;
} }
#endif #endif
feedrate = homing_feedrate[Z_AXIS]; do_blocking_move_to_z(destination[Z_AXIS]);
line_to_z(z_dest);
stepper.synchronize();
destination[Z_AXIS] = current_position[Z_AXIS] = z_dest;
} }
} }
@ -3002,8 +2999,6 @@ inline void gcode_G28() {
destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - (Y_PROBE_OFFSET_FROM_EXTRUDER)); destination[Y_AXIS] = round(Z_SAFE_HOMING_Y_POINT - (Y_PROBE_OFFSET_FROM_EXTRUDER));
destination[Z_AXIS] = current_position[Z_AXIS]; //z is already at the right height destination[Z_AXIS] = current_position[Z_AXIS]; //z is already at the right height
feedrate = XY_PROBE_FEEDRATE;
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", current_position); DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", current_position);
@ -3012,15 +3007,7 @@ inline void gcode_G28() {
#endif #endif
// Move in the XY plane // Move in the XY plane
line_to_destination(); do_blocking_move_to_xy(destination[X_AXIS], destination[Y_AXIS]);
stepper.synchronize();
/**
* Update the current positions for XY, Z is still at least at
* MIN_Z_HEIGHT_FOR_HOMING height, no changes there.
*/
current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS];
} }
// Let's see if X and Y are homed // Let's see if X and Y are homed