Pārlūkot izejas kodu

Fix MIN_PROBE_EDGE bug in default ABL G29 (#16367)

Jason Smith 4 gadus atpakaļ
vecāks
revīzija
3cade6245e

+ 37
- 28
Marlin/src/core/utility.cpp Parādīt failu

@@ -81,40 +81,49 @@ void safe_delay(millis_t ms) {
81 81
     );
82 82
 
83 83
     #if HAS_BED_PROBE
84
-      SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
85
-      if (probe_offset.x > 0)
86
-        SERIAL_ECHOPGM(" (Right");
87
-      else if (probe_offset.x < 0)
88
-        SERIAL_ECHOPGM(" (Left");
89
-      else if (probe_offset.y != 0)
90
-        SERIAL_ECHOPGM(" (Middle");
91
-      else
92
-        SERIAL_ECHOPGM(" (Aligned With");
93 84
 
94
-      if (probe_offset.y > 0) {
95
-        #if IS_SCARA
96
-          SERIAL_ECHOPGM("-Distal");
97
-        #else
98
-          SERIAL_ECHOPGM("-Back");
99
-        #endif
100
-      }
101
-      else if (probe_offset.y < 0) {
102
-        #if IS_SCARA
103
-          SERIAL_ECHOPGM("-Proximal");
104
-        #else
105
-          SERIAL_ECHOPGM("-Front");
106
-        #endif
107
-      }
108
-      else if (probe_offset.x != 0)
109
-        SERIAL_ECHOPGM("-Center");
85
+      #if !HAS_PROBE_XY_OFFSET
86
+        SERIAL_ECHOPAIR("Probe Offset X0 Y0 Z", probe_offset.z, " (");
87
+      #else
88
+        SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
89
+        if (probe_offset.x > 0)
90
+          SERIAL_ECHOPGM(" (Right");
91
+        else if (probe_offset.x < 0)
92
+          SERIAL_ECHOPGM(" (Left");
93
+        else if (probe_offset.y != 0)
94
+          SERIAL_ECHOPGM(" (Middle");
95
+        else
96
+          SERIAL_ECHOPGM(" (Aligned With");
97
+
98
+        if (probe_offset.y > 0) {
99
+          #if IS_SCARA
100
+            SERIAL_ECHOPGM("-Distal");
101
+          #else
102
+            SERIAL_ECHOPGM("-Back");
103
+          #endif
104
+        }
105
+        else if (probe_offset.y < 0) {
106
+          #if IS_SCARA
107
+            SERIAL_ECHOPGM("-Proximal");
108
+          #else
109
+            SERIAL_ECHOPGM("-Front");
110
+          #endif
111
+        }
112
+        else if (probe_offset.x != 0)
113
+          SERIAL_ECHOPGM("-Center");
114
+
115
+        SERIAL_ECHOPGM(" & ");
116
+
117
+      #endif
110 118
 
111 119
       if (probe_offset.z < 0)
112
-        SERIAL_ECHOPGM(" & Below");
120
+        SERIAL_ECHOPGM("Below");
113 121
       else if (probe_offset.z > 0)
114
-        SERIAL_ECHOPGM(" & Above");
122
+        SERIAL_ECHOPGM("Above");
115 123
       else
116
-        SERIAL_ECHOPGM(" & Same Z as");
124
+        SERIAL_ECHOPGM("Same Z as");
117 125
       SERIAL_ECHOLNPGM(" Nozzle)");
126
+
118 127
     #endif
119 128
 
120 129
     #if HAS_ABL_OR_UBL

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl.cpp Parādīt failu

@@ -176,7 +176,7 @@
176 176
     // Add XY probe offset from extruder because probe_at_point() subtracts them when
177 177
     // moving to the XY position to be measured. This ensures better agreement between
178 178
     // the current Z position after G28 and the mesh values.
179
-    const xy_int8_t curr = closest_indexes(xy_pos_t(current_position) + xy_pos_t(probe_offset));
179
+    const xy_int8_t curr = closest_indexes(xy_pos_t(current_position) + probe_offset_xy);
180 180
 
181 181
     if (!lcd) SERIAL_EOL();
182 182
     for (int8_t j = GRID_MAX_POINTS_Y - 1; j >= 0; j--) {

+ 7
- 6
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Parādīt failu

@@ -450,7 +450,7 @@
450 450
               SERIAL_ECHO(g29_pos.y);
451 451
               SERIAL_ECHOLNPGM(").\n");
452 452
             }
453
-            const xy_pos_t near = g29_pos + probe_offset;
453
+            const xy_pos_t near = g29_pos + probe_offset_xy;
454 454
             probe_entire_mesh(near, parser.seen('T'), parser.seen('E'), parser.seen('U'));
455 455
 
456 456
             report_current_position();
@@ -468,6 +468,7 @@
468 468
             do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES);
469 469
 
470 470
             if (parser.seen('C') && !xy_seen) {
471
+
471 472
               /**
472 473
                * Use a good default location for the path.
473 474
                * The flipped > and < operators in these comparisons is intentional.
@@ -479,8 +480,8 @@
479 480
                 #if IS_KINEMATIC
480 481
                   X_HOME_POS, Y_HOME_POS
481 482
                 #else
482
-                  probe_offset.x > 0 ? X_BED_SIZE : 0,
483
-                  probe_offset.y < 0 ? Y_BED_SIZE : 0
483
+                  probe_offset_xy.x > 0 ? X_BED_SIZE : 0,
484
+                  probe_offset_xy.y < 0 ? Y_BED_SIZE : 0
484 485
                 #endif
485 486
               );
486 487
             }
@@ -805,8 +806,8 @@
805 806
       restore_ubl_active_state_and_leave();
806 807
 
807 808
       do_blocking_move_to_xy(
808
-        constrain(near.x - probe_offset.x, MESH_MIN_X, MESH_MAX_X),
809
-        constrain(near.y - probe_offset.y, MESH_MIN_Y, MESH_MAX_Y)
809
+        constrain(near.x - probe_offset_xy.x, MESH_MIN_X, MESH_MAX_X),
810
+        constrain(near.y - probe_offset_xy.y, MESH_MIN_Y, MESH_MAX_Y)
810 811
       );
811 812
     }
812 813
 
@@ -1293,7 +1294,7 @@
1293 1294
     closest.distance = -99999.9f;
1294 1295
 
1295 1296
     // Get the reference position, either nozzle or probe
1296
-    const xy_pos_t ref = probe_relative ? pos + probe_offset : pos;
1297
+    const xy_pos_t ref = probe_relative ? pos + probe_offset_xy : pos;
1297 1298
 
1298 1299
     float best_so_far = 99999.99f;
1299 1300
 

+ 5
- 4
Marlin/src/gcode/bedlevel/G42.cpp Parādīt failu

@@ -45,20 +45,21 @@ void GcodeSuite::G42() {
45 45
       return;
46 46
     }
47 47
 
48
+    // Move to current_position, as modified by I, J, P parameters
48 49
     destination = current_position;
49 50
 
50 51
     if (hasI) destination.x = _GET_MESH_X(ix);
51 52
     if (hasJ) destination.y = _GET_MESH_Y(iy);
52 53
 
53
-    #if HAS_BED_PROBE
54
+    #if HAS_PROBE_XY_OFFSET
54 55
       if (parser.boolval('P')) {
55
-        if (hasI) destination.x -= probe_offset.x;
56
-        if (hasJ) destination.y -= probe_offset.y;
56
+        if (hasI) destination.x -= probe_offset_xy.x;
57
+        if (hasJ) destination.y -= probe_offset_xy.y;
57 58
       }
58 59
     #endif
59 60
 
60 61
     const feedRate_t fval = parser.linearval('F'),
61
-                     fr_mm_s = fval > 0 ? MMM_TO_MMS(fval) : 0.0f;
62
+                     fr_mm_s = MMM_TO_MMS(fval > 0 ? fval : 0.0f);
62 63
 
63 64
     // SCARA kinematic has "safe" XY raw moves
64 65
     #if IS_SCARA

+ 7
- 8
Marlin/src/gcode/bedlevel/abl/G29.cpp Parādīt failu

@@ -228,7 +228,7 @@ G29_TYPE GcodeSuite::G29() {
228 228
       ABL_VAR xy_int8_t meshCount;
229 229
     #endif
230 230
 
231
-    ABL_VAR xy_float_t probe_position_lf, probe_position_rb;
231
+    ABL_VAR xy_pos_t probe_position_lf, probe_position_rb;
232 232
     ABL_VAR xy_float_t gridSpacing = { 0, 0 };
233 233
 
234 234
     #if ENABLED(AUTO_BED_LEVELING_LINEAR)
@@ -403,14 +403,13 @@ G29_TYPE GcodeSuite::G29() {
403 403
       }
404 404
       else {
405 405
         probe_position_lf.set(
406
-          parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : (_MAX(x_min, X_CENTER - (X_BED_SIZE) / 2)      + MIN_PROBE_EDGE_LEFT),
407
-          parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : (_MAX(y_min, Y_CENTER - (Y_BED_SIZE) / 2)      + MIN_PROBE_EDGE_FRONT)
406
+          parser.seenval('L') ? RAW_X_POSITION(parser.value_linear_units()) : x_min,
407
+          parser.seenval('F') ? RAW_Y_POSITION(parser.value_linear_units()) : y_min
408 408
         );
409 409
         probe_position_rb.set(
410
-          parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : (_MIN(x_max, probe_position_lf.x + X_BED_SIZE) - MIN_PROBE_EDGE_RIGHT),
411
-          parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : (_MIN(y_max, probe_position_lf.y + Y_BED_SIZE) - MIN_PROBE_EDGE_BACK)
410
+          parser.seenval('R') ? RAW_X_POSITION(parser.value_linear_units()) : x_max,
411
+          parser.seenval('B') ? RAW_Y_POSITION(parser.value_linear_units()) : y_max
412 412
         );
413
-        SERIAL_ECHOLN("Set Trail 1");
414 413
       }
415 414
 
416 415
       if (
@@ -911,8 +910,8 @@ G29_TYPE GcodeSuite::G29() {
911 910
         planner.force_unapply_leveling(converted); // use conversion machinery
912 911
 
913 912
         // Use the last measured distance to the bed, if possible
914
-        if ( NEAR(current_position.x, probePos.x - probe_offset.x)
915
-          && NEAR(current_position.y, probePos.y - probe_offset.y)
913
+        if ( NEAR(current_position.x, probePos.x - probe_offset_xy.x)
914
+          && NEAR(current_position.y, probePos.y - probe_offset_xy.y)
916 915
         ) {
917 916
           const float simple_z = current_position.z - measured_z;
918 917
           if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Probed Z", simple_z, "  Matrix Z", converted.z, "  Discrepancy ", simple_z - converted.z);

+ 1
- 1
Marlin/src/gcode/calibrate/G28.cpp Parādīt failu

@@ -133,7 +133,7 @@
133 133
     destination.set(safe_homing_xy, current_position.z);
134 134
 
135 135
     #if HOMING_Z_WITH_PROBE
136
-      destination -= probe_offset;
136
+      destination -= probe_offset_xy;
137 137
     #endif
138 138
 
139 139
     if (position_is_reachable(destination)) {

+ 5
- 4
Marlin/src/gcode/calibrate/M48.cpp Parādīt failu

@@ -77,8 +77,8 @@ void GcodeSuite::M48() {
77 77
   xy_float_t next_pos = current_position;
78 78
 
79 79
   const xy_pos_t probe_pos = {
80
-    parser.linearval('X', next_pos.x + probe_offset.x),
81
-    parser.linearval('Y', next_pos.y + probe_offset.y)
80
+    parser.linearval('X', next_pos.x + probe_offset_xy.x),
81
+    parser.linearval('Y', next_pos.y + probe_offset_xy.y)
82 82
   };
83 83
 
84 84
   if (!position_is_reachable_by_probe(probe_pos)) {
@@ -166,8 +166,9 @@ void GcodeSuite::M48() {
166 166
           while (angle < 0.0) angle += 360.0;   // outside of this range.   It looks like they behave correctly with
167 167
                                                 // numbers outside of the range, but just to be safe we clamp them.
168 168
 
169
-          next_pos.set(probe_pos.x - probe_offset.x + cos(RADIANS(angle)) * radius,
170
-                       probe_pos.y - probe_offset.y + sin(RADIANS(angle)) * radius);
169
+          const xy_pos_t noz_pos = probe_pos - probe_offset_xy;
170
+          next_pos.set(noz_pos.x + cos(RADIANS(angle)) * radius,
171
+                       noz_pos.y + sin(RADIANS(angle)) * radius);
171 172
 
172 173
           #if DISABLED(DELTA)
173 174
             LIMIT(next_pos.x, X_MIN_POS, X_MAX_POS);

+ 3
- 2
Marlin/src/gcode/probe/G30.cpp Parādīt failu

@@ -39,8 +39,9 @@
39 39
  *   E   Engage the probe for each probe (default 1)
40 40
  */
41 41
 void GcodeSuite::G30() {
42
-  const xy_pos_t pos = { parser.linearval('X', current_position.x + probe_offset.x),
43
-                         parser.linearval('Y', current_position.y + probe_offset.y) };
42
+
43
+  const xy_pos_t pos = { parser.linearval('X', current_position.x + probe_offset_xy.x),
44
+                         parser.linearval('Y', current_position.y + probe_offset_xy.y) };
44 45
 
45 46
   if (!position_is_reachable_by_probe(pos)) return;
46 47
 

+ 30
- 13
Marlin/src/gcode/probe/M851.cpp Parādīt failu

@@ -37,32 +37,49 @@ void GcodeSuite::M851() {
37 37
 
38 38
   // Show usage with no parameters
39 39
   if (!parser.seen("XYZ")) {
40
-    SERIAL_ECHOLNPAIR_P(PSTR(MSG_PROBE_OFFSET " X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z);
40
+    SERIAL_ECHOLNPAIR_P(
41
+      #if HAS_PROBE_XY_OFFSET
42
+        PSTR(MSG_PROBE_OFFSET " X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR
43
+      #else
44
+        PSTR(MSG_PROBE_OFFSET " X0 Y0 Z")
45
+      #endif
46
+      , probe_offset.z
47
+    );
41 48
     return;
42 49
   }
43 50
 
51
+  // Start with current offsets and modify
44 52
   xyz_pos_t offs = probe_offset;
45 53
 
54
+  // Assume no errors
46 55
   bool ok = true;
47 56
 
48 57
   if (parser.seenval('X')) {
49 58
     const float x = parser.value_float();
50
-    if (WITHIN(x, -(X_BED_SIZE), X_BED_SIZE))
51
-      offs.x = x;
52
-    else {
53
-      SERIAL_ECHOLNPAIR("?X out of range (-", int(X_BED_SIZE), " to ", int(X_BED_SIZE), ")");
54
-      ok = false;
55
-    }
59
+    #if HAS_PROBE_XY_OFFSET
60
+      if (WITHIN(x, -(X_BED_SIZE), X_BED_SIZE))
61
+        offs.x = x;
62
+      else {
63
+        SERIAL_ECHOLNPAIR("?X out of range (-", int(X_BED_SIZE), " to ", int(X_BED_SIZE), ")");
64
+        ok = false;
65
+      }
66
+    #else
67
+      if (x) SERIAL_ECHOLNPAIR("?X must be 0 (NOZZLE_AS_PROBE)."); // ...but let 'ok' stay true
68
+    #endif
56 69
   }
57 70
 
58 71
   if (parser.seenval('Y')) {
59 72
     const float y = parser.value_float();
60
-    if (WITHIN(y, -(Y_BED_SIZE), Y_BED_SIZE))
61
-      offs.y = y;
62
-    else {
63
-      SERIAL_ECHOLNPAIR("?Y out of range (-", int(Y_BED_SIZE), " to ", int(Y_BED_SIZE), ")");
64
-      ok = false;
65
-    }
73
+    #if HAS_PROBE_XY_OFFSET
74
+      if (WITHIN(y, -(Y_BED_SIZE), Y_BED_SIZE))
75
+        offs.y = y;
76
+      else {
77
+        SERIAL_ECHOLNPAIR("?Y out of range (-", int(Y_BED_SIZE), " to ", int(Y_BED_SIZE), ")");
78
+        ok = false;
79
+      }
80
+    #else
81
+      if (y) SERIAL_ECHOLNPAIR("?Y must be 0 (NOZZLE_AS_PROBE)."); // ...but let 'ok' stay true
82
+    #endif
66 83
   }
67 84
 
68 85
   if (parser.seenval('Z')) {

+ 1
- 0
Marlin/src/inc/Conditionals_LCD.h Parādīt failu

@@ -500,6 +500,7 @@
500 500
 #define PROBE_SELECTED (HAS_BED_PROBE || EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))
501 501
 
502 502
 #if HAS_BED_PROBE
503
+  #define HAS_PROBE_XY_OFFSET   DISABLED(NOZZLE_AS_PROBE)
503 504
   #define HAS_CUSTOM_PROBE_PIN  DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
504 505
   #define HOMING_Z_WITH_PROBE   (Z_HOME_DIR < 0 && !HAS_CUSTOM_PROBE_PIN)
505 506
   #ifndef Z_PROBE_LOW_POINT

+ 14
- 0
Marlin/src/inc/SanityCheck.h Parādīt failu

@@ -1149,6 +1149,20 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
1149 1149
     #error "Z_MIN_PROBE_PIN must be defined if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN is not enabled."
1150 1150
   #endif
1151 1151
 
1152
+  #if ENABLED(NOZZLE_AS_PROBE)
1153
+    constexpr float sanity_nozzle_to_probe_offset[] = NOZZLE_TO_PROBE_OFFSET;
1154
+    static_assert(sanity_nozzle_to_probe_offset[0] == 0.0 && sanity_nozzle_to_probe_offset[1] == 0.0,
1155
+                  "NOZZLE_AS_PROBE requires the X,Y offsets in NOZZLE_TO_PROBE_OFFSET to be 0,0.");
1156
+  #endif
1157
+
1158
+  #if DISABLED(NOZZLE_AS_PROBE)
1159
+    static_assert(MIN_PROBE_EDGE >= 0, "MIN_PROBE_EDGE must be >= 0.");
1160
+    static_assert(MIN_PROBE_EDGE_BACK >= 0, "MIN_PROBE_EDGE_BACK must be >= 0.");
1161
+    static_assert(MIN_PROBE_EDGE_FRONT >= 0, "MIN_PROBE_EDGE_FRONT must be >= 0.");
1162
+    static_assert(MIN_PROBE_EDGE_LEFT >= 0, "MIN_PROBE_EDGE_LEFT must be >= 0.");
1163
+    static_assert(MIN_PROBE_EDGE_RIGHT >= 0, "MIN_PROBE_EDGE_RIGHT must be >= 0.");
1164
+  #endif
1165
+
1152 1166
   /**
1153 1167
    * Make sure Z raise values are set
1154 1168
    */

+ 16
- 4
Marlin/src/module/configuration_store.cpp Parādīt failu

@@ -2354,7 +2354,12 @@ void MarlinSettings::reset() {
2354 2354
   #if HAS_BED_PROBE
2355 2355
     constexpr float dpo[XYZ] = NOZZLE_TO_PROBE_OFFSET;
2356 2356
     static_assert(COUNT(dpo) == 3, "NOZZLE_TO_PROBE_OFFSET must contain offsets for X, Y, and Z.");
2357
-    LOOP_XYZ(a) probe_offset[a] = dpo[a];
2357
+    #if HAS_PROBE_XY_OFFSET
2358
+      LOOP_XYZ(a) probe_offset[a] = dpo[a];
2359
+    #else
2360
+      probe_offset.x = probe_offset.y = 0;
2361
+      probe_offset.z = dpo[Z_AXIS];
2362
+    #endif
2358 2363
   #endif
2359 2364
 
2360 2365
   //
@@ -3102,9 +3107,16 @@ void MarlinSettings::reset() {
3102 3107
         say_units(true);
3103 3108
       }
3104 3109
       CONFIG_ECHO_START();
3105
-      SERIAL_ECHOLNPAIR_P(PSTR("  M851 X"), LINEAR_UNIT(probe_offset.x),
3106
-                                  SP_Y_STR, LINEAR_UNIT(probe_offset.y),
3107
-                                  SP_Z_STR, LINEAR_UNIT(probe_offset.z));
3110
+      SERIAL_ECHOLNPAIR_P(
3111
+        #if HAS_PROBE_XY_OFFSET
3112
+          PSTR("  M851 X"), LINEAR_UNIT(probe_offset_xy.x),
3113
+                  SP_Y_STR, LINEAR_UNIT(probe_offset_xy.y),
3114
+                  SP_Z_STR
3115
+        #else
3116
+          PSTR("  M851 X0 Y0 Z")
3117
+        #endif
3118
+        , LINEAR_UNIT(probe_offset.z)
3119
+      );
3108 3120
     #endif
3109 3121
 
3110 3122
     /**

+ 1
- 7
Marlin/src/module/delta.cpp Parādīt failu

@@ -91,13 +91,7 @@ void recalc_delta_settings() {
91 91
 #endif
92 92
 
93 93
 float delta_calibration_radius() {
94
-  return FLOOR((DELTA_PRINTABLE_RADIUS - (
95
-    #if HAS_BED_PROBE
96
-      _MAX(HYPOT(probe_offset.x, probe_offset.y), MIN_PROBE_EDGE)
97
-    #else
98
-      MIN_PROBE_EDGE
99
-    #endif
100
-  )) * calibration_radius_factor);
94
+  return FLOOR((DELTA_PRINTABLE_RADIUS - _MAX(HYPOT(probe_offset_xy.x, probe_offset_xy.y), MIN_PROBE_EDGE)) * calibration_radius_factor);
101 95
 }
102 96
 
103 97
 /**

+ 24
- 9
Marlin/src/module/motion.h Parādīt failu

@@ -291,6 +291,7 @@ void homeaxis(const AxisEnum axis);
291 291
  */
292 292
 
293 293
 #if IS_KINEMATIC // (DELTA or SCARA)
294
+
294 295
   #if HAS_SCARA_OFFSET
295 296
     extern abc_pos_t scara_home_offset; // A and B angular offsets, Z mm offset
296 297
   #endif
@@ -315,13 +316,25 @@ void homeaxis(const AxisEnum axis);
315 316
   }
316 317
 
317 318
   #if HAS_BED_PROBE
318
-    // Return true if the both nozzle and the probe can reach the given point.
319
-    // Note: This won't work on SCARA since the probe offset rotates with the arm.
320
-    inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
321
-      return position_is_reachable(rx - probe_offset.x, ry - probe_offset.y)
322
-             && position_is_reachable(rx, ry, ABS(MIN_PROBE_EDGE));
323
-    }
324
-  #endif
319
+
320
+    #if HAS_PROBE_XY_OFFSET
321
+
322
+      // Return true if the both nozzle and the probe can reach the given point.
323
+      // Note: This won't work on SCARA since the probe offset rotates with the arm.
324
+      inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
325
+        return position_is_reachable(rx - probe_offset.x, ry - probe_offset.y)
326
+               && position_is_reachable(rx, ry, ABS(MIN_PROBE_EDGE));
327
+      }
328
+
329
+    #else
330
+
331
+      FORCE_INLINE bool position_is_reachable_by_probe(const float &rx, const float &ry) {
332
+        return position_is_reachable(rx, ry, MIN_PROBE_EDGE);
333
+      }
334
+
335
+    #endif
336
+
337
+  #endif // HAS_BED_PROBE
325 338
 
326 339
 #else // CARTESIAN
327 340
 
@@ -340,6 +353,7 @@ void homeaxis(const AxisEnum axis);
340 353
   inline bool position_is_reachable(const xy_pos_t &pos) { return position_is_reachable(pos.x, pos.y); }
341 354
 
342 355
   #if HAS_BED_PROBE
356
+
343 357
     /**
344 358
      * Return whether the given position is within the bed, and whether the nozzle
345 359
      * can reach the position required to put the probe at the given position.
@@ -348,11 +362,12 @@ void homeaxis(const AxisEnum axis);
348 362
      *          nozzle must be be able to reach +10,-10.
349 363
      */
350 364
     inline bool position_is_reachable_by_probe(const float &rx, const float &ry) {
351
-      return position_is_reachable(rx - probe_offset.x, ry - probe_offset.y)
365
+      return position_is_reachable(rx - probe_offset_xy.x, ry - probe_offset_xy.y)
352 366
           && WITHIN(rx, probe_min_x() - slop, probe_max_x() + slop)
353 367
           && WITHIN(ry, probe_min_y() - slop, probe_max_y() + slop);
354 368
     }
355
-  #endif
369
+
370
+  #endif // HAS_BED_PROBE
356 371
 
357 372
 #endif // CARTESIAN
358 373
 

+ 9
- 3
Marlin/src/module/probe.cpp Parādīt failu

@@ -56,8 +56,6 @@
56 56
   #include "../feature/backlash.h"
57 57
 #endif
58 58
 
59
-xyz_pos_t probe_offset; // Initialized by settings.load()
60
-
61 59
 #if ENABLED(BLTOUCH)
62 60
   #include "../feature/bltouch.h"
63 61
 #endif
@@ -86,6 +84,14 @@ xyz_pos_t probe_offset; // Initialized by settings.load()
86 84
 #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
87 85
 #include "../core/debug_out.h"
88 86
 
87
+
88
+xyz_pos_t probe_offset; // Initialized by settings.load()
89
+
90
+#if HAS_PROBE_XY_OFFSET
91
+  xyz_pos_t &probe_offset_xy = probe_offset;
92
+#endif
93
+
94
+
89 95
 #if ENABLED(Z_PROBE_SLED)
90 96
 
91 97
   #ifndef SLED_DOCKING_OFFSET
@@ -698,7 +704,7 @@ float probe_at_point(const float &rx, const float &ry, const ProbePtRaise raise_
698 704
   xyz_pos_t npos = { rx, ry };
699 705
   if (probe_relative) {
700 706
     if (!position_is_reachable_by_probe(npos)) return NAN;  // The given position is in terms of the probe
701
-    npos -= probe_offset;                                   // Get the nozzle position
707
+    npos -= probe_offset_xy;                                // Get the nozzle position
702 708
   }
703 709
   else if (!position_is_reachable(npos)) return NAN;        // The given position is in terms of the nozzle
704 710
 

+ 12
- 19
Marlin/src/module/probe.h Parādīt failu

@@ -31,6 +31,12 @@
31 31
 
32 32
   extern xyz_pos_t probe_offset;
33 33
 
34
+  #if HAS_PROBE_XY_OFFSET
35
+    extern xyz_pos_t &probe_offset_xy;
36
+  #else
37
+    constexpr xy_pos_t probe_offset_xy{0};
38
+  #endif
39
+
34 40
   bool set_probe_deployed(const bool deploy);
35 41
   #ifdef Z_AFTER_PROBING
36 42
     void move_z_after_probing();
@@ -54,6 +60,7 @@
54 60
 #else
55 61
 
56 62
   constexpr xyz_pos_t probe_offset{0};
63
+  constexpr xy_pos_t probe_offset_xy{0};
57 64
 
58 65
   #define DEPLOY_PROBE()
59 66
   #define STOW_PROBE()
@@ -71,13 +78,7 @@
71 78
     );
72 79
 
73 80
     inline float probe_radius() {
74
-      return printable_radius - (
75
-        #if HAS_BED_PROBE
76
-          _MAX(MIN_PROBE_EDGE, HYPOT(probe_offset.x, probe_offset.y))
77
-        #else
78
-          MIN_PROBE_EDGE
79
-        #endif
80
-      );
81
+      return printable_radius - _MAX(MIN_PROBE_EDGE, HYPOT(probe_offset_xy.x, probe_offset_xy.y));
81 82
     }
82 83
   #endif
83 84
 
@@ -85,10 +86,8 @@
85 86
     return (
86 87
       #if IS_KINEMATIC
87 88
         (X_CENTER) - probe_radius()
88
-      #elif ENABLED(NOZZLE_AS_PROBE)
89
-        _MAX(MIN_PROBE_EDGE_LEFT, X_MIN_POS)
90 89
       #else
91
-        _MAX((X_MIN_BED) + (MIN_PROBE_EDGE_LEFT), (X_MIN_POS) + probe_offset.x)
90
+        _MAX((X_MIN_BED) + (MIN_PROBE_EDGE_LEFT), (X_MIN_POS) + probe_offset_xy.x)
92 91
       #endif
93 92
     );
94 93
   }
@@ -96,10 +95,8 @@
96 95
     return (
97 96
       #if IS_KINEMATIC
98 97
         (X_CENTER) + probe_radius()
99
-      #elif ENABLED(NOZZLE_AS_PROBE)
100
-        _MAX(MIN_PROBE_EDGE_RIGHT, X_MAX_POS)
101 98
       #else
102
-        _MIN((X_MAX_BED) - (MIN_PROBE_EDGE_RIGHT), (X_MAX_POS) + probe_offset.x)
99
+        _MIN((X_MAX_BED) - (MIN_PROBE_EDGE_RIGHT), (X_MAX_POS) + probe_offset_xy.x)
103 100
       #endif
104 101
     );
105 102
   }
@@ -107,10 +104,8 @@
107 104
     return (
108 105
       #if IS_KINEMATIC
109 106
         (Y_CENTER) - probe_radius()
110
-      #elif ENABLED(NOZZLE_AS_PROBE)
111
-        _MIN(MIN_PROBE_EDGE_FRONT, Y_MIN_POS)
112 107
       #else
113
-        _MAX((Y_MIN_BED) + (MIN_PROBE_EDGE_FRONT), (Y_MIN_POS) + probe_offset.y)
108
+        _MAX((Y_MIN_BED) + (MIN_PROBE_EDGE_FRONT), (Y_MIN_POS) + probe_offset_xy.y)
114 109
       #endif
115 110
     );
116 111
   }
@@ -118,10 +113,8 @@
118 113
     return (
119 114
       #if IS_KINEMATIC
120 115
         (Y_CENTER) + probe_radius()
121
-      #elif ENABLED(NOZZLE_AS_PROBE)
122
-        _MAX(MIN_PROBE_EDGE_BACK, Y_MAX_POS)
123 116
       #else
124
-        _MIN((Y_MAX_BED) - (MIN_PROBE_EDGE_BACK), (Y_MAX_POS) + probe_offset.y)
117
+        _MIN((Y_MAX_BED) - (MIN_PROBE_EDGE_BACK), (Y_MAX_POS) + probe_offset_xy.y)
125 118
       #endif
126 119
     );
127 120
   }

+ 2
- 1
buildroot/share/tests/LPC1768-tests Parādīt failu

@@ -45,7 +45,8 @@ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT ADAPTIVE_FAN_
45 45
            Z_SAFE_HOMING ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE \
46 46
            LCD_INFO_MENU ARC_SUPPORT BEZIER_CURVE_SUPPORT EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES SDCARD_SORT_ALPHA
47 47
 opt_set GRID_MAX_POINTS_X 16
48
-exec_test $1 $2 "Re-ARM with Many Features"
48
+opt_set NOZZLE_TO_PROBE_OFFSET "{ 0, 0, 0 }"
49
+exec_test $1 $2 "Re-ARM with NOZZLE_AS_PROBE and many features."
49 50
 
50 51
 # clean up
51 52
 restore_configs

Notiek ielāde…
Atcelt
Saglabāt