Selaa lähdekoodia

Apply home offsets to probing, Z Safe Homing (#19423)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
InsanityAutomation 3 vuotta sitten
vanhempi
commit
6375829448
No account linked to committer's email address

+ 9
- 17
Marlin/src/gcode/bedlevel/abl/G29.cpp Näytä tiedosto

@@ -361,32 +361,24 @@ G29_TYPE GcodeSuite::G29() {
361 361
 
362 362
       if (parser.seen('H')) {
363 363
         const int16_t size = (int16_t)parser.value_linear_units();
364
-        probe_position_lf.set(
365
-          _MAX(X_CENTER - size / 2, x_min),
366
-          _MAX(Y_CENTER - size / 2, y_min)
367
-        );
368
-        probe_position_rb.set(
369
-          _MIN(probe_position_lf.x + size, x_max),
370
-          _MIN(probe_position_lf.y + size, y_max)
371
-        );
364
+        probe_position_lf.set(_MAX((X_CENTER) - size / 2, x_min), _MAX((Y_CENTER) - size / 2, y_min));
365
+        probe_position_rb.set(_MIN(probe_position_lf.x + size, x_max), _MIN(probe_position_lf.y + size, y_max));
372 366
       }
373 367
       else {
374
-        probe_position_lf.set(
375
-          parser.seenval('L') ? RAW_X_POSITION(parser.value_linear_units()) : x_min,
376
-          parser.seenval('F') ? RAW_Y_POSITION(parser.value_linear_units()) : y_min
377
-        );
378
-        probe_position_rb.set(
379
-          parser.seenval('R') ? RAW_X_POSITION(parser.value_linear_units()) : x_max,
380
-          parser.seenval('B') ? RAW_Y_POSITION(parser.value_linear_units()) : y_max
381
-        );
368
+        probe_position_lf.set(parser.linearval('L', x_min), parser.linearval('F', y_min));
369
+        probe_position_rb.set(parser.linearval('R', x_max), parser.linearval('B', y_max));
382 370
       }
383 371
 
384 372
       if (!probe.good_bounds(probe_position_lf, probe_position_rb)) {
373
+        if (DEBUGGING(LEVELING)) {
374
+          DEBUG_ECHOLNPAIR("G29 L", probe_position_lf.x, " R", probe_position_rb.x,
375
+                              " F", probe_position_lf.y, " B", probe_position_rb.y);
376
+        }
385 377
         SERIAL_ECHOLNPGM("? (L,R,F,B) out of bounds.");
386 378
         G29_RETURN(false);
387 379
       }
388 380
 
389
-      // probe at the points of a lattice grid
381
+      // Probe at the points of a lattice grid
390 382
       gridSpacing.set((probe_position_rb.x - probe_position_lf.x) / (abl_grid_points.x - 1),
391 383
                       (probe_position_rb.y - probe_position_lf.y) / (abl_grid_points.y - 1));
392 384
 

+ 9
- 1
Marlin/src/gcode/calibrate/G28.cpp Näytä tiedosto

@@ -126,7 +126,15 @@
126 126
      * Move the Z probe (or just the nozzle) to the safe homing point
127 127
      * (Z is already at the right height)
128 128
      */
129
-    destination.set(safe_homing_xy, current_position.z);
129
+    constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
130
+    #if HAS_HOME_OFFSET
131
+      xy_float_t okay_homing_xy = safe_homing_xy;
132
+      okay_homing_xy -= home_offset;
133
+    #else
134
+      constexpr xy_float_t okay_homing_xy = safe_homing_xy;
135
+    #endif
136
+
137
+    destination.set(okay_homing_xy, current_position.z);
130 138
 
131 139
     TERN_(HOMING_Z_WITH_PROBE, destination -= probe.offset_xy);
132 140
 

+ 11
- 1
Marlin/src/gcode/geometry/M206_M428.cpp Näytä tiedosto

@@ -28,6 +28,13 @@
28 28
 #include "../../module/motion.h"
29 29
 #include "../../lcd/marlinui.h"
30 30
 #include "../../libs/buzzer.h"
31
+#include "../../MarlinCore.h"
32
+
33
+extern const char SP_Y_STR[], SP_Z_STR[];
34
+
35
+void m206_report() {
36
+  SERIAL_ECHOLNPAIR_P(PSTR("M206 X"), home_offset.x, SP_Y_STR, home_offset.y, SP_Z_STR, home_offset.z);
37
+}
31 38
 
32 39
 /**
33 40
  * M206: Set Additional Homing Offset (X Y Z). SCARA aliases T=X, P=Y
@@ -46,7 +53,10 @@ void GcodeSuite::M206() {
46 53
     if (parser.seen('P')) set_home_offset(B_AXIS, parser.value_float()); // Psi
47 54
   #endif
48 55
 
49
-  report_current_position();
56
+  if (!parser.seen("XYZ"))
57
+    m206_report();
58
+  else
59
+    report_current_position();
50 60
 }
51 61
 
52 62
 /**

+ 0
- 4
Marlin/src/module/motion.h Näytä tiedosto

@@ -78,10 +78,6 @@ extern xyz_pos_t cartes;
78 78
   #define XY_PROBE_FEEDRATE_MM_S PLANNER_XY_FEEDRATE()
79 79
 #endif
80 80
 
81
-#if ENABLED(Z_SAFE_HOMING)
82
-  constexpr xy_float_t safe_homing_xy = { Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT };
83
-#endif
84
-
85 81
 /**
86 82
  * Feed rates are often configured with mm/m
87 83
  * but the planner and stepper like mm/s units.

+ 18
- 34
Marlin/src/module/probe.h Näytä tiedosto

@@ -133,53 +133,37 @@ public:
133 133
   #if HAS_BED_PROBE || HAS_LEVELING
134 134
     #if IS_KINEMATIC
135 135
       static constexpr float printable_radius = (
136
-        #if ENABLED(DELTA)
137
-          DELTA_PRINTABLE_RADIUS
138
-        #elif IS_SCARA
139
-          SCARA_PRINTABLE_RADIUS
140
-        #endif
136
+        TERN_(DELTA, DELTA_PRINTABLE_RADIUS)
137
+        TERN_(IS_SCARA, SCARA_PRINTABLE_RADIUS)
141 138
       );
142
-
143 139
       static inline float probe_radius() {
144 140
         return printable_radius - _MAX(PROBING_MARGIN, HYPOT(offset_xy.x, offset_xy.y));
145 141
       }
146 142
     #endif
147 143
 
148 144
     static inline float min_x() {
149
-      return (
150
-        #if IS_KINEMATIC
151
-          (X_CENTER) - probe_radius()
152
-        #else
153
-          _MAX((X_MIN_BED) + (PROBING_MARGIN_LEFT), (X_MIN_POS) + offset_xy.x)
154
-        #endif
155
-      );
145
+      return TERN(IS_KINEMATIC,
146
+        (X_CENTER) - probe_radius(),
147
+        _MAX((X_MIN_BED) + (PROBING_MARGIN_LEFT), (X_MIN_POS) + offset_xy.x)
148
+      ) - TERN0(NOZZLE_AS_PROBE, home_offset.x);
156 149
     }
157 150
     static inline float max_x() {
158
-      return (
159
-        #if IS_KINEMATIC
160
-          (X_CENTER) + probe_radius()
161
-        #else
162
-          _MIN((X_MAX_BED) - (PROBING_MARGIN_RIGHT), (X_MAX_POS) + offset_xy.x)
163
-        #endif
164
-      );
151
+      return TERN(IS_KINEMATIC,
152
+        (X_CENTER) + probe_radius(),
153
+        _MIN((X_MAX_BED) - (PROBING_MARGIN_RIGHT), (X_MAX_POS) + offset_xy.x)
154
+      ) - TERN0(NOZZLE_AS_PROBE, home_offset.x);
165 155
     }
166 156
     static inline float min_y() {
167
-      return (
168
-        #if IS_KINEMATIC
169
-          (Y_CENTER) - probe_radius()
170
-        #else
171
-          _MAX((Y_MIN_BED) + (PROBING_MARGIN_FRONT), (Y_MIN_POS) + offset_xy.y)
172
-        #endif
173
-      );
157
+      return TERN(IS_KINEMATIC,
158
+        (Y_CENTER) - probe_radius(),
159
+        _MAX((Y_MIN_BED) + (PROBING_MARGIN_FRONT), (Y_MIN_POS) + offset_xy.y)
160
+      ) - TERN0(NOZZLE_AS_PROBE, home_offset.y);
174 161
     }
175 162
     static inline float max_y() {
176
-      return (
177
-        #if IS_KINEMATIC
178
-          (Y_CENTER) + probe_radius()
179
-        #else
180
-          _MIN((Y_MAX_BED) - (PROBING_MARGIN_BACK), (Y_MAX_POS) + offset_xy.y)
181
-        #endif
182
-      );
163
+      return TERN(IS_KINEMATIC,
164
+        (Y_CENTER) + probe_radius(),
165
+        _MIN((Y_MAX_BED) - (PROBING_MARGIN_BACK), (Y_MAX_POS) + offset_xy.y)
166
+      ) - TERN0(NOZZLE_AS_PROBE, home_offset.y);
183 167
     }
184 168
 
185 169
     #if NEEDS_THREE_PROBE_POINTS

Loading…
Peruuta
Tallenna