Selaa lähdekoodia

Additional tool-change fixes (#10304)

Followup to #10257
GMagician 7 vuotta sitten
vanhempi
commit
21a47b50f4
1 muutettua tiedostoa jossa 13 lisäystä ja 10 poistoa
  1. 13
    10
      Marlin/src/module/tool_change.cpp

+ 13
- 10
Marlin/src/module/tool_change.cpp Näytä tiedosto

398
           #endif
398
           #endif
399
 
399
 
400
           #if ENABLED(SWITCHING_NOZZLE)
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
             planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
404
             planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
405
             move_nozzle_servo(tmp_extruder);
405
             move_nozzle_servo(tmp_extruder);
406
           #endif
406
           #endif
430
           set_bed_leveling_enabled(leveling_was_active);
430
           set_bed_leveling_enabled(leveling_was_active);
431
         #endif
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
         // Tell the planner the new "current position"
438
         // Tell the planner the new "current position"
434
         SYNC_PLAN_POSITION_KINEMATIC();
439
         SYNC_PLAN_POSITION_KINEMATIC();
435
 
440
 
440
           constexpr bool safe_to_move = true;
445
           constexpr bool safe_to_move = true;
441
         #endif
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
         // Raise, move, and lower again
448
         // Raise, move, and lower again
448
         if (safe_to_move && !no_move && IsRunning()) {
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
           #if ENABLED(DEBUG_LEVELING_FEATURE)
455
           #if ENABLED(DEBUG_LEVELING_FEATURE)
453
             if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
456
             if (DEBUGGING(LEVELING)) DEBUG_POS("Move back", destination);
454
           #endif
457
           #endif

Loading…
Peruuta
Tallenna