浏览代码

Add Planner::sync_from_steppers

Use to sync the planner after an interrupted move (when not overriding
the logical position).
Scott Lahteine 8 年前
父节点
当前提交
6b9bf8e8fe
共有 3 个文件被更改,包括 15 次插入3 次删除
  1. 3
    3
      Marlin/Marlin_main.cpp
  2. 7
    0
      Marlin/planner.cpp
  3. 5
    0
      Marlin/planner.h

+ 3
- 3
Marlin/Marlin_main.cpp 查看文件

@@ -1996,12 +1996,12 @@ static void clean_up_after_endstop_or_probe_move() {
1996 1996
     // Clear endstop flags
1997 1997
     endstops.hit_on_purpose();
1998 1998
 
1999
+    // Tell the planner where we actually are
2000
+    planner.sync_from_steppers();
2001
+
1999 2002
     // Get Z where the steppers were interrupted
2000 2003
     set_current_from_steppers_for_axis(Z_AXIS);
2001 2004
 
2002
-    // Tell the planner where we actually are
2003
-    SYNC_PLAN_POSITION_KINEMATIC();
2004
-
2005 2005
     #if ENABLED(DEBUG_LEVELING_FEATURE)
2006 2006
       if (DEBUGGING(LEVELING)) DEBUG_POS("<<< do_probe_move", current_position);
2007 2007
     #endif

+ 7
- 0
Marlin/planner.cpp 查看文件

@@ -1211,6 +1211,13 @@ void Planner::set_position_mm(ARG_X, ARG_Y, ARG_Z, const float &e) {
1211 1211
 }
1212 1212
 
1213 1213
 /**
1214
+ * Sync from the stepper positions. (e.g., after an interrupted move)
1215
+ */
1216
+void Planner::sync_from_steppers() {
1217
+  LOOP_XYZE(i) position[i] = stepper.position((AxisEnum)i);
1218
+}
1219
+
1220
+/**
1214 1221
  * Directly set the planner E position (hence the stepper E position).
1215 1222
  */
1216 1223
 void Planner::set_e_position_mm(const float& e) {

+ 5
- 0
Marlin/planner.h 查看文件

@@ -243,6 +243,11 @@ class Planner {
243 243
     static void set_position_mm(ARG_X, ARG_Y, ARG_Z, const float& e);
244 244
 
245 245
     /**
246
+     * Sync from the stepper positions. (e.g., after an interrupted move)
247
+     */
248
+    static void sync_from_steppers();
249
+
250
+    /**
246 251
      * Set the E position (mm) of the planner (and the E stepper)
247 252
      */
248 253
     static void set_e_position_mm(const float& e);

正在加载...
取消
保存