@@ -940,13 +940,13 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
940
940
* Cutting recovery -- Recover from cutting retraction that occurs at the end of nozzle priming
941
941
*
942
942
* If the active_extruder is up to temp (!too_cold):
943
- * Extrude filament distance = toolchange_settings.extra_resume + toolchange_settings.wipe_retract
943
+ * Extrude filament distance = toolchange_settings.extra_resume + TOOLCHANGE_FS_WIPE_RETRACT
944
944
* current_position.e = e;
945
945
* sync_plan_position_e();
946
946
*/
947
947
void extruder_cutting_recover (const_float_t e) {
948
948
if (!too_cold (active_extruder)) {
949
- const float dist = toolchange_settings.extra_resume + toolchange_settings. wipe_retract ;
949
+ const float dist = toolchange_settings.extra_resume + (TOOLCHANGE_FS_WIPE_RETRACT) ;
950
950
FS_DEBUG (" Performing Cutting Recover | Distance: " , dist, " | Speed: " , MMM_TO_MMS (toolchange_settings.unretract_speed ), " mm/s" );
951
951
unscaled_e_move (dist, MMM_TO_MMS (toolchange_settings.unretract_speed ));
952
952
planner.synchronize ();
@@ -973,17 +973,17 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
973
973
float fr = toolchange_settings.unretract_speed ; // Set default speed for unretract
974
974
975
975
#if ENABLED(TOOLCHANGE_FS_SLOW_FIRST_PRIME)
976
- /* *
977
- * Perform first unretract movement at the slower Prime_Speed to avoid breakage on first prime
978
- */
979
- static Flags<EXTRUDERS> extruder_did_first_prime; // Extruders first priming status
980
- if (!extruder_did_first_prime[active_extruder]) {
981
- extruder_did_first_prime.set (active_extruder); // Log first prime complete
982
- // new nozzle - prime at user-specified speed.
983
- FS_DEBUG (" First time priming T" , active_extruder, " , reducing speed from " , MMM_TO_MMS (fr), " to " , MMM_TO_MMS (toolchange_settings.prime_speed ), " mm/s" );
984
- fr = toolchange_settings.prime_speed ;
985
- unscaled_e_move (0 , MMM_TO_MMS (fr)); // Init planner with 0 length move
986
- }
976
+ / *
977
+ * Perform first unretract movement at the slower Prime_Speed to avoid breakage on first prime
978
+ */
979
+ static Flags<EXTRUDERS> extruder_did_first_prime; // Extruders first priming status
980
+ if (!extruder_did_first_prime[active_extruder]) {
981
+ extruder_did_first_prime.set (active_extruder); // Log first prime complete
982
+ // new nozzle - prime at user-specified speed.
983
+ FS_DEBUG (" First time priming T" , active_extruder, " , reducing speed from " , MMM_TO_MMS (fr), " to " , MMM_TO_MMS (toolchange_settings.prime_speed ), " mm/s" );
984
+ fr = toolchange_settings.prime_speed ;
985
+ unscaled_e_move (0 , MMM_TO_MMS (fr)); // Init planner with 0 length move
986
+ }
987
987
#endif
988
988
989
989
// Calculate and perform the priming distance
@@ -1011,8 +1011,8 @@ void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_axis, 0.
1011
1011
1012
1012
// Cutting retraction
1013
1013
#if TOOLCHANGE_FS_WIPE_RETRACT
1014
- FS_DEBUG (" Performing Cutting Retraction | Distance: " , -toolchange_settings. wipe_retract , " | Speed: " , MMM_TO_MMS (toolchange_settings.retract_speed ), " mm/s" );
1015
- unscaled_e_move (-toolchange_settings. wipe_retract , MMM_TO_MMS (toolchange_settings.retract_speed ));
1014
+ FS_DEBUG (" Performing Cutting Retraction | Distance: " , -(TOOLCHANGE_FS_WIPE_RETRACT) , " | Speed: " , MMM_TO_MMS (toolchange_settings.retract_speed ), " mm/s" );
1015
+ unscaled_e_move (-(TOOLCHANGE_FS_WIPE_RETRACT) , MMM_TO_MMS (toolchange_settings.retract_speed ));
1016
1016
#endif
1017
1017
1018
1018
// Cool down with fan
@@ -1271,7 +1271,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1271
1271
magnetic_switching_toolhead_tool_change (new_tool, no_move);
1272
1272
#elif ENABLED(ELECTROMAGNETIC_SWITCHING_TOOLHEAD) // Magnetic Switching ToolChanger
1273
1273
em_switching_toolhead_tool_change (new_tool, no_move);
1274
- #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS // Switching Nozzle (single servo)
1274
+ #elif ENABLED(SWITCHING_NOZZLE) && !SWITCHING_NOZZLE_TWO_SERVOS // Switching Nozzle (single servo)
1275
1275
// Raise by a configured distance to avoid workpiece, except with
1276
1276
// SWITCHING_NOZZLE_TWO_SERVOS, as both nozzles will lift instead.
1277
1277
if (!no_move) {
@@ -1285,6 +1285,11 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1285
1285
fast_line_to_current (Z_AXIS);
1286
1286
}
1287
1287
move_nozzle_servo (new_tool);
1288
+ #elif ENABLED(MECHANICAL_SWITCHING_EXTRUDER) || ENABLED(MECHANICAL_SWITCHING_NOZZLE)
1289
+ if (!no_move) {
1290
+ current_position.z = _MIN (current_position.z + toolchange_settings.z_raise , _MIN (TERN (HAS_SOFTWARE_ENDSTOPS, soft_endstop.max .z , Z_MAX_POS), Z_MAX_POS));
1291
+ fast_line_to_current (Z_AXIS);
1292
+ }
1288
1293
#endif
1289
1294
1290
1295
IF_DISABLED (DUAL_X_CARRIAGE, active_extruder = new_tool); // Set the new active extruder
@@ -1349,7 +1354,11 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1349
1354
if (toolchange_settings.enable_park ) do_blocking_move_to_xy_z (destination, destination.z , MMM_TO_MMS (TOOLCHANGE_PARK_XY_FEEDRATE));
1350
1355
#else
1351
1356
do_blocking_move_to_xy (destination, planner.settings .max_feedrate_mm_s [X_AXIS]);
1352
- do_blocking_move_to_z (destination.z , planner.settings .max_feedrate_mm_s [Z_AXIS]);
1357
+
1358
+ // If using MECHANICAL_SWITCHING extruder/nozzle, set HOTEND_OFFSET in Z axis after running EVENT_GCODE_TOOLCHANGE further below.
1359
+ #if NONE(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE)
1360
+ do_blocking_move_to_z (destination.z , planner.settings .max_feedrate_mm_s [Z_AXIS]);
1361
+ #endif
1353
1362
#endif
1354
1363
1355
1364
#endif
@@ -1411,6 +1420,21 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
1411
1420
gcode.process_subcommands_now (F (EVENT_GCODE_TOOLCHANGE_T1));
1412
1421
#endif
1413
1422
1423
+ // If using MECHANICAL_SWITCHING extruder/nozzle, set HOTEND_OFFSET in Z axis after running EVENT_GCODE_TOOLCHANGE so that nozzle does not lower below print surface if new hotend Z offset is higher than old hotend Z offset.
1424
+ #if EITHER(MECHANICAL_SWITCHING_EXTRUDER, MECHANICAL_SWITCHING_NOZZLE)
1425
+ #if HAS_HOTEND_OFFSET
1426
+ xyz_pos_t diff = hotend_offset[new_tool] - hotend_offset[old_tool];
1427
+ TERN_ (DUAL_X_CARRIAGE, diff.x = 0 );
1428
+ #else
1429
+ constexpr xyz_pos_t diff{0 };
1430
+ #endif
1431
+
1432
+ if (!no_move) {
1433
+ // Move to new hotend Z offset and reverse Z_RAISE
1434
+ do_blocking_move_to_z (_MIN (_MAX ((destination.z - diff.z ) - toolchange_settings.z_raise , _MAX (TERN (HAS_SOFTWARE_ENDSTOPS, soft_endstop.min .z , Z_MIN_POS), Z_MIN_POS)), _MIN (TERN (HAS_SOFTWARE_ENDSTOPS, soft_endstop.max .z , Z_MAX_POS), Z_MAX_POS)), planner.settings .max_feedrate_mm_s [Z_AXIS]);
1435
+ }
1436
+ #endif
1437
+
1414
1438
#ifdef EVENT_GCODE_AFTER_TOOLCHANGE
1415
1439
if (TERN1 (DUAL_X_CARRIAGE, dual_x_carriage_mode == DXC_AUTO_PARK_MODE))
1416
1440
gcode.process_subcommands_now (F (EVENT_GCODE_AFTER_TOOLCHANGE));
0 commit comments