Browse Source

Homing backoff per-axis / delta Z (#14789)

InsanityAutomation 5 years ago
parent
commit
6f8b8c394d
3 changed files with 19 additions and 9 deletions
  1. 0
    9
      Marlin/src/gcode/calibrate/G28.cpp
  2. 18
    0
      Marlin/src/module/motion.cpp
  3. 1
    0
      Marlin/src/module/motion.h

+ 0
- 9
Marlin/src/gcode/calibrate/G28.cpp View File

391
 
391
 
392
   #endif // DUAL_X_CARRIAGE
392
   #endif // DUAL_X_CARRIAGE
393
 
393
 
394
-  #ifdef HOMING_BACKOFF_MM
395
-    endstops.enable(false);
396
-    constexpr float endstop_backoff[XYZ] = HOMING_BACKOFF_MM;
397
-    const float backoff_x = doX ? ABS(endstop_backoff[X_AXIS]) * (X_HOME_DIR) : 0,
398
-                backoff_y = doY ? ABS(endstop_backoff[Y_AXIS]) * (Y_HOME_DIR) : 0,
399
-                backoff_z = doZ ? ABS(endstop_backoff[Z_AXIS]) * (Z_HOME_DIR) : 0;
400
-    if (backoff_z) do_blocking_move_to_z(current_position[Z_AXIS] - backoff_z);
401
-    if (backoff_x || backoff_y) do_blocking_move_to_xy(current_position[X_AXIS] - backoff_x, current_position[Y_AXIS] - backoff_y);
402
-  #endif
403
   endstops.not_homing();
394
   endstops.not_homing();
404
 
395
 
405
   #if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)
396
   #if BOTH(DELTA, DELTA_HOME_TO_SAFE_ZONE)

+ 18
- 0
Marlin/src/module/motion.cpp View File

423
 void do_blocking_move_to_x(const float &rx, const float &fr_mm_s/*=0.0*/) {
423
 void do_blocking_move_to_x(const float &rx, const float &fr_mm_s/*=0.0*/) {
424
   do_blocking_move_to(rx, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s);
424
   do_blocking_move_to(rx, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_s);
425
 }
425
 }
426
+void do_blocking_move_to_y(const float &ry, const float &fr_mm_s/*=0.0*/) {
427
+  do_blocking_move_to(current_position[Y_AXIS], ry, current_position[Z_AXIS], fr_mm_s);
428
+}
426
 void do_blocking_move_to_z(const float &rz, const float &fr_mm_s/*=0.0*/) {
429
 void do_blocking_move_to_z(const float &rz, const float &fr_mm_s/*=0.0*/) {
427
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], rz, fr_mm_s);
430
   do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], rz, fr_mm_s);
428
 }
431
 }
1599
     if (axis == Z_AXIS && STOW_PROBE()) return;
1602
     if (axis == Z_AXIS && STOW_PROBE()) return;
1600
   #endif
1603
   #endif
1601
 
1604
 
1605
+  #ifdef HOMING_BACKOFF_MM
1606
+    constexpr float endstop_backoff[XYZ] = HOMING_BACKOFF_MM;
1607
+    const AxisEnum backoff_mm = endstop_backoff[
1608
+      #if ENABLED(DELTA)
1609
+        Z_AXIS
1610
+      #else
1611
+        axis
1612
+      #endif
1613
+    ];
1614
+    if (backoff_mm) {
1615
+      current_position[axis] -= ABS(backoff_mm) * axis_home_dir;
1616
+      line_to_current_position();
1617
+    }
1618
+  #endif
1619
+
1602
   // Clear retracted status if homing the Z axis
1620
   // Clear retracted status if homing the Z axis
1603
   #if ENABLED(FWRETRACT)
1621
   #if ENABLED(FWRETRACT)
1604
     if (axis == Z_AXIS) fwretract.current_hop = 0.0;
1622
     if (axis == Z_AXIS) fwretract.current_hop = 0.0;

+ 1
- 0
Marlin/src/module/motion.h View File

185
  */
185
  */
186
 void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s=0);
186
 void do_blocking_move_to(const float rx, const float ry, const float rz, const float &fr_mm_s=0);
187
 void do_blocking_move_to_x(const float &rx, const float &fr_mm_s=0);
187
 void do_blocking_move_to_x(const float &rx, const float &fr_mm_s=0);
188
+void do_blocking_move_to_y(const float &ry, const float &fr_mm_s=0);
188
 void do_blocking_move_to_z(const float &rz, const float &fr_mm_s=0);
189
 void do_blocking_move_to_z(const float &rz, const float &fr_mm_s=0);
189
 void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s=0);
190
 void do_blocking_move_to_xy(const float &rx, const float &ry, const float &fr_mm_s=0);
190
 
191
 

Loading…
Cancel
Save