Pārlūkot izejas kodu

Additional tool-change fixes (#10304)

Followup to #10257
GMagician 7 gadus atpakaļ
vecāks
revīzija
21a47b50f4
1 mainītis faili ar 13 papildinājumiem un 10 dzēšanām
  1. 13
    10
      Marlin/src/module/tool_change.cpp

+ 13
- 10
Marlin/src/module/tool_change.cpp Parādīt failu

@@ -398,9 +398,9 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
398 398
           #endif
399 399
 
400 400
           #if ENABLED(SWITCHING_NOZZLE)
401
-            // Always raise by at least 0.3
402
-            const float z_diff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
403
-            current_position[Z_AXIS] += (z_diff > 0.0 ? z_diff : 0.0) + 0.3;
401
+            // Always raise by at least 1 to avoid workpiece
402
+            const float zdiff = hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
403
+            current_position[Z_AXIS] += (zdiff > 0.0 ? zdiff : 0.0) + 1;
404 404
             planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
405 405
             move_nozzle_servo(tmp_extruder);
406 406
           #endif
@@ -430,6 +430,11 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
430 430
           set_bed_leveling_enabled(leveling_was_active);
431 431
         #endif
432 432
 
433
+        #if ENABLED(SWITCHING_NOZZLE)
434
+          // The newly-selected extruder Z is actually at...
435
+          current_position[Z_AXIS] -= zdiff;
436
+        #endif
437
+
433 438
         // Tell the planner the new "current position"
434 439
         SYNC_PLAN_POSITION_KINEMATIC();
435 440
 
@@ -440,15 +445,13 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
440 445
           constexpr bool safe_to_move = true;
441 446
         #endif
442 447
 
443
-        #if ENABLED(SWITCHING_NOZZLE)
444
-          destination[Z_AXIS] += z_diff;  // Include the Z restore with the "move back"
445
-        #endif
446
-
447 448
         // Raise, move, and lower again
448 449
         if (safe_to_move && !no_move && IsRunning()) {
449
-          // Do a small lift to avoid the workpiece in the move back (below)
450
-          current_position[Z_AXIS] += 1.0;
451
-          planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
450
+          #if DISABLED(SWITCHING_NOZZLE)
451
+            // Do a small lift to avoid the workpiece in the move back (below)
452
+            current_position[Z_AXIS] += 1.0;
453
+            planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
454
+          #endif
452 455
           #if ENABLED(DEBUG_LEVELING_FEATURE)
453 456
             if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
454 457
           #endif

Notiek ielāde…
Atcelt
Saglabāt