Kaynağa Gözat

Homing backoff enhancements

- Define homing bump as an array
- Add pre and post homing backoff options
- Consolidate homing config options
George Fu 4 yıl önce
ebeveyn
işleme
a794538c54

+ 20
- 14
Marlin/Configuration_adv.h Dosyayı Görüntüle

@@ -592,8 +592,7 @@
592 592
 
593 593
   // Default x offset in duplication mode (typically set to half print bed width)
594 594
   #define DEFAULT_DUPLICATION_X_OFFSET 100
595
-
596
-#endif // DUAL_X_CARRIAGE
595
+#endif
597 596
 
598 597
 // Activate a solenoid on the active extruder with M380. Disable all with M381.
599 598
 // Define SOL0_PIN, SOL1_PIN, etc., for each extruder that has a solenoid.
@@ -601,19 +600,24 @@
601 600
 
602 601
 // @section homing
603 602
 
604
-// Homing hits each endstop, retracts by these distances, then does a slower bump.
605
-#define X_HOME_BUMP_MM 5
606
-#define Y_HOME_BUMP_MM 5
607
-#define Z_HOME_BUMP_MM 2
608
-#define HOMING_BUMP_DIVISOR { 2, 2, 4 }  // Re-Bump Speed Divisor (Divides the Homing Feedrate)
609
-//#define QUICK_HOME                     // If homing includes X and Y, do a diagonal move initially
610
-//#define HOMING_BACKOFF_MM { 2, 2, 2 }  // (mm) Move away from the endstops after homing
603
+/**
604
+ * Homing Procedure
605
+ * Homing (G28) does an indefinite move towards the endstops to establish
606
+ * the position of the toolhead relative to the workspace.
607
+ */
608
+
609
+//#define SENSORLESS_BACKOFF_MM  { 2, 2 }     // (mm) Backoff from endstops before sensorless homing
611 610
 
612
-// When G28 is called, this option will make Y home before X
613
-//#define HOME_Y_BEFORE_X
611
+#define HOMING_BUMP_MM      { 5, 5, 2 }       // (mm) Backoff from endstops after first bump
612
+#define HOMING_BUMP_DIVISOR { 2, 2, 4 }       // Re-Bump Speed Divisor (Divides the Homing Feedrate)
614 613
 
615
-// Enable this if X or Y can't home without homing the other axis first.
616
-//#define CODEPENDENT_XY_HOMING
614
+//#define HOMING_BACKOFF_POST_MM { 2, 2, 2 }  // (mm) Backoff from endstops after homing
615
+
616
+//#define QUICK_HOME                          // If G28 contains XY do a diagonal move first
617
+//#define HOME_Y_BEFORE_X                     // If G28 contains XY home Y before X
618
+//#define CODEPENDENT_XY_HOMING               // If X/Y can't home without homing Y/X first
619
+
620
+// @section bltouch
617 621
 
618 622
 #if ENABLED(BLTOUCH)
619 623
   /**
@@ -682,6 +686,8 @@
682 686
 
683 687
 #endif // BLTOUCH
684 688
 
689
+// @section extras
690
+
685 691
 /**
686 692
  * Z Steppers Auto-Alignment
687 693
  * Add the G34 command to align multiple Z steppers using a bed probe.
@@ -2319,7 +2325,7 @@
2319 2325
    *    HIGHEST       255      -64    (Too sensitive => False positive)
2320 2326
    *    LOWEST         0        63    (Too insensitive => No trigger)
2321 2327
    *
2322
-   * It is recommended to set [XYZ]_HOME_BUMP_MM to 0.
2328
+   * It is recommended to set HOMING_BUMP_MM to { 0, 0, 0 }.
2323 2329
    *
2324 2330
    * SPI_ENDSTOPS  *** Beta feature! *** TMC2130 Only ***
2325 2331
    * Poll the driver through SPI to determine load when homing.

+ 4
- 0
Marlin/src/inc/SanityCheck.h Dosyayı Görüntüle

@@ -493,6 +493,10 @@
493 493
   #error "ORIG_Ex_AUTO_FAN_PIN is now just Ex_AUTO_FAN_PIN. Make sure your pins are up to date."
494 494
 #elif defined(ORIG_CHAMBER_AUTO_FAN_PIN)
495 495
   #error "ORIG_CHAMBER_AUTO_FAN_PIN is now just CHAMBER_AUTO_FAN_PIN. Make sure your pins are up to date."
496
+#elif defined(HOMING_BACKOFF_MM)
497
+  #error "HOMING_BACKOFF_MM is now HOMING_BACKOFF_POST_MM. Please update Configuration_adv.h."
498
+#elif defined(X_HOME_BUMP_MM) || defined(Y_HOME_BUMP_MM) || defined(Z_HOME_BUMP_MM)
499
+  #error "[XYZ]_HOME_BUMP_MM is now HOMING_BUMP_MM. Please update Configuration_adv.h."
496 500
 #endif
497 501
 
498 502
 /**

+ 2
- 2
Marlin/src/module/delta.cpp Dosyayı Görüntüle

@@ -280,8 +280,8 @@ void home_delta() {
280 280
 
281 281
   sync_plan_position();
282 282
 
283
-  #if DISABLED(DELTA_HOME_TO_SAFE_ZONE) && defined(HOMING_BACKOFF_MM)
284
-    constexpr xyz_float_t endstop_backoff = HOMING_BACKOFF_MM;
283
+  #if DISABLED(DELTA_HOME_TO_SAFE_ZONE) && defined(HOMING_BACKOFF_POST_MM)
284
+    constexpr xyz_float_t endstop_backoff = HOMING_BACKOFF_POST_MM;
285 285
     if (endstop_backoff.z) {
286 286
       current_position.z -= ABS(endstop_backoff.z) * Z_HOME_DIR;
287 287
       line_to_current_position(homing_feedrate(Z_AXIS));

+ 11
- 21
Marlin/src/module/motion.cpp Dosyayı Görüntüle

@@ -74,15 +74,6 @@
74 74
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
75 75
 #include "../core/debug_out.h"
76 76
 
77
-#define XYZ_CONSTS(T, NAME, OPT) const PROGMEM XYZval<T> NAME##_P = { X_##OPT, Y_##OPT, Z_##OPT }
78
-
79
-XYZ_CONSTS(float, base_min_pos,   MIN_POS);
80
-XYZ_CONSTS(float, base_max_pos,   MAX_POS);
81
-XYZ_CONSTS(float, base_home_pos,  HOME_POS);
82
-XYZ_CONSTS(float, max_length,     MAX_LENGTH);
83
-XYZ_CONSTS(float, home_bump_mm,   HOME_BUMP_MM);
84
-XYZ_CONSTS(signed char, home_dir, HOME_DIR);
85
-
86 77
 /**
87 78
  * axis_homed
88 79
  *   Flags that each linear axis was homed.
@@ -1567,14 +1558,13 @@ void homeaxis(const AxisEnum axis) {
1567 1558
     if (axis == Z_AXIS && bltouch.deploy()) return; // The initial DEPLOY
1568 1559
   #endif
1569 1560
 
1570
-  do_homing_move(axis, 1.5f * max_length(
1571
-    #if ENABLED(DELTA)
1572
-      Z_AXIS
1573
-    #else
1574
-      axis
1575
-    #endif
1576
-    ) * axis_home_dir
1577
-  );
1561
+  #if DISABLED(DELTA) && defined(SENSORLESS_BACKOFF_MM)
1562
+    const xy_float_t backoff = SENSORLESS_BACKOFF_MM;
1563
+    if (((ENABLED(X_SENSORLESS) && axis == X_AXIS) || (ENABLED(Y_SENSORLESS) && axis == Y_AXIS)) && backoff[axis])
1564
+      do_homing_move(axis, -ABS(backoff[axis]) * axis_home_dir, homing_feedrate(axis));
1565
+  #endif
1566
+
1567
+  do_homing_move(axis, 1.5f * max_length(TERN(DELTA, Z_AXIS, axis)) * axis_home_dir);
1578 1568
 
1579 1569
   #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH) && DISABLED(BLTOUCH_HS_MODE)
1580 1570
     if (axis == Z_AXIS) bltouch.stow(); // Intermediate STOW (in LOW SPEED MODE)
@@ -1583,14 +1573,14 @@ void homeaxis(const AxisEnum axis) {
1583 1573
   // When homing Z with probe respect probe clearance
1584 1574
   const float bump = axis_home_dir * (
1585 1575
     #if HOMING_Z_WITH_PROBE
1586
-      (axis == Z_AXIS && (Z_HOME_BUMP_MM)) ? _MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_HOME_BUMP_MM) :
1576
+      (axis == Z_AXIS && home_bump_mm(Z_AXIS)) ? _MAX(Z_CLEARANCE_BETWEEN_PROBES, home_bump_mm(Z_AXIS)) :
1587 1577
     #endif
1588 1578
     home_bump_mm(axis)
1589 1579
   );
1590 1580
 
1591 1581
   // If a second homing move is configured...
1592 1582
   if (bump) {
1593
-    // Move away from the endstop by the axis HOME_BUMP_MM
1583
+    // Move away from the endstop by the axis HOMING_BUMP_MM
1594 1584
     if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Move Away:");
1595 1585
     do_homing_move(axis, -bump
1596 1586
       #if HOMING_Z_WITH_PROBE
@@ -1785,8 +1775,8 @@ void homeaxis(const AxisEnum axis) {
1785 1775
     if (axis == Z_AXIS && probe.stow()) return;
1786 1776
   #endif
1787 1777
 
1788
-  #if DISABLED(DELTA) && defined(HOMING_BACKOFF_MM)
1789
-    const xyz_float_t endstop_backoff = HOMING_BACKOFF_MM;
1778
+  #if DISABLED(DELTA) && defined(HOMING_BACKOFF_POST_MM)
1779
+    const xyz_float_t endstop_backoff = HOMING_BACKOFF_POST_MM;
1790 1780
     if (endstop_backoff[axis]) {
1791 1781
       current_position[axis] -= ABS(endstop_backoff[axis]) * axis_home_dir;
1792 1782
       line_to_current_position(

+ 11
- 6
Marlin/src/module/motion.h Dosyayı Görüntüle

@@ -114,20 +114,25 @@ extern int16_t feedrate_percentage;
114 114
   extern float e_move_accumulator;
115 115
 #endif
116 116
 
117
-FORCE_INLINE float pgm_read_any(const float *p) { return pgm_read_float(p); }
118
-FORCE_INLINE signed char pgm_read_any(const signed char *p) { return pgm_read_byte(p); }
117
+inline float pgm_read_any(const float *p) { return pgm_read_float(p); }
118
+inline signed char pgm_read_any(const signed char *p) { return pgm_read_byte(p); }
119 119
 
120 120
 #define XYZ_DEFS(T, NAME, OPT) \
121
-  extern const XYZval<T> NAME##_P; \
122
-  FORCE_INLINE T NAME(AxisEnum axis) { return pgm_read_any(&NAME##_P[axis]); }
123
-
121
+  inline T NAME(const AxisEnum axis) { \
122
+    static const XYZval<T> NAME##_P PROGMEM = { X_##OPT, Y_##OPT, Z_##OPT }; \
123
+    return pgm_read_any(&NAME##_P[axis]); \
124
+  }
124 125
 XYZ_DEFS(float, base_min_pos,   MIN_POS);
125 126
 XYZ_DEFS(float, base_max_pos,   MAX_POS);
126 127
 XYZ_DEFS(float, base_home_pos,  HOME_POS);
127 128
 XYZ_DEFS(float, max_length,     MAX_LENGTH);
128
-XYZ_DEFS(float, home_bump_mm,   HOME_BUMP_MM);
129 129
 XYZ_DEFS(signed char, home_dir, HOME_DIR);
130 130
 
131
+inline float home_bump_mm(const AxisEnum axis) {
132
+  static const xyz_pos_t home_bump_mm_P PROGMEM = HOMING_BUMP_MM;
133
+  return pgm_read_any(&home_bump_mm_P[axis]);
134
+}
135
+
131 136
 #if HAS_WORKSPACE_OFFSET
132 137
   void update_workspace_offset(const AxisEnum axis);
133 138
 #else

+ 1
- 3
buildroot/share/tests/SAMD51_grandcentral_m4-tests Dosyayı Görüntüle

@@ -22,9 +22,7 @@ opt_set E0_DRIVER_TYPE TMC2209
22 22
 opt_set RESTORE_LEVELING_AFTER_G28 false
23 23
 opt_set LCD_LANGUAGE it
24 24
 opt_set NUM_Z_STEPPER_DRIVERS 2
25
-opt_set X_HOME_BUMP_MM 0
26
-opt_set Y_HOME_BUMP_MM 0
27
-opt_set Z_HOME_BUMP_MM 0
25
+opt_set HOMING_BUMP_MM "{ 0, 0, 0 }"
28 26
 opt_set SDCARD_CONNECTION LCD
29 27
 opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \
30 28
            FILAMENT_RUNOUT_SENSOR G26_MESH_VALIDATION MESH_EDIT_GFX_OVERLAY Z_SAFE_HOMING \

+ 1
- 0
buildroot/share/tests/mega1280-tests Dosyayı Görüntüle

@@ -18,6 +18,7 @@ set -e
18 18
 restore_configs
19 19
 opt_set LCD_LANGUAGE an
20 20
 opt_enable SPINDLE_FEATURE ULTIMAKERCONTROLLER LCD_BED_LEVELING \
21
+           SENSORLESS_BACKOFF_MM HOMING_BACKOFF_POST_MM HOME_Y_BEFORE_X CODEPENDENT_XY_HOMING \
21 22
            MESH_BED_LEVELING ENABLE_LEVELING_FADE_HEIGHT MESH_G28_REST_ORIGIN \
22 23
            G26_MESH_VALIDATION MESH_EDIT_MENU GCODE_QUOTED_STRINGS
23 24
 exec_test $1 $2 "Spindle, MESH_BED_LEVELING, and LCD"

Loading…
İptal
Kaydet