Browse Source

Fix Resume Print with UBL (#21564)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
espr14 3 years ago
parent
commit
a5d6f6ac98
No account linked to committer's email address

+ 6
- 4
Marlin/src/feature/pause.cpp View File

@@ -597,11 +597,13 @@ void resume_print(const_float_t slow_load_length/*=0*/, const_float_t fast_load_
597 597
   unscaled_e_move(-(PAUSE_PARK_RETRACT_LENGTH), feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
598 598
 
599 599
   if (!axes_should_home()) {
600
-    // Move XY to starting position, then Z
601
-    do_blocking_move_to_xy(resume_position, feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
600
+    // Move XY back to saved position
601
+    destination.set(resume_position.x, resume_position.y, current_position.z);
602
+    prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
602 603
 
603
-    // Move Z_AXIS to saved position
604
-    do_blocking_move_to_z(resume_position.z, feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
604
+    // Move Z back to saved position
605
+    destination.z = resume_position.z;
606
+    prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
605 607
   }
606 608
 
607 609
   // Unretract

+ 12
- 5
Marlin/src/gcode/feature/pause/M701_M702.cpp View File

@@ -88,9 +88,17 @@ void GcodeSuite::M701() {
88 88
       tool_change(target_extruder, false);
89 89
   #endif
90 90
 
91
-  // Lift Z axis
92
-  if (park_point.z > 0)
93
-    do_blocking_move_to_z(_MIN(current_position.z + park_point.z, Z_MAX_POS), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
91
+  auto move_z_by = [](const_float_t zdist) {
92
+    if (zdist) {
93
+      destination = current_position;
94
+      destination.z += zdist;
95
+      prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
96
+    }
97
+  };
98
+
99
+  // Raise the Z axis (with max limit)
100
+  const float park_raise = _MIN(0, park_point.z, (Z_MAX_POS) - current_position.z);
101
+  move_z_by(park_raise);
94 102
 
95 103
   // Load filament
96 104
   #if HAS_PRUSA_MMU2
@@ -113,8 +121,7 @@ void GcodeSuite::M701() {
113 121
   #endif
114 122
 
115 123
   // Restore Z axis
116
-  if (park_point.z > 0)
117
-    do_blocking_move_to_z(_MAX(current_position.z - park_point.z, 0), feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
124
+  move_z_by(-park_raise);
118 125
 
119 126
   #if HAS_MULTI_EXTRUDER && (HAS_PRUSA_MMU1 || !HAS_MMU)
120 127
     // Restore toolhead if it was changed

+ 11
- 2
Marlin/src/lcd/extui/lib/dgus/mks/DGUSDisplayDef.cpp View File

@@ -75,9 +75,18 @@ xyz_pos_t position_before_pause;
75 75
 void MKS_pause_print_move() {
76 76
   queue.exhaust();
77 77
   position_before_pause = current_position;
78
-  do_blocking_move_to(X_MIN_POS + mks_park_pos.x, Y_MIN_POS + mks_park_pos.y, current_position.z + mks_park_pos.z);
78
+  destination.z = _MIN(current_position.z + mks_park_pos.z, Z_MAX_POS);
79
+  prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
80
+  destination.set(X_MIN_POS + mks_park_pos.x, Y_MIN_POS + mks_park_pos.y);
81
+  prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
82
+}
83
+
84
+void MKS_resume_print_move() {
85
+  destination.set(position_before_pause.x, position_before_pause.y);
86
+  prepare_internal_move_to_destination(NOZZLE_PARK_XY_FEEDRATE);
87
+  destination.z = position_before_pause.z;
88
+  prepare_internal_move_to_destination(NOZZLE_PARK_Z_FEEDRATE);
79 89
 }
80
-void MKS_resume_print_move() { do_blocking_move_to(position_before_pause); }
81 90
 
82 91
 float z_offset_add = 0;
83 92
 

+ 3
- 2
Marlin/src/module/tool_change.cpp View File

@@ -836,9 +836,10 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
836 836
       #if ENABLED(TOOLCHANGE_PARK)
837 837
         if (ok) {
838 838
           #if ENABLED(TOOLCHANGE_NO_RETURN)
839
-            do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]);
839
+            destination.set(current_position.x, current_position.y);
840
+            prepare_internal_move_to_destination(planner.settings.max_feedrate_mm_s[Z_AXIS]);
840 841
           #else
841
-            do_blocking_move_to(destination, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE));
842
+            prepare_internal_move_to_destination(MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE));
842 843
           #endif
843 844
         }
844 845
       #endif

Loading…
Cancel
Save