🐛 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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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();
*/
void extruder_cutting_recover(const_float_t e) {
if (!too_cold(active_extruder)) {
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");
unscaled_e_move(dist, MMM_TO_MMS(toolchange_settings.unretract_speed));
planner.synchronize();
FS_DEBUG("Set position to: ", e);
current_position.e = e;
sync_plan_position_e(); // Resume new E Position
}
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");
unscaled_e_move(dist, MMM_TO_MMS(toolchange_settings.unretract_speed));
FS_DEBUG("Set E position: ", e);
current_position.e = e;
sync_plan_position_e(); // Resume new E Position
}
/**
* 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.
* 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
const float resume_current_e = current_position.e;
#if ENABLED(TOOLCHANGE_FS_SLOW_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));
#endif
// Leave E unchanged when priming
current_position.e = resume_current_e;
sync_plan_position_e();
// Cool down with fan
filament_swap_cooling();
}
@ -1061,17 +1068,19 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
}
#endif
// Prime without changing E
extruder_prime();
// Move back
#if ENABLED(TOOLCHANGE_PARK)
if (ok) {
#if ENABLED(TOOLCHANGE_NO_RETURN)
const float temp = destination.z;
destination = current_position;
destination.z = temp;
destination.x = current_position.x;
destination.y = current_position.y;
#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