Merge pull request #8495 from GMagician/Tool-change-fix

[2.0.x] tool change bad behaviours
This commit is contained in:
Scott Lahteine 2017-11-20 20:36:46 -06:00 committed by GitHub
commit 63e135732c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -494,21 +494,25 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
// Move to the "old position" (move the extruder into place) // Move to the "old position" (move the extruder into place)
if (!no_move && IsRunning()) { if (!no_move && IsRunning()) {
#if ENABLED(SWITCHING_NOZZLE)
if (z_raise != z_diff)
destination[Z_AXIS] += z_diff; // Include the Z restore with the "move back"
#endif
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination); if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
#endif #endif
prepare_move_to_destination(); // Move back to the original (or tweaked) position
do_blocking_move_to(destination[X_AXIS], destination[Y_AXIS], destination[Z_AXIS]);
} }
#if ENABLED(SWITCHING_NOZZLE) #if ENABLED(SWITCHING_NOZZLE)
// Move back down, if needed. (Including when the new tool is higher.) // Move back down, if needed. (Including when the new tool is higher.)
if (z_raise != z_diff) { else if (z_raise != z_diff) {
set_destination_from_current(); // Prevent any XY move
destination[Z_AXIS] += z_diff; destination[Z_AXIS] += z_diff;
feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS]; feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS];
prepare_move_to_destination(); prepare_move_to_destination();
} }
#endif #endif
} // (tmp_extruder != active_extruder) } // (tmp_extruder != active_extruder)
stepper.synchronize(); stepper.synchronize();