Browse Source

Update tool_change.cpp (#11559)

pull/1/head
InsanityAutomation 6 years ago
committed by Roxy-3D
parent
commit
9de730b2bf
  1. 23
      Marlin/src/module/tool_change.cpp

23
Marlin/src/module/tool_change.cpp

@ -354,6 +354,12 @@ inline void invalid_extruder_error(const uint8_t e) {
void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) { void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
planner.synchronize(); planner.synchronize();
#if HAS_LEVELING
// Set current position to the physical position
const bool leveling_was_active = planner.leveling_active;
set_bed_leveling_enabled(false);
#endif
#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1 #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
mixing_tool_change(tmp_extruder); mixing_tool_change(tmp_extruder);
@ -377,12 +383,6 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
#endif #endif
} }
#if HAS_LEVELING
// Set current position to the physical position
const bool leveling_was_active = planner.leveling_active;
set_bed_leveling_enabled(false);
#endif
#if ENABLED(DUAL_X_CARRIAGE) #if ENABLED(DUAL_X_CARRIAGE)
#if HAS_SOFTWARE_ENDSTOPS #if HAS_SOFTWARE_ENDSTOPS
@ -439,11 +439,6 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
current_position[Z_AXIS] -= zdiff; current_position[Z_AXIS] -= zdiff;
#endif #endif
#if HAS_LEVELING
// Restore leveling to re-establish the logical position
set_bed_leveling_enabled(leveling_was_active);
#endif
// Tell the planner the new "current position" // Tell the planner the new "current position"
SYNC_PLAN_POSITION_KINEMATIC(); SYNC_PLAN_POSITION_KINEMATIC();
@ -517,6 +512,12 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
fanmux_switch(active_extruder); fanmux_switch(active_extruder);
#endif #endif
#if HAS_LEVELING
planner.synchronize();
// Restore leveling to re-establish the logical position
set_bed_leveling_enabled(leveling_was_active);
#endif
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, (int)active_extruder); SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, (int)active_extruder);

Loading…
Cancel
Save