浏览代码

Fix UBL mesh edit delta moves (#20620)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Jason Smith 4 年前
父节点
当前提交
9f53738339
没有帐户链接到提交者的电子邮件

+ 1
- 1
Marlin/src/feature/fwretract.cpp 查看文件

139
   if (retracting) {
139
   if (retracting) {
140
     // Retract by moving from a faux E position back to the current E position
140
     // Retract by moving from a faux E position back to the current E position
141
     current_retract[active_extruder] = base_retract;
141
     current_retract[active_extruder] = base_retract;
142
-    prepare_internal_move_to_destination(                 // set current to destination
142
+    prepare_internal_move_to_destination(                 // set current from destination
143
       settings.retract_feedrate_mm_s * TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS))
143
       settings.retract_feedrate_mm_s * TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS))
144
     );
144
     );
145
 
145
 

+ 7
- 9
Marlin/src/lcd/marlinui.cpp 查看文件

687
   TERN_(IS_KINEMATIC, float ManualMove::offset = 0);
687
   TERN_(IS_KINEMATIC, float ManualMove::offset = 0);
688
   TERN_(IS_KINEMATIC, bool ManualMove::processing = false);
688
   TERN_(IS_KINEMATIC, bool ManualMove::processing = false);
689
   TERN_(MULTI_MANUAL, int8_t ManualMove::e_index = 0);
689
   TERN_(MULTI_MANUAL, int8_t ManualMove::e_index = 0);
690
-  uint8_t ManualMove::axis = (uint8_t)NO_AXIS;
690
+  AxisEnum ManualMove::axis = NO_AXIS;
691
 
691
 
692
   /**
692
   /**
693
    * If a manual move has been posted and its time has arrived, and if the planner
693
    * If a manual move has been posted and its time has arrived, and if the planner
713
     if (processing) return;   // Prevent re-entry from idle() calls
713
     if (processing) return;   // Prevent re-entry from idle() calls
714
 
714
 
715
     // Add a manual move to the queue?
715
     // Add a manual move to the queue?
716
-    if (axis != (uint8_t)NO_AXIS && ELAPSED(millis(), start_time) && !planner.is_full()) {
716
+    if (axis != NO_AXIS && ELAPSED(millis(), start_time) && !planner.is_full()) {
717
 
717
 
718
-      const feedRate_t fr_mm_s = (uint8_t(axis) <= E_AXIS) ? manual_feedrate_mm_s[axis] : XY_PROBE_FEEDRATE_MM_S;
718
+      const feedRate_t fr_mm_s = (axis <= E_AXIS) ? manual_feedrate_mm_s[axis] : XY_PROBE_FEEDRATE_MM_S;
719
 
719
 
720
       #if IS_KINEMATIC
720
       #if IS_KINEMATIC
721
 
721
 
722
         #if HAS_MULTI_EXTRUDER
722
         #if HAS_MULTI_EXTRUDER
723
-          const int8_t old_extruder = active_extruder;
723
+          REMEMBER(ae, active_extruder);
724
           if (axis == E_AXIS) active_extruder = e_index;
724
           if (axis == E_AXIS) active_extruder = e_index;
725
         #endif
725
         #endif
726
 
726
 
730
 
730
 
731
         // Reset for the next move
731
         // Reset for the next move
732
         offset = 0;
732
         offset = 0;
733
-        axis = (uint8_t)NO_AXIS;
733
+        axis = NO_AXIS;
734
 
734
 
735
         // DELTA and SCARA machines use segmented moves, which could fill the planner during the call to
735
         // DELTA and SCARA machines use segmented moves, which could fill the planner during the call to
736
         // move_to_destination. This will cause idle() to be called, which can then call this function while the
736
         // move_to_destination. This will cause idle() to be called, which can then call this function while the
740
         prepare_internal_move_to_destination(fr_mm_s);  // will set current_position from destination
740
         prepare_internal_move_to_destination(fr_mm_s);  // will set current_position from destination
741
         processing = false;
741
         processing = false;
742
 
742
 
743
-        TERN_(HAS_MULTI_EXTRUDER, active_extruder = old_extruder);
744
-
745
       #else
743
       #else
746
 
744
 
747
         // For Cartesian / Core motion simply move to the current_position
745
         // For Cartesian / Core motion simply move to the current_position
749
 
747
 
750
         //SERIAL_ECHOLNPAIR("Add planner.move with Axis ", int(axis), " at FR ", fr_mm_s);
748
         //SERIAL_ECHOLNPAIR("Add planner.move with Axis ", int(axis), " at FR ", fr_mm_s);
751
 
749
 
752
-        axis = (uint8_t)NO_AXIS;
750
+        axis = NO_AXIS;
753
 
751
 
754
       #endif
752
       #endif
755
     }
753
     }
767
       if (move_axis == E_AXIS) e_index = eindex >= 0 ? eindex : active_extruder;
765
       if (move_axis == E_AXIS) e_index = eindex >= 0 ? eindex : active_extruder;
768
     #endif
766
     #endif
769
     start_time = millis() + (menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
767
     start_time = millis() + (menu_scale < 0.99f ? 0UL : 250UL); // delay for bigger moves
770
-    axis = (uint8_t)move_axis;
768
+    axis = move_axis;
771
     //SERIAL_ECHOLNPAIR("Post Move with Axis ", int(axis), " soon.");
769
     //SERIAL_ECHOLNPAIR("Post Move with Axis ", int(axis), " soon.");
772
   }
770
   }
773
 
771
 

+ 8
- 7
Marlin/src/lcd/marlinui.h 查看文件

262
 
262
 
263
   // Manual Movement class
263
   // Manual Movement class
264
   class ManualMove {
264
   class ManualMove {
265
-  public:
265
+  private:
266
+    static AxisEnum axis;
267
+    #if MULTI_MANUAL
268
+      static int8_t e_index;
269
+    #else
270
+      static int8_t constexpr e_index = 0;
271
+    #endif
266
     static millis_t start_time;
272
     static millis_t start_time;
273
+  public:
267
     static float menu_scale;
274
     static float menu_scale;
268
     TERN_(IS_KINEMATIC, static float offset);
275
     TERN_(IS_KINEMATIC, static float offset);
269
     #if IS_KINEMATIC
276
     #if IS_KINEMATIC
271
     #else
278
     #else
272
       static bool constexpr processing = false;
279
       static bool constexpr processing = false;
273
     #endif
280
     #endif
274
-    #if MULTI_MANUAL
275
-      static int8_t e_index;
276
-    #else
277
-      static int8_t constexpr e_index = 0;
278
-    #endif
279
-    static uint8_t axis;
280
     static void task();
281
     static void task();
281
     static void soon(AxisEnum axis
282
     static void soon(AxisEnum axis
282
       #if MULTI_MANUAL
283
       #if MULTI_MANUAL

+ 8
- 5
Marlin/src/lcd/menu/menu_ubl.cpp 查看文件

413
  * UBL LCD Map Movement
413
  * UBL LCD Map Movement
414
  */
414
  */
415
 void ubl_map_move_to_xy() {
415
 void ubl_map_move_to_xy() {
416
+  const xy_pos_t xy = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) };
417
+
418
+  // Some printers have unreachable areas in the mesh. Skip the move if unreachable.
419
+  if (!position_is_reachable(xy)) return;
416
 
420
 
417
   #if ENABLED(DELTA)
421
   #if ENABLED(DELTA)
418
     if (current_position.z > delta_clip_start_height) { // Make sure the delta has fully free motion
422
     if (current_position.z > delta_clip_start_height) { // Make sure the delta has fully free motion
422
     }
426
     }
423
   #endif
427
   #endif
424
 
428
 
425
-  // Set the nozzle position to the mesh point
429
+  // Do an internal move to the mesh point
426
-  current_position.set(ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot));
430
+  destination.set(ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot));
427
-
431
+  constexpr feedRate_t fr_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
428
-  // Use the built-in manual move handler
432
+  prepare_internal_move_to_destination(fr_mm_s); // Set current_position from destination
429
-  ui.manual_move.soon(ALL_AXES);
430
 }
433
 }
431
 
434
 
432
 inline int32_t grid_index(const uint8_t x, const uint8_t y) {
435
 inline int32_t grid_index(const uint8_t x, const uint8_t y) {

+ 4
- 5
Marlin/src/lcd/tft/ui_480x320.cpp 查看文件

867
         NOMORE(ui.manual_move.offset, max - current_position[axis]);
867
         NOMORE(ui.manual_move.offset, max - current_position[axis]);
868
     #else
868
     #else
869
       current_position[axis] += diff;
869
       current_position[axis] += diff;
870
+      const char *msg = PSTR(""); // clear the error
870
       if (direction < 0 && current_position[axis] < min) {
871
       if (direction < 0 && current_position[axis] < min) {
871
         current_position[axis] = min;
872
         current_position[axis] = min;
872
-        drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
873
+        msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
873
       }
874
       }
874
       else if (direction > 0 && current_position[axis] > max) {
875
       else if (direction > 0 && current_position[axis] > max) {
875
         current_position[axis] = max;
876
         current_position[axis] = max;
876
-        drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
877
+        msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
877
-      }
878
-      else {
879
-        drawMessage(""); // clear the error
880
       }
878
       }
879
+      drawMessage(msg);
881
     #endif
880
     #endif
882
 
881
 
883
     ui.manual_move.soon(axis
882
     ui.manual_move.soon(axis

正在加载...
取消
保存