Browse Source

Improve Delta probing / calibration (#15887)

Jason Smith 5 years ago
parent
commit
b904ba0f29

+ 2
- 11
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -1387,17 +1387,8 @@
1387 1387
                   dx = (x_max - x_min) / (g29_grid_size - 1),
1388 1388
                   dy = (y_max - y_min) / (g29_grid_size - 1);
1389 1389
 
1390
-      const vector_3 points[3] = {
1391
-        #if ENABLED(HAS_FIXED_3POINT)
1392
-          { PROBE_PT_1_X, PROBE_PT_1_Y, 0 },
1393
-          { PROBE_PT_2_X, PROBE_PT_2_Y, 0 },
1394
-          { PROBE_PT_3_X, PROBE_PT_3_Y, 0 }
1395
-        #else
1396
-          { x_min, y_min, 0 },
1397
-          { x_max, y_min, 0 },
1398
-          { (x_max - x_min) / 2, y_max, 0 }
1399
-        #endif
1400
-      };
1390
+      xy_float_t points[3];
1391
+      get_three_probe_points(points);
1401 1392
 
1402 1393
       float measured_z;
1403 1394
       bool abort_flag = false;

+ 3
- 15
Marlin/src/gcode/bedlevel/abl/G29.cpp View File

@@ -263,20 +263,8 @@ G29_TYPE GcodeSuite::G29() {
263 263
       int constexpr abl_points = 3; // used to show total points
264 264
     #endif
265 265
 
266
-    // Probe at 3 arbitrary points
267
-    const float x_min = probe_min_x(), x_max = probe_max_x(), y_min = probe_min_y(), y_max = probe_max_y();
268
-
269
-    ABL_VAR vector_3 points[3] = {
270
-      #if ENABLED(HAS_FIXED_3POINT)
271
-        { PROBE_PT_1_X, PROBE_PT_1_Y, 0 },
272
-        { PROBE_PT_2_X, PROBE_PT_2_Y, 0 },
273
-        { PROBE_PT_3_X, PROBE_PT_3_Y, 0 }
274
-      #else
275
-        { x_min, y_min, 0 },
276
-        { x_max, y_min, 0 },
277
-        { (x_max - x_min) / 2, y_max, 0 }
278
-      #endif
279
-    };
266
+    vector_3 points[3];
267
+    get_three_probe_points(points);
280 268
 
281 269
   #endif // AUTO_BED_LEVELING_3POINT
282 270
 
@@ -764,7 +752,7 @@ G29_TYPE GcodeSuite::G29() {
764 752
       for (uint8_t i = 0; i < 3; ++i) {
765 753
         if (verbose_level) SERIAL_ECHOLNPAIR("Probing point ", int(i), "/3.");
766 754
         #if HAS_DISPLAY
767
-          ui.status_printf_P(0, PSTR(S_FMT" %i/3"), GET_TEXT(MSG_PROBING_MESH)), int(i);
755
+          ui.status_printf_P(0, PSTR(S_FMT" %i/3"), GET_TEXT(MSG_PROBING_MESH), int(i));
768 756
         #endif
769 757
 
770 758
         // Retain the last probe position

+ 16
- 13
Marlin/src/gcode/calibrate/G33.cpp View File

@@ -190,7 +190,7 @@ static float std_dev_points(float z_pt[NPP + 1], const bool _0p_cal, const bool
190 190
  */
191 191
 static float calibration_probe(const xy_pos_t &xy, const bool stow) {
192 192
   #if HAS_BED_PROBE
193
-    return probe_at_point(xy, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false);
193
+    return probe_at_point(xy, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, true);
194 194
   #else
195 195
     UNUSED(stow);
196 196
     return lcd_probe_pt(xy);
@@ -222,6 +222,8 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
222 222
 
223 223
   if (!_0p_calibration) {
224 224
 
225
+    const float dcr = delta_calibration_radius();
226
+
225 227
     if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
226 228
       const xy_pos_t center{0};
227 229
       z_pt[CEN] += calibration_probe(center, stow_after_each);
@@ -233,7 +235,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
233 235
                   steps  = _7p_9_center ? _4P_STEP / 3.0f : _7p_6_center ? _7P_STEP : _4P_STEP;
234 236
       I_LOOP_CAL_PT(rad, start, steps) {
235 237
         const float a = RADIANS(210 + (360 / NPP) *  (rad - 1)),
236
-                    r = delta_calibration_radius * 0.1;
238
+                    r = dcr * 0.1;
237 239
         const xy_pos_t vec = { cos(a), sin(a) };
238 240
         z_pt[CEN] += calibration_probe(vec * r, stow_after_each);
239 241
         if (isnan(z_pt[CEN])) return false;
@@ -257,7 +259,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
257 259
         const int8_t offset = _7p_9_center ? 2 : 0;
258 260
         for (int8_t circle = 0; circle <= offset; circle++) {
259 261
           const float a = RADIANS(210 + (360 / NPP) *  (rad - 1)),
260
-                      r = delta_calibration_radius * (1 - 0.1 * (zig_zag ? offset - circle : circle)),
262
+                      r = dcr * (1 - 0.1 * (zig_zag ? offset - circle : circle)),
261 263
                       interpol = FMOD(rad, 1);
262 264
           const xy_pos_t vec = { cos(a), sin(a) };
263 265
           const float z_temp = calibration_probe(vec * r, stow_after_each);
@@ -287,9 +289,10 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
287 289
 static void reverse_kinematics_probe_points(float z_pt[NPP + 1], abc_float_t mm_at_pt_axis[NPP + 1]) {
288 290
   xyz_pos_t pos{0};
289 291
 
292
+  const float dcr = delta_calibration_radius();
290 293
   LOOP_CAL_ALL(rad) {
291 294
     const float a = RADIANS(210 + (360 / NPP) *  (rad - 1)),
292
-                r = (rad == CEN ? 0.0f : delta_calibration_radius);
295
+                r = (rad == CEN ? 0.0f : dcr);
293 296
     pos.set(cos(a) * r, sin(a) * r, z_pt[rad]);
294 297
     inverse_kinematics(pos);
295 298
     mm_at_pt_axis[rad] = delta;
@@ -297,7 +300,7 @@ static void reverse_kinematics_probe_points(float z_pt[NPP + 1], abc_float_t mm_
297 300
 }
298 301
 
299 302
 static void forward_kinematics_probe_points(abc_float_t mm_at_pt_axis[NPP + 1], float z_pt[NPP + 1]) {
300
-  const float r_quot = delta_calibration_radius / delta_radius;
303
+  const float r_quot = delta_calibration_radius() / delta_radius;
301 304
 
302 305
   #define ZPP(N,I,A) (((1.0f + r_quot * (N)) / 3.0f) * mm_at_pt_axis[I].A)
303 306
   #define Z00(I, A) ZPP( 0, I, A)
@@ -338,7 +341,7 @@ static void calc_kinematics_diff_probe_points(float z_pt[NPP + 1], abc_float_t d
338 341
 }
339 342
 
340 343
 static float auto_tune_h() {
341
-  const float r_quot = delta_calibration_radius / delta_radius;
344
+  const float r_quot = delta_calibration_radius() / delta_radius;
342 345
   return RECIPROCAL(r_quot / (2.0f / 3.0f));  // (2/3)/CR
343 346
 }
344 347
 
@@ -450,12 +453,13 @@ void GcodeSuite::G33() {
450 453
 
451 454
   SERIAL_ECHOLNPGM("G33 Auto Calibrate");
452 455
 
456
+  const float dcr = delta_calibration_radius();
457
+
453 458
   if (!_1p_calibration && !_0p_calibration) { // test if the outer radius is reachable
454 459
     LOOP_CAL_RAD(axis) {
455
-      const float a = RADIANS(210 + (360 / NPP) *  (axis - 1)),
456
-                  r = delta_calibration_radius;
457
-      if (!position_is_reachable(cos(a) * r, sin(a) * r)) {
458
-        SERIAL_ECHOLNPGM("?(M665 B)ed radius implausible.");
460
+      const float a = RADIANS(210 + (360 / NPP) *  (axis - 1));
461
+      if (!position_is_reachable(cos(a) * dcr, sin(a) * dcr)) {
462
+        SERIAL_ECHOLNPGM("?Bed calibration radius implausible.");
459 463
         return;
460 464
       }
461 465
     }
@@ -522,12 +526,11 @@ void GcodeSuite::G33() {
522 526
       #define Z0(I) ZP(0, I)
523 527
 
524 528
       // calculate factors
525
-      const float cr_old = delta_calibration_radius;
526
-      if (_7p_9_center) delta_calibration_radius *= 0.9f;
529
+      if (_7p_9_center) calibration_radius_factor = 0.9f;
527 530
       h_factor = auto_tune_h();
528 531
       r_factor = auto_tune_r();
529 532
       a_factor = auto_tune_a();
530
-      delta_calibration_radius = cr_old;
533
+      calibration_radius_factor = 1.0f;
531 534
 
532 535
       switch (probe_points) {
533 536
         case 0:

+ 0
- 2
Marlin/src/gcode/calibrate/M665.cpp View File

@@ -37,7 +37,6 @@
37 37
    *    L = diagonal rod
38 38
    *    R = delta radius
39 39
    *    S = segments per second
40
-   *    B = delta calibration radius
41 40
    *    X = Alpha (Tower 1) angle trim
42 41
    *    Y = Beta (Tower 2) angle trim
43 42
    *    Z = Gamma (Tower 3) angle trim
@@ -47,7 +46,6 @@
47 46
     if (parser.seen('L')) delta_diagonal_rod        = parser.value_linear_units();
48 47
     if (parser.seen('R')) delta_radius              = parser.value_linear_units();
49 48
     if (parser.seen('S')) delta_segments_per_second = parser.value_float();
50
-    if (parser.seen('B')) delta_calibration_radius  = parser.value_float();
51 49
     if (parser.seen('X')) delta_tower_angle_trim.a  = parser.value_float();
52 50
     if (parser.seen('Y')) delta_tower_angle_trim.b  = parser.value_float();
53 51
     if (parser.seen('Z')) delta_tower_angle_trim.c  = parser.value_float();

+ 35
- 80
Marlin/src/inc/Conditionals_post.h View File

@@ -132,10 +132,12 @@
132 132
 
133 133
 /**
134 134
  * SCARA cannot use SLOWDOWN and requires QUICKHOME
135
+ * Printable radius assumes joints can fully extend
135 136
  */
136 137
 #if IS_SCARA
137 138
   #undef SLOWDOWN
138 139
   #define QUICK_HOME
140
+  #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2)
139 141
 #endif
140 142
 
141 143
 /**
@@ -1434,6 +1436,7 @@
1434 1436
 #define PLANNER_LEVELING      (HAS_LEVELING && DISABLED(AUTO_BED_LEVELING_UBL))
1435 1437
 #define HAS_PROBING_PROCEDURE (HAS_ABL_OR_UBL || ENABLED(Z_MIN_PROBE_REPEATABILITY_TEST))
1436 1438
 #define HAS_POSITION_MODIFIERS (ENABLED(FWRETRACT) || HAS_LEVELING || ENABLED(SKEW_CORRECTION))
1439
+#define NEEDS_THREE_PROBE_POINTS EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT)
1437 1440
 
1438 1441
 #if ENABLED(AUTO_BED_LEVELING_UBL)
1439 1442
   #undef LCD_BED_LEVELING
@@ -1470,37 +1473,37 @@
1470 1473
 #endif
1471 1474
 
1472 1475
 /**
1473
- * Bed Probing rectangular bounds
1474
- * These can be further constrained in code for Delta and SCARA
1476
+ * Bed Probing bounds
1475 1477
  */
1478
+
1476 1479
 #ifndef MIN_PROBE_EDGE
1477 1480
   #define MIN_PROBE_EDGE 0
1478 1481
 #endif
1479
-#ifndef MIN_PROBE_EDGE_LEFT
1480
-  #define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE
1481
-#endif
1482
-#ifndef MIN_PROBE_EDGE_RIGHT
1483
-  #define MIN_PROBE_EDGE_RIGHT MIN_PROBE_EDGE
1484
-#endif
1485
-#ifndef MIN_PROBE_EDGE_FRONT
1486
-  #define MIN_PROBE_EDGE_FRONT MIN_PROBE_EDGE
1487
-#endif
1488
-#ifndef MIN_PROBE_EDGE_BACK
1489
-  #define MIN_PROBE_EDGE_BACK MIN_PROBE_EDGE
1482
+
1483
+#if IS_KINEMATIC
1484
+  #undef MIN_PROBE_EDGE_LEFT
1485
+  #undef MIN_PROBE_EDGE_RIGHT
1486
+  #undef MIN_PROBE_EDGE_FRONT
1487
+  #undef MIN_PROBE_EDGE_BACK
1488
+#else
1489
+  #ifndef MIN_PROBE_EDGE_LEFT
1490
+    #define MIN_PROBE_EDGE_LEFT MIN_PROBE_EDGE
1491
+  #endif
1492
+  #ifndef MIN_PROBE_EDGE_RIGHT
1493
+    #define MIN_PROBE_EDGE_RIGHT MIN_PROBE_EDGE
1494
+  #endif
1495
+  #ifndef MIN_PROBE_EDGE_FRONT
1496
+    #define MIN_PROBE_EDGE_FRONT MIN_PROBE_EDGE
1497
+  #endif
1498
+  #ifndef MIN_PROBE_EDGE_BACK
1499
+    #define MIN_PROBE_EDGE_BACK MIN_PROBE_EDGE
1500
+  #endif
1490 1501
 #endif
1491 1502
 
1492 1503
 #if ENABLED(DELTA)
1493 1504
   /**
1494 1505
    * Delta radius/rod trimmers/angle trimmers
1495 1506
    */
1496
-  #define _PROBE_RADIUS (DELTA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE))
1497
-  #ifndef DELTA_CALIBRATION_RADIUS
1498
-    #if HAS_BED_PROBE
1499
-      #define DELTA_CALIBRATION_RADIUS (DELTA_PRINTABLE_RADIUS - _MAX(ABS(probe_offset.x), ABS(probe_offset.y), ABS(MIN_PROBE_EDGE)))
1500
-    #else
1501
-      #define DELTA_CALIBRATION_RADIUS _PROBE_RADIUS
1502
-    #endif
1503
-  #endif
1504 1507
   #ifndef DELTA_ENDSTOP_ADJ
1505 1508
     #define DELTA_ENDSTOP_ADJ { 0, 0, 0 }
1506 1509
   #endif
@@ -1513,24 +1516,6 @@
1513 1516
   #ifndef DELTA_DIAGONAL_ROD_TRIM_TOWER
1514 1517
     #define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0, 0, 0 }
1515 1518
   #endif
1516
-
1517
-  // Probing points may be verified at compile time within the radius
1518
-  // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!")
1519
-  // so that may be added to SanityCheck.h in the future.
1520
-  #define PROBE_X_MIN (X_CENTER - (_PROBE_RADIUS))
1521
-  #define PROBE_Y_MIN (Y_CENTER - (_PROBE_RADIUS))
1522
-  #define PROBE_X_MAX (X_CENTER + _PROBE_RADIUS)
1523
-  #define PROBE_Y_MAX (Y_CENTER + _PROBE_RADIUS)
1524
-
1525
-#elif IS_SCARA
1526
-
1527
-  #define SCARA_PRINTABLE_RADIUS (SCARA_LINKAGE_1 + SCARA_LINKAGE_2)
1528
-  #define _PROBE_RADIUS (SCARA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE))
1529
-  #define PROBE_X_MIN (X_CENTER - (SCARA_PRINTABLE_RADIUS) + MIN_PROBE_EDGE_LEFT)
1530
-  #define PROBE_Y_MIN (Y_CENTER - (SCARA_PRINTABLE_RADIUS) + MIN_PROBE_EDGE_FRONT)
1531
-  #define PROBE_X_MAX (X_CENTER +  SCARA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE_RIGHT))
1532
-  #define PROBE_Y_MAX (Y_CENTER +  SCARA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE_BACK))
1533
-
1534 1519
 #endif
1535 1520
 
1536 1521
 #if ENABLED(SEGMENT_LEVELED_MOVES) && !defined(LEVELED_SEGMENT_LENGTH)
@@ -1540,7 +1525,7 @@
1540 1525
 /**
1541 1526
  * Default mesh area is an area with an inset margin on the print area.
1542 1527
  */
1543
-#if HAS_LEVELING
1528
+#if EITHER(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL)
1544 1529
   #if IS_KINEMATIC
1545 1530
     // Probing points may be verified at compile time within the radius
1546 1531
     // using static_assert(HYPOT2(X2-X1,Y2-Y1)<=sq(DELTA_PRINTABLE_RADIUS),"bad probe point!")
@@ -1551,17 +1536,10 @@
1551 1536
     #define _MESH_MAX_Y (Y_MAX_BED - (MESH_INSET))
1552 1537
   #else
1553 1538
     // Boundaries for Cartesian probing based on set limits
1554
-    #if ANY(MESH_BED_LEVELING, AUTO_BED_LEVELING_UBL, PROBE_MANUALLY)
1555
-      #define _MESH_MIN_X (_MAX(X_MIN_BED + MESH_INSET, X_MIN_POS))  // UBL is careful not to probe off the bed.  It does not
1556
-      #define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS))  // need NOZZLE_TO_PROBE_OFFSET in the mesh dimensions
1557
-      #define _MESH_MAX_X (_MIN(X_MAX_BED - (MESH_INSET), X_MAX_POS))
1558
-      #define _MESH_MAX_Y (_MIN(Y_MAX_BED - (MESH_INSET), Y_MAX_POS))
1559
-    #else
1560
-      #define _MESH_MIN_X (_MAX(X_MIN_BED + MESH_INSET, X_MIN_POS + probe_offset.x))
1561
-      #define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS + probe_offset.y))
1562
-      #define _MESH_MAX_X (_MIN(X_MAX_BED - (MESH_INSET), X_MAX_POS + probe_offset.x))
1563
-      #define _MESH_MAX_Y (_MIN(Y_MAX_BED - (MESH_INSET), Y_MAX_POS + probe_offset.y))
1564
-    #endif
1539
+    #define _MESH_MIN_X (_MAX(X_MIN_BED + MESH_INSET, X_MIN_POS))  // UBL is careful not to probe off the bed.  It does not
1540
+    #define _MESH_MIN_Y (_MAX(Y_MIN_BED + MESH_INSET, Y_MIN_POS))  // need NOZZLE_TO_PROBE_OFFSET in the mesh dimensions
1541
+    #define _MESH_MAX_X (_MIN(X_MAX_BED - (MESH_INSET), X_MAX_POS))
1542
+    #define _MESH_MAX_Y (_MIN(Y_MAX_BED - (MESH_INSET), Y_MAX_POS))
1565 1543
   #endif
1566 1544
 
1567 1545
   // These may be overridden in Configuration.h if a smaller area is desired
@@ -1577,40 +1555,17 @@
1577 1555
   #ifndef MESH_MAX_Y
1578 1556
     #define MESH_MAX_Y _MESH_MAX_Y
1579 1557
   #endif
1580
-
1581
-#endif // MESH_BED_LEVELING || AUTO_BED_LEVELING_UBL
1558
+#else
1559
+  #undef MESH_MIN_X
1560
+  #undef MESH_MIN_Y
1561
+  #undef MESH_MAX_X
1562
+  #undef MESH_MAX_Y
1563
+#endif
1582 1564
 
1583 1565
 #if (defined(PROBE_PT_1_X) && defined(PROBE_PT_2_X) && defined(PROBE_PT_3_X) && defined(PROBE_PT_1_Y) && defined(PROBE_PT_2_Y) && defined(PROBE_PT_3_Y))
1584 1566
   #define HAS_FIXED_3POINT
1585 1567
 #endif
1586 1568
 
1587
-#if EITHER(AUTO_BED_LEVELING_UBL, AUTO_BED_LEVELING_3POINT) && IS_KINEMATIC
1588
-    #define HAS_FIXED_3POINT
1589
-    #define SIN0    0.0
1590
-    #define SIN120  0.866025
1591
-    #define SIN240 -0.866025
1592
-    #define COS0    1.0
1593
-    #define COS120 -0.5
1594
-    #define COS240 -0.5
1595
-    #ifndef PROBE_PT_1_X
1596
-      #define PROBE_PT_1_X (X_CENTER + (_PROBE_RADIUS) * COS0)
1597
-    #endif
1598
-    #ifndef PROBE_PT_1_Y
1599
-      #define PROBE_PT_1_Y (Y_CENTER + (_PROBE_RADIUS) * SIN0)
1600
-    #endif
1601
-    #ifndef PROBE_PT_2_X
1602
-      #define PROBE_PT_2_X (X_CENTER + (_PROBE_RADIUS) * COS120)
1603
-    #endif
1604
-    #ifndef PROBE_PT_2_Y
1605
-      #define PROBE_PT_2_Y (Y_CENTER + (_PROBE_RADIUS) * SIN120)
1606
-    #endif
1607
-    #ifndef PROBE_PT_3_X
1608
-      #define PROBE_PT_3_X (X_CENTER + (_PROBE_RADIUS) * COS240)
1609
-    #endif
1610
-    #ifndef PROBE_PT_3_Y
1611
-      #define PROBE_PT_3_Y (Y_CENTER + (_PROBE_RADIUS) * SIN240)
1612
-    #endif
1613
-#endif
1614 1569
 
1615 1570
 /**
1616 1571
  * Buzzer/Speaker

+ 2
- 0
Marlin/src/inc/SanityCheck.h View File

@@ -245,6 +245,8 @@
245 245
   #error "NEOPIXEL_RGBW_LED is now NEOPIXEL_LED. Please update your configuration."
246 246
 #elif ENABLED(DELTA) && defined(DELTA_PROBEABLE_RADIUS)
247 247
   #error "Remove DELTA_PROBEABLE_RADIUS and use MIN_PROBE_EDGE to inset the probe area instead."
248
+#elif ENABLED(DELTA) && defined(DELTA_CALIBRATION_RADIUS)
249
+  #error "Remove DELTA_CALIBRATION_RADIUS and use MIN_PROBE_EDGE to inset the probe area instead."
248 250
 #elif defined(UBL_MESH_INSET)
249 251
   #error "UBL_MESH_INSET is now just MESH_INSET. Please update your configuration."
250 252
 #elif defined(UBL_MESH_MIN_X) || defined(UBL_MESH_MIN_Y) || defined(UBL_MESH_MAX_X) || defined(UBL_MESH_MAX_Y)

+ 1
- 1
Marlin/src/lcd/menu/menu_delta_calibrate.cpp View File

@@ -85,7 +85,7 @@ void _man_probe_pt(const xy_pos_t &xy) {
85 85
 
86 86
   void _goto_tower_a(const float &a) {
87 87
     xy_pos_t tower_vec = { cos(RADIANS(a)), sin(RADIANS(a)) };
88
-    _man_probe_pt(tower_vec * delta_calibration_radius);
88
+    _man_probe_pt(tower_vec * delta_calibration_radius());
89 89
   }
90 90
   void _goto_tower_x() { _goto_tower_a(210); }
91 91
   void _goto_tower_y() { _goto_tower_a(330); }

+ 1
- 0
Marlin/src/libs/vector_3.h View File

@@ -50,6 +50,7 @@ struct vector_3 : xyz_float_t {
50 50
   vector_3(const xy_float_t   &in) { set(in.x, in.y); }
51 51
   vector_3(const xyz_float_t  &in) { set(in.x, in.y, in.z); }
52 52
   vector_3(const xyze_float_t &in) { set(in.x, in.y, in.z); }
53
+  vector_3() { reset(); }
53 54
 
54 55
   // Factory method
55 56
   static vector_3 cross(const vector_3 &a, const vector_3 &b);

+ 3
- 8
Marlin/src/module/configuration_store.cpp View File

@@ -37,7 +37,7 @@
37 37
  */
38 38
 
39 39
 // Change EEPROM version if the structure changes
40
-#define EEPROM_VERSION "V71"
40
+#define EEPROM_VERSION "V72"
41 41
 #define EEPROM_OFFSET 100
42 42
 
43 43
 // Check the integrity of data offsets.
@@ -223,8 +223,7 @@ typedef struct SettingsDataStruct {
223 223
     abc_float_t delta_endstop_adj;                      // M666 XYZ
224 224
     float delta_radius,                                 // M665 R
225 225
           delta_diagonal_rod,                           // M665 L
226
-          delta_segments_per_second,                    // M665 S
227
-          delta_calibration_radius;                     // M665 B
226
+          delta_segments_per_second;                    // M665 S
228 227
     abc_float_t delta_tower_angle_trim;                 // M665 XYZ
229 228
   #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
230 229
     float x2_endstop_adj,                               // M666 X
@@ -724,7 +723,6 @@ void MarlinSettings::postprocess() {
724 723
         EEPROM_WRITE(delta_radius);              // 1 float
725 724
         EEPROM_WRITE(delta_diagonal_rod);        // 1 float
726 725
         EEPROM_WRITE(delta_segments_per_second); // 1 float
727
-        EEPROM_WRITE(delta_calibration_radius);  // 1 float
728 726
         EEPROM_WRITE(delta_tower_angle_trim);    // 3 floats
729 727
 
730 728
       #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
@@ -1534,7 +1532,6 @@ void MarlinSettings::postprocess() {
1534 1532
           EEPROM_READ(delta_radius);              // 1 float
1535 1533
           EEPROM_READ(delta_diagonal_rod);        // 1 float
1536 1534
           EEPROM_READ(delta_segments_per_second); // 1 float
1537
-          EEPROM_READ(delta_calibration_radius);  // 1 float
1538 1535
           EEPROM_READ(delta_tower_angle_trim);    // 3 floats
1539 1536
 
1540 1537
         #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
@@ -2375,7 +2372,6 @@ void MarlinSettings::reset() {
2375 2372
     delta_radius = DELTA_RADIUS;
2376 2373
     delta_diagonal_rod = DELTA_DIAGONAL_ROD;
2377 2374
     delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
2378
-    delta_calibration_radius = DELTA_CALIBRATION_RADIUS;
2379 2375
     delta_tower_angle_trim = dta;
2380 2376
 
2381 2377
   #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS
@@ -2939,14 +2935,13 @@ void MarlinSettings::reset() {
2939 2935
         , " Z", LINEAR_UNIT(delta_endstop_adj.c)
2940 2936
       );
2941 2937
 
2942
-      CONFIG_ECHO_HEADING("Delta settings: L<diagonal_rod> R<radius> H<height> S<segments_per_s> B<calibration radius> XYZ<tower angle corrections>");
2938
+      CONFIG_ECHO_HEADING("Delta settings: L<diagonal_rod> R<radius> H<height> S<segments_per_s> XYZ<tower angle corrections>");
2943 2939
       CONFIG_ECHO_START();
2944 2940
       SERIAL_ECHOLNPAIR(
2945 2941
           "  M665 L", LINEAR_UNIT(delta_diagonal_rod)
2946 2942
         , " R", LINEAR_UNIT(delta_radius)
2947 2943
         , " H", LINEAR_UNIT(delta_height)
2948 2944
         , " S", delta_segments_per_second
2949
-        , " B", LINEAR_UNIT(delta_calibration_radius)
2950 2945
         , " X", LINEAR_UNIT(delta_tower_angle_trim.a)
2951 2946
         , " Y", LINEAR_UNIT(delta_tower_angle_trim.b)
2952 2947
         , " Z", LINEAR_UNIT(delta_tower_angle_trim.c)

+ 19
- 2
Marlin/src/module/delta.cpp View File

@@ -54,8 +54,7 @@ float delta_height;
54 54
 abc_float_t delta_endstop_adj{0};
55 55
 float delta_radius,
56 56
       delta_diagonal_rod,
57
-      delta_segments_per_second,
58
-      delta_calibration_radius;
57
+      delta_segments_per_second;
59 58
 abc_float_t delta_tower_angle_trim;
60 59
 xy_float_t delta_tower[ABC];
61 60
 abc_float_t delta_diagonal_rod_2_tower;
@@ -84,6 +83,24 @@ void recalc_delta_settings() {
84 83
 }
85 84
 
86 85
 /**
86
+ * Get a safe radius for calibration
87
+ */
88
+
89
+#if ENABLED(DELTA_AUTO_CALIBRATION)
90
+  float calibration_radius_factor = 1;
91
+#endif
92
+
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);
101
+}
102
+
103
+/**
87 104
  * Delta Inverse Kinematics
88 105
  *
89 106
  * Calculate the tower positions for a given machine

+ 12
- 2
Marlin/src/module/delta.h View File

@@ -31,8 +31,7 @@ extern float delta_height;
31 31
 extern abc_float_t delta_endstop_adj;
32 32
 extern float delta_radius,
33 33
              delta_diagonal_rod,
34
-             delta_segments_per_second,
35
-             delta_calibration_radius;
34
+             delta_segments_per_second;
36 35
 extern abc_float_t delta_tower_angle_trim;
37 36
 extern xy_float_t delta_tower[ABC];
38 37
 extern abc_float_t delta_diagonal_rod_2_tower;
@@ -45,6 +44,17 @@ extern float delta_clip_start_height;
45 44
 void recalc_delta_settings();
46 45
 
47 46
 /**
47
+ * Get a safe radius for calibration
48
+ */
49
+#if ENABLED(DELTA_AUTO_CALIBRATION)
50
+  extern float calibration_radius_factor;
51
+#else
52
+  constexpr float calibration_radius_factor = 1;
53
+#endif
54
+
55
+float delta_calibration_radius();
56
+
57
+/**
48 58
  * Delta Inverse Kinematics
49 59
  *
50 60
  * Calculate the tower positions for a given machine

+ 55
- 22
Marlin/src/module/probe.h View File

@@ -60,48 +60,81 @@
60 60
 
61 61
 #endif
62 62
 
63
-#if HAS_LEVELING && (HAS_BED_PROBE || ENABLED(PROBE_MANUALLY))
63
+#if HAS_BED_PROBE || ENABLED(PROBE_MANUALLY)
64
+  #if IS_KINEMATIC
65
+    constexpr float printable_radius =
66
+      #if ENABLED(DELTA)
67
+        DELTA_PRINTABLE_RADIUS;
68
+      #elif IS_SCARA
69
+        SCARA_PRINTABLE_RADIUS;
70
+      #endif
71
+    
72
+    inline float probe_radius() {
73
+      return printable_radius -
74
+        #if HAS_BED_PROBE
75
+          _MAX(MIN_PROBE_EDGE, HYPOT(probe_offset.x, probe_offset.y));
76
+        #else
77
+          MIN_PROBE_EDGE;
78
+        #endif
79
+    }
80
+  #endif
81
+
64 82
   inline float probe_min_x() {
65
-    return _MAX(
83
+    return
66 84
       #if IS_KINEMATIC
67
-        PROBE_X_MIN, MESH_MIN_X
85
+        (X_CENTER) - probe_radius();
68 86
       #else
69
-        (X_MIN_BED) + (MIN_PROBE_EDGE_LEFT), (X_MIN_POS) + probe_offset.x
87
+        _MAX((X_MIN_BED) + (MIN_PROBE_EDGE_LEFT), (X_MIN_POS) + probe_offset.x);
70 88
       #endif
71
-    );
72 89
   }
73 90
   inline float probe_max_x() {
74
-    return _MIN(
91
+    return
75 92
       #if IS_KINEMATIC
76
-        PROBE_X_MAX, MESH_MAX_X
93
+        (X_CENTER) + probe_radius();
77 94
       #else
78
-        (X_MAX_BED) - (MIN_PROBE_EDGE_RIGHT), (X_MAX_POS) + probe_offset.x
95
+        _MIN((X_MAX_BED) - (MIN_PROBE_EDGE_RIGHT), (X_MAX_POS) + probe_offset.x);
79 96
       #endif
80
-    );
81 97
   }
82 98
   inline float probe_min_y() {
83
-    return _MAX(
99
+    return 
84 100
       #if IS_KINEMATIC
85
-        PROBE_Y_MIN, MESH_MIN_Y
101
+        (Y_CENTER) - probe_radius();
86 102
       #else
87
-        (Y_MIN_BED) + (MIN_PROBE_EDGE_FRONT), (Y_MIN_POS) + probe_offset.y
103
+        _MAX((Y_MIN_BED) + (MIN_PROBE_EDGE_FRONT), (Y_MIN_POS) + probe_offset.y);
88 104
       #endif
89
-    );
90 105
   }
91 106
   inline float probe_max_y() {
92
-    return _MIN(
107
+    return 
93 108
       #if IS_KINEMATIC
94
-        PROBE_Y_MAX, MESH_MAX_Y
109
+        (Y_CENTER) + probe_radius();
95 110
       #else
96
-        (Y_MAX_BED) - (MIN_PROBE_EDGE_BACK), (Y_MAX_POS) + probe_offset.y
111
+        _MIN((Y_MAX_BED) - (MIN_PROBE_EDGE_BACK), (Y_MAX_POS) + probe_offset.y);
97 112
       #endif
98
-    );
99 113
   }
100
-#else
101
-  inline float probe_min_x() { return 0; };
102
-  inline float probe_max_x() { return 0; };
103
-  inline float probe_min_y() { return 0; };
104
-  inline float probe_max_y() { return 0; };
114
+
115
+  #if NEEDS_THREE_PROBE_POINTS
116
+    // Retrieve three points to probe the bed. Any type exposing set(X,Y) may be used.
117
+    template <typename T>
118
+    inline void get_three_probe_points(T points[3]) {
119
+      #if ENABLED(HAS_FIXED_3POINT)
120
+        points[0].set(PROBE_PT_1_X, PROBE_PT_1_Y);
121
+        points[1].set(PROBE_PT_2_X, PROBE_PT_2_Y);
122
+        points[2].set(PROBE_PT_3_X, PROBE_PT_3_Y);
123
+      #else
124
+        #if IS_KINEMATIC
125
+          constexpr float SIN0 = 0.0, SIN120 = 0.866025, SIN240 = -0.866025,
126
+                          COS0 = 1.0, COS120 = -0.5    , COS240 = -0.5;
127
+          points[0].set((X_CENTER) + probe_radius() * COS0,   (Y_CENTER) + probe_radius() * SIN0);
128
+          points[1].set((X_CENTER) + probe_radius() * COS120, (Y_CENTER) + probe_radius() * SIN120);
129
+          points[2].set((X_CENTER) + probe_radius() * COS240, (Y_CENTER) + probe_radius() * SIN240);
130
+        #else
131
+          points[0].set(probe_min_x(), probe_min_y());
132
+          points[1].set(probe_max_x(), probe_min_y());
133
+          points[2].set((probe_max_x() - probe_min_x()) / 2, probe_max_y());
134
+        #endif
135
+      #endif
136
+    }
137
+  #endif
105 138
 #endif
106 139
 
107 140
 #if HAS_Z_SERVO_PROBE

+ 0
- 2
config/examples/delta/Anycubic/Kossel/Configuration.h View File

@@ -669,8 +669,6 @@
669 669
   #endif
670 670
 
671 671
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
672
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
673
-    #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE)  // (mm)
674 672
     // Set the steprate for papertest probing
675 673
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
676 674
   #endif

+ 0
- 2
config/examples/delta/Dreammaker/Overlord/Configuration.h View File

@@ -636,8 +636,6 @@
636 636
   #endif
637 637
 
638 638
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
639
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
640
-    #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE)  // (mm) Overlord 70mm
641 639
     // Set the steprate for papertest probing
642 640
     #define PROBE_MANUALLY_STEP 0.05                              // (mm)
643 641
   #endif

+ 0
- 2
config/examples/delta/Dreammaker/Overlord_Pro/Configuration.h View File

@@ -648,8 +648,6 @@
648 648
   #endif
649 649
 
650 650
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
651
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
652
-    #define DELTA_CALIBRATION_RADIUS DELTA_PRINTABLE_RADIUS - (MIN_PROBE_EDGE)  // (mm) Overlord Pro 80mm
653 651
     // Set the steprate for papertest probing
654 652
     #define PROBE_MANUALLY_STEP 0.05                              // (mm)
655 653
   #endif

+ 0
- 2
config/examples/delta/FLSUN/auto_calibrate/Configuration.h View File

@@ -636,8 +636,6 @@
636 636
   #endif
637 637
 
638 638
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
639
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
640
-    #define DELTA_CALIBRATION_RADIUS 73.5 // (mm)
641 639
     // Set the steprate for papertest probing
642 640
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
643 641
   #endif

+ 0
- 2
config/examples/delta/FLSUN/kossel/Configuration.h View File

@@ -636,8 +636,6 @@
636 636
   #endif
637 637
 
638 638
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
639
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
640
-    #define DELTA_CALIBRATION_RADIUS 63   // (mm)
641 639
     // Set the steprate for papertest probing
642 640
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
643 641
   #endif

+ 0
- 2
config/examples/delta/FLSUN/kossel_mini/Configuration.h View File

@@ -636,8 +636,6 @@
636 636
   #endif
637 637
 
638 638
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
639
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
640
-    #define DELTA_CALIBRATION_RADIUS 73.5 // (mm)
641 639
     // Set the steprate for papertest probing
642 640
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
643 641
   #endif

+ 0
- 2
config/examples/delta/Geeetech/Rostock 301/Configuration.h View File

@@ -626,8 +626,6 @@
626 626
   #endif
627 627
 
628 628
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
629
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
630
-    #define DELTA_CALIBRATION_RADIUS 121.5 // (mm)
631 629
     // Set the steprate for papertest probing
632 630
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
633 631
   #endif

+ 0
- 2
config/examples/delta/Hatchbox_Alpha/Configuration.h View File

@@ -641,8 +641,6 @@
641 641
   #endif
642 642
 
643 643
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
644
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
645
-    #define DELTA_CALIBRATION_RADIUS 121.5 // (mm)
646 644
     // Set the steprate for papertest probing
647 645
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
648 646
   #endif

+ 0
- 2
config/examples/delta/MKS/SBASE/Configuration.h View File

@@ -626,8 +626,6 @@
626 626
   #endif
627 627
 
628 628
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
629
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
630
-    #define DELTA_CALIBRATION_RADIUS 121.5 // (mm)
631 629
     // Set the steprate for papertest probing
632 630
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
633 631
   #endif

+ 0
- 2
config/examples/delta/Tevo Little Monster/Configuration.h View File

@@ -630,8 +630,6 @@
630 630
   #endif
631 631
 
632 632
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
633
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
634
-    #define DELTA_CALIBRATION_RADIUS 140  // (mm)
635 633
     // Set the steprate for papertest probing
636 634
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
637 635
   #endif

+ 0
- 2
config/examples/delta/generic/Configuration.h View File

@@ -626,8 +626,6 @@
626 626
   #endif
627 627
 
628 628
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
629
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
630
-    #define DELTA_CALIBRATION_RADIUS 121.5 // (mm)
631 629
     // Set the steprate for papertest probing
632 630
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
633 631
   #endif

+ 0
- 2
config/examples/delta/kossel_mini/Configuration.h View File

@@ -626,8 +626,6 @@
626 626
   #endif
627 627
 
628 628
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
629
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
630
-    #define DELTA_CALIBRATION_RADIUS 78.0 // (mm)
631 629
     // Set the steprate for papertest probing
632 630
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
633 631
   #endif

+ 0
- 2
config/examples/delta/kossel_pro/Configuration.h View File

@@ -612,8 +612,6 @@
612 612
   #endif
613 613
 
614 614
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
615
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
616
-    #define DELTA_CALIBRATION_RADIUS 110.0 // (mm)
617 615
     // Set the steprate for papertest probing
618 616
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
619 617
   #endif

+ 0
- 2
config/examples/delta/kossel_xl/Configuration.h View File

@@ -630,8 +630,6 @@
630 630
   #endif
631 631
 
632 632
   #if EITHER(DELTA_AUTO_CALIBRATION, DELTA_CALIBRATION_MENU)
633
-    // Set the radius for the calibration probe points - max DELTA_PRINTABLE_RADIUS for non-eccentric probes
634
-    #define DELTA_CALIBRATION_RADIUS 121.5 // (mm)
635 633
     // Set the steprate for papertest probing
636 634
     #define PROBE_MANUALLY_STEP 0.05      // (mm)
637 635
   #endif

Loading…
Cancel
Save