浏览代码

Add ALL_AXES manual move for UBL mesh editing

Co-Authored-By: Jason Smith <20053467+sjasonsmith@users.noreply.github.com>

#20620
Scott Lahteine 4 年前
父节点
当前提交
1d63fe6542
共有 3 个文件被更改,包括 29 次插入8 次删除
  1. 11
    4
      Marlin/src/lcd/marlinui.cpp
  2. 15
    0
      Marlin/src/lcd/marlinui.h
  3. 3
    4
      Marlin/src/lcd/menu/menu_ubl.cpp

+ 11
- 4
Marlin/src/lcd/marlinui.cpp 查看文件

684
 
684
 
685
   millis_t ManualMove::start_time = 0;
685
   millis_t ManualMove::start_time = 0;
686
   float ManualMove::menu_scale = 1;
686
   float ManualMove::menu_scale = 1;
687
-  TERN_(IS_KINEMATIC, float ManualMove::offset = 0);
688
-  TERN_(IS_KINEMATIC, bool ManualMove::processing = false);
687
+  #if IS_KINEMATIC
688
+    float ManualMove::offset = 0;
689
+    xyze_pos_t ManualMove::all_axes_destination = { 0 };
690
+    bool ManualMove::processing = false;
691
+  #endif
689
   TERN_(MULTI_MANUAL, int8_t ManualMove::e_index = 0);
692
   TERN_(MULTI_MANUAL, int8_t ManualMove::e_index = 0);
690
   AxisEnum ManualMove::axis = NO_AXIS;
693
   AxisEnum ManualMove::axis = NO_AXIS;
691
 
694
 
725
         #endif
728
         #endif
726
 
729
 
727
         // Apply a linear offset to a single axis
730
         // Apply a linear offset to a single axis
728
-        destination = current_position;
729
-        if (axis <= XYZE) destination[axis] += offset;
731
+        if (axis == ALL_AXES)
732
+          destination = all_axes_destination;
733
+        else if (axis <= XYZE) {
734
+          destination = current_position;
735
+          destination[axis] += offset;
736
+        }
730
 
737
 
731
         // Reset for the next move
738
         // Reset for the next move
732
         offset = 0;
739
         offset = 0;

+ 15
- 0
Marlin/src/lcd/marlinui.h 查看文件

23
 
23
 
24
 #include "../inc/MarlinConfig.h"
24
 #include "../inc/MarlinConfig.h"
25
 
25
 
26
+#include "../module/motion.h"
27
+
26
 #if HAS_BUZZER
28
 #if HAS_BUZZER
27
   #include "../libs/buzzer.h"
29
   #include "../libs/buzzer.h"
28
 #endif
30
 #endif
270
       static int8_t constexpr e_index = 0;
272
       static int8_t constexpr e_index = 0;
271
     #endif
273
     #endif
272
     static millis_t start_time;
274
     static millis_t start_time;
275
+    TERN_(IS_KINEMATIC, static xyze_pos_t all_axes_destination);
273
   public:
276
   public:
274
     static float menu_scale;
277
     static float menu_scale;
275
     TERN_(IS_KINEMATIC, static float offset);
278
     TERN_(IS_KINEMATIC, static float offset);
279
+    template <typename T>
280
+    void set_destination(const T& dest) {
281
+      #if IS_KINEMATIC
282
+        // Moves are segmented, so the entire move is not submitted at once.
283
+        // Using a separate variable prevents corrupting the in-progress move.
284
+        all_axes_destination = current_position;
285
+        all_axes_destination.set(dest);
286
+      #else
287
+        // Moves are submitted as single line to the planner using buffer_line.
288
+        current_position.set(dest);
289
+      #endif
290
+    }
276
     #if IS_KINEMATIC
291
     #if IS_KINEMATIC
277
       static bool processing;
292
       static bool processing;
278
     #else
293
     #else

+ 3
- 4
Marlin/src/lcd/menu/menu_ubl.cpp 查看文件

426
     }
426
     }
427
   #endif
427
   #endif
428
 
428
 
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
429
+  // Use the built-in manual move handler to move to the mesh point.
430
+  ui.manual_move.set_destination(xy);
431
+  ui.manual_move.soon(ALL_AXES);
433
 }
432
 }
434
 
433
 
435
 inline int32_t grid_index(const uint8_t x, const uint8_t y) {
434
 inline int32_t grid_index(const uint8_t x, const uint8_t y) {

正在加载...
取消
保存