🐛 Fix tool-change E prime (#26237)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
studiodyne
2023-10-10 00:50:09 +02:00
committed by GitHub
parent e97d82f77b
commit 61591fd233

View File

@@ -940,19 +940,20 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
* sync_plan_position_e(); * sync_plan_position_e();
*/ */
void extruder_cutting_recover(const_float_t e) { void extruder_cutting_recover(const_float_t e) {
if (!too_cold(active_extruder)) { if (too_cold(active_extruder)) return;
const float dist = toolchange_settings.extra_resume + toolchange_settings.wipe_retract;
FS_DEBUG("Performing Cutting Recover | Distance: ", dist, " | Speed: ", MMM_TO_MMS(toolchange_settings.unretract_speed), "mm/s"); const float dist = toolchange_settings.extra_resume + toolchange_settings.wipe_retract;
unscaled_e_move(dist, MMM_TO_MMS(toolchange_settings.unretract_speed)); FS_DEBUG("Performing Cutting Recover | Distance: ", dist, " | Speed: ", MMM_TO_MMS(toolchange_settings.unretract_speed), "mm/s");
planner.synchronize(); unscaled_e_move(dist, MMM_TO_MMS(toolchange_settings.unretract_speed));
FS_DEBUG("Set position to: ", e);
current_position.e = e; FS_DEBUG("Set E position: ", e);
sync_plan_position_e(); // Resume new E Position current_position.e = e;
} sync_plan_position_e(); // Resume new E Position
} }
/** /**
* Prime the currently selected extruder (Filament loading only) * Prime the currently selected extruder (Filament loading only)
* Leave the E position unchanged so subsequent extrusion works properly.
* *
* If too_cold(toolID) returns TRUE -> returns without moving extruder. * If too_cold(toolID) returns TRUE -> returns without moving extruder.
* Extruders filament = swap_length + extra prime, then performs cutting retraction if enabled. * Extruders filament = swap_length + extra prime, then performs cutting retraction if enabled.
@@ -966,6 +967,8 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
feedRate_t fr_mm_s = MMM_TO_MMS(toolchange_settings.unretract_speed); // Set default speed for unretract feedRate_t fr_mm_s = MMM_TO_MMS(toolchange_settings.unretract_speed); // Set default speed for unretract
const float resume_current_e = current_position.e;
#if ENABLED(TOOLCHANGE_FS_SLOW_FIRST_PRIME) #if ENABLED(TOOLCHANGE_FS_SLOW_FIRST_PRIME)
/** /**
* Perform first unretract movement at the slower Prime_Speed to avoid breakage on first prime * Perform first unretract movement at the slower Prime_Speed to avoid breakage on first prime
@@ -1010,6 +1013,10 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
unscaled_e_move(-toolchange_settings.wipe_retract, MMM_TO_MMS(toolchange_settings.retract_speed)); unscaled_e_move(-toolchange_settings.wipe_retract, MMM_TO_MMS(toolchange_settings.retract_speed));
#endif #endif
// Leave E unchanged when priming
current_position.e = resume_current_e;
sync_plan_position_e();
// Cool down with fan // Cool down with fan
filament_swap_cooling(); filament_swap_cooling();
} }
@@ -1061,17 +1068,19 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
} }
#endif #endif
// Prime without changing E
extruder_prime(); extruder_prime();
// Move back // Move back
#if ENABLED(TOOLCHANGE_PARK) #if ENABLED(TOOLCHANGE_PARK)
if (ok) { if (ok) {
#if ENABLED(TOOLCHANGE_NO_RETURN) #if ENABLED(TOOLCHANGE_NO_RETURN)
const float temp = destination.z; destination.x = current_position.x;
destination = current_position; destination.y = current_position.y;
destination.z = temp;
#endif #endif
prepare_internal_move_to_destination(TERN(TOOLCHANGE_NO_RETURN, planner.settings.max_feedrate_mm_s[Z_AXIS], MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE))); do_blocking_move_to_xy(destination, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE));
do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]);
planner.synchronize();
} }
#endif #endif