Bläddra i källkod

Fix UBL mesh edit delta moves (#20620)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Jason Smith 4 år sedan
förälder
incheckning
9f53738339
Inget konto är kopplat till bidragsgivarens mejladress

+ 1
- 1
Marlin/src/feature/fwretract.cpp Visa fil

@@ -139,7 +139,7 @@ void FWRetract::retract(const bool retracting
139 139
   if (retracting) {
140 140
     // Retract by moving from a faux E position back to the current E position
141 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 143
       settings.retract_feedrate_mm_s * TERN1(RETRACT_SYNC_MIXING, (MIXING_STEPPERS))
144 144
     );
145 145
 

+ 7
- 9
Marlin/src/lcd/marlinui.cpp Visa fil

@@ -687,7 +687,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
687 687
   TERN_(IS_KINEMATIC, float ManualMove::offset = 0);
688 688
   TERN_(IS_KINEMATIC, bool ManualMove::processing = false);
689 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 693
    * If a manual move has been posted and its time has arrived, and if the planner
@@ -713,14 +713,14 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
713 713
     if (processing) return;   // Prevent re-entry from idle() calls
714 714
 
715 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 720
       #if IS_KINEMATIC
721 721
 
722 722
         #if HAS_MULTI_EXTRUDER
723
-          const int8_t old_extruder = active_extruder;
723
+          REMEMBER(ae, active_extruder);
724 724
           if (axis == E_AXIS) active_extruder = e_index;
725 725
         #endif
726 726
 
@@ -730,7 +730,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
730 730
 
731 731
         // Reset for the next move
732 732
         offset = 0;
733
-        axis = (uint8_t)NO_AXIS;
733
+        axis = NO_AXIS;
734 734
 
735 735
         // DELTA and SCARA machines use segmented moves, which could fill the planner during the call to
736 736
         // move_to_destination. This will cause idle() to be called, which can then call this function while the
@@ -740,8 +740,6 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
740 740
         prepare_internal_move_to_destination(fr_mm_s);  // will set current_position from destination
741 741
         processing = false;
742 742
 
743
-        TERN_(HAS_MULTI_EXTRUDER, active_extruder = old_extruder);
744
-
745 743
       #else
746 744
 
747 745
         // For Cartesian / Core motion simply move to the current_position
@@ -749,7 +747,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
749 747
 
750 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 752
       #endif
755 753
     }
@@ -767,7 +765,7 @@ void MarlinUI::quick_feedback(const bool clear_buttons/*=true*/) {
767 765
       if (move_axis == E_AXIS) e_index = eindex >= 0 ? eindex : active_extruder;
768 766
     #endif
769 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 769
     //SERIAL_ECHOLNPAIR("Post Move with Axis ", int(axis), " soon.");
772 770
   }
773 771
 

+ 8
- 7
Marlin/src/lcd/marlinui.h Visa fil

@@ -262,8 +262,15 @@
262 262
 
263 263
   // Manual Movement class
264 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 272
     static millis_t start_time;
273
+  public:
267 274
     static float menu_scale;
268 275
     TERN_(IS_KINEMATIC, static float offset);
269 276
     #if IS_KINEMATIC
@@ -271,12 +278,6 @@
271 278
     #else
272 279
       static bool constexpr processing = false;
273 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 281
     static void task();
281 282
     static void soon(AxisEnum axis
282 283
       #if MULTI_MANUAL

+ 8
- 5
Marlin/src/lcd/menu/menu_ubl.cpp Visa fil

@@ -413,6 +413,10 @@ void _lcd_ubl_map_edit_cmd() {
413 413
  * UBL LCD Map Movement
414 414
  */
415 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 421
   #if ENABLED(DELTA)
418 422
     if (current_position.z > delta_clip_start_height) { // Make sure the delta has fully free motion
@@ -422,11 +426,10 @@ void ubl_map_move_to_xy() {
422 426
     }
423 427
   #endif
424 428
 
425
-  // Set the nozzle position to the mesh point
426
-  current_position.set(ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot));
427
-
428
-  // Use the built-in manual move handler
429
-  ui.manual_move.soon(ALL_AXES);
429
+  // Do an internal move to the mesh point
430
+  destination.set(ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot));
431
+  constexpr feedRate_t fr_mm_s = MMM_TO_MMS(XY_PROBE_SPEED);
432
+  prepare_internal_move_to_destination(fr_mm_s); // Set current_position from destination
430 433
 }
431 434
 
432 435
 inline int32_t grid_index(const uint8_t x, const uint8_t y) {

+ 4
- 5
Marlin/src/lcd/tft/ui_480x320.cpp Visa fil

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

Laddar…
Avbryt
Spara