|
@@ -69,8 +69,6 @@ enum CalEnum : char { // the 7 main calibration points -
|
69
|
69
|
|
70
|
70
|
float lcd_probe_pt(const xy_pos_t &xy);
|
71
|
71
|
|
72
|
|
-float dcr;
|
73
|
|
-
|
74
|
72
|
void ac_home() {
|
75
|
73
|
endstops.enable(true);
|
76
|
74
|
TERN_(HAS_DELTA_SENSORLESS_PROBING, probe.set_homing_current(true));
|
|
@@ -177,7 +175,7 @@ static float std_dev_points(float z_pt[NPP + 1], const bool _0p_cal, const bool
|
177
|
175
|
*/
|
178
|
176
|
static float calibration_probe(const xy_pos_t &xy, const bool stow, const bool probe_at_offset) {
|
179
|
177
|
#if HAS_BED_PROBE
|
180
|
|
- return probe.probe_at_point(xy, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, true, probe_at_offset);
|
|
178
|
+ return probe.probe_at_point(xy, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, probe_at_offset, false);
|
181
|
179
|
#else
|
182
|
180
|
UNUSED(stow);
|
183
|
181
|
return lcd_probe_pt(xy);
|
|
@@ -187,7 +185,7 @@ static float calibration_probe(const xy_pos_t &xy, const bool stow, const bool p
|
187
|
185
|
/**
|
188
|
186
|
* - Probe a grid
|
189
|
187
|
*/
|
190
|
|
-static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_points, const bool towers_set, const bool stow_after_each, const bool probe_at_offset) {
|
|
188
|
+static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_points, const float dcr, const bool towers_set, const bool stow_after_each, const bool probe_at_offset) {
|
191
|
189
|
const bool _0p_calibration = probe_points == 0,
|
192
|
190
|
_1p_calibration = probe_points == 1 || probe_points == -1,
|
193
|
191
|
_4p_calibration = probe_points == 2,
|
|
@@ -271,7 +269,7 @@ static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_poi
|
271
|
269
|
* - formulae for approximative forward kinematics in the end-stop displacement matrix
|
272
|
270
|
* - definition of the matrix scaling parameters
|
273
|
271
|
*/
|
274
|
|
-static void reverse_kinematics_probe_points(float z_pt[NPP + 1], abc_float_t mm_at_pt_axis[NPP + 1]) {
|
|
272
|
+static void reverse_kinematics_probe_points(float z_pt[NPP + 1], abc_float_t mm_at_pt_axis[NPP + 1], const float dcr) {
|
275
|
273
|
xyz_pos_t pos{0};
|
276
|
274
|
|
277
|
275
|
LOOP_CAL_ALL(rad) {
|
|
@@ -283,7 +281,7 @@ static void reverse_kinematics_probe_points(float z_pt[NPP + 1], abc_float_t mm_
|
283
|
281
|
}
|
284
|
282
|
}
|
285
|
283
|
|
286
|
|
-static void forward_kinematics_probe_points(abc_float_t mm_at_pt_axis[NPP + 1], float z_pt[NPP + 1]) {
|
|
284
|
+static void forward_kinematics_probe_points(abc_float_t mm_at_pt_axis[NPP + 1], float z_pt[NPP + 1], const float dcr) {
|
287
|
285
|
const float r_quot = dcr / delta_radius;
|
288
|
286
|
|
289
|
287
|
#define ZPP(N,I,A) (((1.0f + r_quot * (N)) / 3.0f) * mm_at_pt_axis[I].A)
|
|
@@ -302,19 +300,19 @@ static void forward_kinematics_probe_points(abc_float_t mm_at_pt_axis[NPP + 1],
|
302
|
300
|
z_pt[_AB] = Zp1(_AB, a) + Zp1(_AB, b) + Zm2(_AB, c);
|
303
|
301
|
}
|
304
|
302
|
|
305
|
|
-static void calc_kinematics_diff_probe_points(float z_pt[NPP + 1], abc_float_t delta_e, const float delta_r, abc_float_t delta_t) {
|
|
303
|
+static void calc_kinematics_diff_probe_points(float z_pt[NPP + 1], const float dcr, abc_float_t delta_e, const float delta_r, abc_float_t delta_t) {
|
306
|
304
|
const float z_center = z_pt[CEN];
|
307
|
305
|
abc_float_t diff_mm_at_pt_axis[NPP + 1], new_mm_at_pt_axis[NPP + 1];
|
308
|
306
|
|
309
|
|
- reverse_kinematics_probe_points(z_pt, diff_mm_at_pt_axis);
|
|
307
|
+ reverse_kinematics_probe_points(z_pt, diff_mm_at_pt_axis, dcr);
|
310
|
308
|
|
311
|
309
|
delta_radius += delta_r;
|
312
|
310
|
delta_tower_angle_trim += delta_t;
|
313
|
311
|
recalc_delta_settings();
|
314
|
|
- reverse_kinematics_probe_points(z_pt, new_mm_at_pt_axis);
|
|
312
|
+ reverse_kinematics_probe_points(z_pt, new_mm_at_pt_axis, dcr);
|
315
|
313
|
|
316
|
314
|
LOOP_CAL_ALL(rad) diff_mm_at_pt_axis[rad] -= new_mm_at_pt_axis[rad] + delta_e;
|
317
|
|
- forward_kinematics_probe_points(diff_mm_at_pt_axis, z_pt);
|
|
315
|
+ forward_kinematics_probe_points(diff_mm_at_pt_axis, z_pt, dcr);
|
318
|
316
|
|
319
|
317
|
LOOP_CAL_RAD(rad) z_pt[rad] -= z_pt[CEN] - z_center;
|
320
|
318
|
z_pt[CEN] = z_center;
|
|
@@ -324,23 +322,23 @@ static void calc_kinematics_diff_probe_points(float z_pt[NPP + 1], abc_float_t d
|
324
|
322
|
recalc_delta_settings();
|
325
|
323
|
}
|
326
|
324
|
|
327
|
|
-static float auto_tune_h() {
|
|
325
|
+static float auto_tune_h(const float dcr) {
|
328
|
326
|
const float r_quot = dcr / delta_radius;
|
329
|
327
|
return RECIPROCAL(r_quot / (2.0f / 3.0f)); // (2/3)/CR
|
330
|
328
|
}
|
331
|
329
|
|
332
|
|
-static float auto_tune_r() {
|
|
330
|
+static float auto_tune_r(const float dcr) {
|
333
|
331
|
constexpr float diff = 0.01f, delta_r = diff;
|
334
|
332
|
float r_fac = 0.0f, z_pt[NPP + 1] = { 0.0f };
|
335
|
333
|
abc_float_t delta_e = { 0.0f }, delta_t = { 0.0f };
|
336
|
334
|
|
337
|
|
- calc_kinematics_diff_probe_points(z_pt, delta_e, delta_r, delta_t);
|
|
335
|
+ calc_kinematics_diff_probe_points(z_pt, dcr, delta_e, delta_r, delta_t);
|
338
|
336
|
r_fac = -(z_pt[__A] + z_pt[__B] + z_pt[__C] + z_pt[_BC] + z_pt[_CA] + z_pt[_AB]) / 6.0f;
|
339
|
337
|
r_fac = diff / r_fac / 3.0f; // 1/(3*delta_Z)
|
340
|
338
|
return r_fac;
|
341
|
339
|
}
|
342
|
340
|
|
343
|
|
-static float auto_tune_a() {
|
|
341
|
+static float auto_tune_a(const float dcr) {
|
344
|
342
|
constexpr float diff = 0.01f, delta_r = 0.0f;
|
345
|
343
|
float a_fac = 0.0f, z_pt[NPP + 1] = { 0.0f };
|
346
|
344
|
abc_float_t delta_e = { 0.0f }, delta_t = { 0.0f };
|
|
@@ -348,7 +346,7 @@ static float auto_tune_a() {
|
348
|
346
|
delta_t.reset();
|
349
|
347
|
LOOP_LINEAR_AXES(axis) {
|
350
|
348
|
delta_t[axis] = diff;
|
351
|
|
- calc_kinematics_diff_probe_points(z_pt, delta_e, delta_r, delta_t);
|
|
349
|
+ calc_kinematics_diff_probe_points(z_pt, dcr, delta_e, delta_r, delta_t);
|
352
|
350
|
delta_t[axis] = 0;
|
353
|
351
|
a_fac += z_pt[uint8_t((axis * _4P_STEP) - _7P_STEP + NPP) % NPP + 1] / 6.0f;
|
354
|
352
|
a_fac -= z_pt[uint8_t((axis * _4P_STEP) + 1 + _7P_STEP)] / 6.0f;
|
|
@@ -370,7 +368,7 @@ static float auto_tune_a() {
|
370
|
368
|
* P3 Probe all positions: center, towers and opposite towers. Calibrate all.
|
371
|
369
|
* P4-P10 Probe all positions at different intermediate locations and average them.
|
372
|
370
|
*
|
373
|
|
- * Rn.nn override default calibration Radius
|
|
371
|
+ * Rn.nn Temporary reduce the probe grid by the specified amount (mm)
|
374
|
372
|
*
|
375
|
373
|
* T Don't calibrate tower angle corrections
|
376
|
374
|
*
|
|
@@ -386,7 +384,7 @@ static float auto_tune_a() {
|
386
|
384
|
*
|
387
|
385
|
* E Engage the probe for each point
|
388
|
386
|
*
|
389
|
|
- * O Probe at offset points (this is wrong but it seems to work)
|
|
387
|
+ * O Probe at offsetted probe positions (this is wrong but it seems to work)
|
390
|
388
|
*
|
391
|
389
|
* With SENSORLESS_PROBING:
|
392
|
390
|
* Use these flags to calibrate stall sensitivity: (e.g., `G33 P1 Y Z` to calibrate X only.)
|
|
@@ -404,27 +402,17 @@ void GcodeSuite::G33() {
|
404
|
402
|
return;
|
405
|
403
|
}
|
406
|
404
|
|
407
|
|
- const bool probe_at_offset = TERN0(HAS_PROBE_XY_OFFSET, parser.boolval('O')),
|
|
405
|
+ const bool probe_at_offset = TERN0(HAS_PROBE_XY_OFFSET, parser.seen_test('O')),
|
408
|
406
|
towers_set = !parser.seen_test('T');
|
409
|
407
|
|
410
|
|
- float max_dcr = dcr = DELTA_PRINTABLE_RADIUS;
|
|
408
|
+ // The calibration radius is set to a calculated value
|
|
409
|
+ float dcr = probe_at_offset ? DELTA_PRINTABLE_RADIUS : DELTA_PRINTABLE_RADIUS - PROBING_MARGIN;
|
411
|
410
|
#if HAS_PROBE_XY_OFFSET
|
412
|
|
- // For offset probes the calibration radius is set to a safe but non-optimal value
|
413
|
|
- dcr -= HYPOT(probe.offset_xy.x, probe.offset_xy.y);
|
414
|
|
- if (probe_at_offset) {
|
415
|
|
- // With probe positions both probe and nozzle need to be within the printable area
|
416
|
|
- max_dcr = dcr;
|
417
|
|
- }
|
418
|
|
- // else with nozzle positions there is a risk of the probe being outside the bed
|
419
|
|
- // but as long the nozzle stays within the printable area there is no risk of
|
420
|
|
- // the effector crashing into the towers.
|
|
411
|
+ const float total_offset = HYPOT(probe.offset_xy.x, probe.offset_xy.y);
|
|
412
|
+ dcr -= probe_at_offset ? _MAX(total_offset, PROBING_MARGIN) : total_offset;
|
421
|
413
|
#endif
|
422
|
|
-
|
423
|
|
- if (parser.seenval('R')) dcr = parser.value_float();
|
424
|
|
- if (!WITHIN(dcr, 0, max_dcr)) {
|
425
|
|
- SERIAL_ECHOLNPGM("?calibration (R)adius implausible.");
|
426
|
|
- return;
|
427
|
|
- }
|
|
414
|
+ NOMORE(dcr, DELTA_PRINTABLE_RADIUS);
|
|
415
|
+ if (parser.seenval('R')) dcr -= _MAX(parser.value_float(),0);
|
428
|
416
|
|
429
|
417
|
const float calibration_precision = parser.floatval('C', 0.0f);
|
430
|
418
|
if (calibration_precision < 0) {
|
|
@@ -475,8 +463,9 @@ void GcodeSuite::G33() {
|
475
|
463
|
SERIAL_ECHOLNPGM("G33 Auto Calibrate");
|
476
|
464
|
|
477
|
465
|
// Report settings
|
478
|
|
- FSTR_P const checkingac = F("Checking... AC");
|
479
|
|
- SERIAL_ECHOF(checkingac);
|
|
466
|
+ PGM_P const checkingac = PSTR("Checking... AC");
|
|
467
|
+ SERIAL_ECHOPGM_P(checkingac);
|
|
468
|
+ SERIAL_ECHOPGM(" at radius:", dcr);
|
480
|
469
|
if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)");
|
481
|
470
|
SERIAL_EOL();
|
482
|
471
|
ui.set_status(checkingac);
|
|
@@ -496,7 +485,7 @@ void GcodeSuite::G33() {
|
496
|
485
|
|
497
|
486
|
// Probe the points
|
498
|
487
|
zero_std_dev_old = zero_std_dev;
|
499
|
|
- if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each, probe_at_offset)) {
|
|
488
|
+ if (!probe_calibration_points(z_at_pt, probe_points, dcr, towers_set, stow_after_each, probe_at_offset)) {
|
500
|
489
|
SERIAL_ECHOLNPGM("Correct delta settings with M665 and M666");
|
501
|
490
|
return ac_cleanup(TERN_(HAS_MULTI_HOTEND, old_tool_index));
|
502
|
491
|
}
|
|
@@ -536,10 +525,10 @@ void GcodeSuite::G33() {
|
536
|
525
|
|
537
|
526
|
// calculate factors
|
538
|
527
|
if (_7p_9_center) dcr *= 0.9f;
|
539
|
|
- h_factor = auto_tune_h();
|
540
|
|
- r_factor = auto_tune_r();
|
541
|
|
- a_factor = auto_tune_a();
|
542
|
|
- dcr /= 0.9f;
|
|
528
|
+ h_factor = auto_tune_h(dcr);
|
|
529
|
+ r_factor = auto_tune_r(dcr);
|
|
530
|
+ a_factor = auto_tune_a(dcr);
|
|
531
|
+ if (_7p_9_center) dcr /= 0.9f;
|
543
|
532
|
|
544
|
533
|
switch (probe_points) {
|
545
|
534
|
case 0:
|