|
@@ -5375,6 +5375,26 @@ void home_all_axes() { gcode_G28(true); }
|
5375
|
5375
|
|
5376
|
5376
|
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
5377
|
5377
|
|
|
5378
|
+ constexpr uint8_t _7P_STEP = 1, // 7-point step - to change number of calibration points
|
|
5379
|
+ _4P_STEP = _7P_STEP * 2, // 4-point step
|
|
5380
|
+ NPP = _7P_STEP * 6; // number of calibration points on the radius
|
|
5381
|
+ enum CalEnum { // the 7 main calibration points - add definitions if needed
|
|
5382
|
+ CEN = 0,
|
|
5383
|
+ __A = 1,
|
|
5384
|
+ _AB = __A + _7P_STEP,
|
|
5385
|
+ __B = _AB + _7P_STEP,
|
|
5386
|
+ _BC = __B + _7P_STEP,
|
|
5387
|
+ __C = _BC + _7P_STEP,
|
|
5388
|
+ _CA = __C + _7P_STEP,
|
|
5389
|
+ };
|
|
5390
|
+
|
|
5391
|
+ #define LOOP_CAL_PT(VAR, S, N) for (uint8_t VAR=S; VAR<=NPP; VAR+=N)
|
|
5392
|
+ #define F_LOOP_CAL_PT(VAR, S, N) for (float VAR=S; VAR<NPP+0.9999; VAR+=N)
|
|
5393
|
+ #define I_LOOP_CAL_PT(VAR, S, N) for (float VAR=S; VAR>CEN+0.9999; VAR-=N)
|
|
5394
|
+ #define LOOP_CAL_ALL(VAR) LOOP_CAL_PT(VAR, CEN, 1)
|
|
5395
|
+ #define LOOP_CAL_RAD(VAR) LOOP_CAL_PT(VAR, __A, _7P_STEP)
|
|
5396
|
+ #define LOOP_CAL_ACT(VAR, _4P, _OP) LOOP_CAL_PT(VAR, _OP ? _AB : __A, _4P ? _4P_STEP : _7P_STEP)
|
|
5397
|
+
|
5378
|
5398
|
static void print_signed_float(const char * const prefix, const float &f) {
|
5379
|
5399
|
SERIAL_PROTOCOLPGM(" ");
|
5380
|
5400
|
serialprintPGM(prefix);
|
|
@@ -5407,13 +5427,13 @@ void home_all_axes() { gcode_G28(true); }
|
5407
|
5427
|
SERIAL_EOL();
|
5408
|
5428
|
}
|
5409
|
5429
|
|
5410
|
|
- static void print_G33_results(const float z_at_pt[13], const bool tower_points, const bool opposite_points) {
|
|
5430
|
+ static void print_G33_results(const float z_at_pt[NPP + 1], const bool tower_points, const bool opposite_points) {
|
5411
|
5431
|
SERIAL_PROTOCOLPGM(". ");
|
5412
|
|
- print_signed_float(PSTR("c"), z_at_pt[0]);
|
|
5432
|
+ print_signed_float(PSTR("c"), z_at_pt[CEN]);
|
5413
|
5433
|
if (tower_points) {
|
5414
|
|
- print_signed_float(PSTR(" x"), z_at_pt[1]);
|
5415
|
|
- print_signed_float(PSTR(" y"), z_at_pt[5]);
|
5416
|
|
- print_signed_float(PSTR(" z"), z_at_pt[9]);
|
|
5434
|
+ print_signed_float(PSTR(" x"), z_at_pt[__A]);
|
|
5435
|
+ print_signed_float(PSTR(" y"), z_at_pt[__B]);
|
|
5436
|
+ print_signed_float(PSTR(" z"), z_at_pt[__C]);
|
5417
|
5437
|
}
|
5418
|
5438
|
if (tower_points && opposite_points) {
|
5419
|
5439
|
SERIAL_EOL();
|
|
@@ -5421,9 +5441,9 @@ void home_all_axes() { gcode_G28(true); }
|
5421
|
5441
|
SERIAL_PROTOCOL_SP(13);
|
5422
|
5442
|
}
|
5423
|
5443
|
if (opposite_points) {
|
5424
|
|
- print_signed_float(PSTR("yz"), z_at_pt[7]);
|
5425
|
|
- print_signed_float(PSTR("zx"), z_at_pt[11]);
|
5426
|
|
- print_signed_float(PSTR("xy"), z_at_pt[3]);
|
|
5444
|
+ print_signed_float(PSTR("yz"), z_at_pt[_BC]);
|
|
5445
|
+ print_signed_float(PSTR("zx"), z_at_pt[_CA]);
|
|
5446
|
+ print_signed_float(PSTR("xy"), z_at_pt[_AB]);
|
5427
|
5447
|
}
|
5428
|
5448
|
SERIAL_EOL();
|
5429
|
5449
|
}
|
|
@@ -5450,85 +5470,111 @@ void home_all_axes() { gcode_G28(true); }
|
5450
|
5470
|
#endif
|
5451
|
5471
|
}
|
5452
|
5472
|
|
5453
|
|
- static float probe_G33_points(float z_at_pt[13], const int8_t probe_points, const bool towers_set, const bool stow_after_each) {
|
|
5473
|
+ static float probe_G33_points(float z_at_pt[NPP + 1], const int8_t probe_points, const bool towers_set, const bool stow_after_each) {
|
5454
|
5474
|
const bool _0p_calibration = probe_points == 0,
|
5455
|
5475
|
_1p_calibration = probe_points == 1,
|
5456
|
5476
|
_4p_calibration = probe_points == 2,
|
5457
|
5477
|
_4p_opposite_points = _4p_calibration && !towers_set,
|
5458
|
5478
|
_7p_calibration = probe_points >= 3 || probe_points == 0,
|
5459
|
|
- _7p_half_circle = probe_points == 3,
|
5460
|
|
- _7p_double_circle = probe_points == 5,
|
5461
|
|
- _7p_triple_circle = probe_points == 6,
|
5462
|
|
- _7p_quadruple_circle = probe_points == 7,
|
|
5479
|
+ _7p_no_intermediates = probe_points == 3,
|
|
5480
|
+ _7p_1_intermediates = probe_points == 4,
|
|
5481
|
+ _7p_2_intermediates = probe_points == 5,
|
|
5482
|
+ _7p_4_intermediates = probe_points == 6,
|
|
5483
|
+ _7p_6_intermediates = probe_points == 7,
|
|
5484
|
+ _7p_8_intermediates = probe_points == 8,
|
|
5485
|
+ _7p_11_intermediates = probe_points == 9,
|
|
5486
|
+ _7p_14_intermediates = probe_points == 10,
|
5463
|
5487
|
_7p_intermed_points = probe_points >= 4,
|
5464
|
|
- _7p_multi_circle = probe_points >= 5;
|
5465
|
|
-
|
|
5488
|
+ _7p_6_centre = probe_points >= 5 && probe_points <= 7,
|
|
5489
|
+ _7p_9_centre = probe_points >= 8;
|
|
5490
|
+
|
5466
|
5491
|
#if DISABLED(PROBE_MANUALLY)
|
5467
|
5492
|
const float dx = (X_PROBE_OFFSET_FROM_EXTRUDER),
|
5468
|
5493
|
dy = (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
5469
|
5494
|
#endif
|
5470
|
5495
|
|
5471
|
|
- for (uint8_t i = 0; i <= 12; i++) z_at_pt[i] = 0.0;
|
|
5496
|
+ LOOP_CAL_ALL(axis) z_at_pt[axis] = 0.0;
|
5472
|
5497
|
|
5473
|
5498
|
if (!_0p_calibration) {
|
5474
|
5499
|
|
5475
|
|
- if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
|
|
5500
|
+ if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
|
5476
|
5501
|
#if ENABLED(PROBE_MANUALLY)
|
5477
|
|
- z_at_pt[0] += lcd_probe_pt(0, 0);
|
|
5502
|
+ z_at_pt[CEN] += lcd_probe_pt(0, 0);
|
5478
|
5503
|
#else
|
5479
|
|
- z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
|
|
5504
|
+ z_at_pt[CEN] += probe_pt(dx, dy, stow_after_each, 1, false);
|
5480
|
5505
|
#endif
|
5481
|
5506
|
}
|
5482
|
5507
|
|
5483
|
5508
|
if (_7p_calibration) { // probe extra center points
|
5484
|
|
- for (int8_t axis = _7p_multi_circle ? 11 : 9; axis > 0; axis -= _7p_multi_circle ? 2 : 4) {
|
5485
|
|
- const float a = RADIANS(180 + 30 * axis), r = delta_calibration_radius * 0.1;
|
|
5509
|
+ const float start = _7p_9_centre ? _CA + _7P_STEP / 3.0 : _7p_6_centre ? _CA : __C,
|
|
5510
|
+ steps = _7p_9_centre ? _4P_STEP / 3.0 : _7p_6_centre ? _7P_STEP : _4P_STEP;
|
|
5511
|
+ I_LOOP_CAL_PT(axis, start, steps) {
|
|
5512
|
+ const float a = RADIANS(210 + (360 / NPP) * (axis - 1)),
|
|
5513
|
+ r = delta_calibration_radius * 0.1;
|
5486
|
5514
|
#if ENABLED(PROBE_MANUALLY)
|
5487
|
|
- z_at_pt[0] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
|
5515
|
+ z_at_pt[CEN] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
5488
|
5516
|
#else
|
5489
|
|
- z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
|
5517
|
+ z_at_pt[CEN] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
5490
|
5518
|
#endif
|
5491
|
5519
|
}
|
5492
|
|
- z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
|
|
5520
|
+ z_at_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points);
|
5493
|
5521
|
}
|
5494
|
5522
|
|
5495
|
5523
|
if (!_1p_calibration) { // probe the radius
|
|
5524
|
+ const CalEnum start = _4p_opposite_points ? _AB : __A;
|
|
5525
|
+ const float steps = _7p_14_intermediates ? _7P_STEP / 15.0 : // 15r * 6 + 10c = 100
|
|
5526
|
+ _7p_11_intermediates ? _7P_STEP / 12.0 : // 12r * 6 + 9c = 81
|
|
5527
|
+ _7p_8_intermediates ? _7P_STEP / 9.0 : // 9r * 6 + 10c = 64
|
|
5528
|
+ _7p_6_intermediates ? _7P_STEP / 7.0 : // 7r * 6 + 7c = 49
|
|
5529
|
+ _7p_4_intermediates ? _7P_STEP / 5.0 : // 5r * 6 + 6c = 36
|
|
5530
|
+ _7p_2_intermediates ? _7P_STEP / 3.0 : // 3r * 6 + 7c = 25
|
|
5531
|
+ _7p_1_intermediates ? _7P_STEP / 2.0 : // 2r * 6 + 4c = 16
|
|
5532
|
+ _7p_no_intermediates ? _7P_STEP : // 1r * 6 + 3c = 9
|
|
5533
|
+ _4P_STEP; // .5r * 6 + 1c = 4
|
5496
|
5534
|
bool zig_zag = true;
|
5497
|
|
- const uint8_t start = _4p_opposite_points ? 3 : 1,
|
5498
|
|
- step = _4p_calibration ? 4 : _7p_half_circle ? 2 : 1;
|
5499
|
|
- for (uint8_t axis = start; axis <= 12; axis += step) {
|
5500
|
|
- const float zigadd = (zig_zag ? 0.5 : 0.0),
|
5501
|
|
- offset_circles = _7p_quadruple_circle ? zigadd + 1.0 :
|
5502
|
|
- _7p_triple_circle ? zigadd + 0.5 :
|
5503
|
|
- _7p_double_circle ? zigadd : 0;
|
5504
|
|
- for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
|
5505
|
|
- const float a = RADIANS(180 + 30 * axis),
|
5506
|
|
- r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1));
|
|
5535
|
+ F_LOOP_CAL_PT(axis, start, _7p_9_centre ? steps * 3 : steps) {
|
|
5536
|
+ const int8_t offset = _7p_9_centre ? 1 : 0;
|
|
5537
|
+ for (int8_t circle = -offset; circle <= offset; circle++) {
|
|
5538
|
+ const float a = RADIANS(210 + (360 / NPP) * (axis - 1)),
|
|
5539
|
+ r = delta_calibration_radius * (1 + 0.1 * (zig_zag ? circle : - circle)),
|
|
5540
|
+ interpol = fmod(axis, 1);
|
5507
|
5541
|
#if ENABLED(PROBE_MANUALLY)
|
5508
|
|
- z_at_pt[axis] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
|
5542
|
+ float z_temp = lcd_probe_pt(cos(a) * r, sin(a) * r);
|
5509
|
5543
|
#else
|
5510
|
|
- z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
|
5544
|
+ float z_temp = probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
5511
|
5545
|
#endif
|
|
5546
|
+ // split probe point to neighbouring calibration points
|
|
5547
|
+ z_at_pt[round(axis - interpol + NPP - 1) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90)));
|
|
5548
|
+ z_at_pt[round(axis - interpol) % NPP + 1] += z_temp * sq(sin(RADIANS(interpol * 90)));
|
5512
|
5549
|
}
|
5513
|
5550
|
zig_zag = !zig_zag;
|
5514
|
|
- z_at_pt[axis] /= (2 * offset_circles + 1);
|
5515
|
5551
|
}
|
|
5552
|
+ if (_7p_intermed_points)
|
|
5553
|
+ LOOP_CAL_RAD(axis) {
|
|
5554
|
+/*
|
|
5555
|
+ // average intermediate points to towers and opposites - only required with _7P_STEP >= 2
|
|
5556
|
+ for (int8_t i = 1; i < _7P_STEP; i++) {
|
|
5557
|
+ const float interpol = i * (1.0 / _7P_STEP);
|
|
5558
|
+ z_at_pt[axis] += (z_at_pt[(axis + NPP - i - 1) % NPP + 1]
|
|
5559
|
+ + z_at_pt[axis + i]) * sq(cos(RADIANS(interpol * 90)));
|
|
5560
|
+ }
|
|
5561
|
+*/
|
|
5562
|
+ z_at_pt[axis] /= _7P_STEP / steps;
|
|
5563
|
+ }
|
5516
|
5564
|
}
|
5517
|
5565
|
|
5518
|
|
- if (_7p_intermed_points) // average intermediates to tower and opposites
|
5519
|
|
- for (uint8_t axis = 1; axis <= 12; axis += 2)
|
5520
|
|
- z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0;
|
5521
|
5566
|
|
5522
|
|
- float S1 = z_at_pt[0],
|
5523
|
|
- S2 = sq(z_at_pt[0]);
|
|
5567
|
+ float S1 = z_at_pt[CEN],
|
|
5568
|
+ S2 = sq(z_at_pt[CEN]);
|
5524
|
5569
|
int16_t N = 1;
|
5525
|
|
- if (!_1p_calibration) // std dev from zero plane
|
5526
|
|
- for (uint8_t axis = (_4p_opposite_points ? 3 : 1); axis <= 12; axis += (_4p_calibration ? 4 : 2)) {
|
|
5570
|
+ if (!_1p_calibration) { // std dev from zero plane
|
|
5571
|
+ LOOP_CAL_ACT(axis, _4p_calibration, _4p_opposite_points) {
|
5527
|
5572
|
S1 += z_at_pt[axis];
|
5528
|
5573
|
S2 += sq(z_at_pt[axis]);
|
5529
|
5574
|
N++;
|
5530
|
5575
|
}
|
5531
|
|
- return round(SQRT(S2 / N) * 1000.0) / 1000.0 + 0.00001;
|
|
5576
|
+ return round(SQRT(S2 / N) * 1000.0) / 1000.0 + 0.00001;
|
|
5577
|
+ }
|
5532
|
5578
|
}
|
5533
|
5579
|
|
5534
|
5580
|
return 0.00001;
|
|
@@ -5537,8 +5583,8 @@ void home_all_axes() { gcode_G28(true); }
|
5537
|
5583
|
#if DISABLED(PROBE_MANUALLY)
|
5538
|
5584
|
|
5539
|
5585
|
static void G33_auto_tune() {
|
5540
|
|
- float z_at_pt[13] = { 0.0 },
|
5541
|
|
- z_at_pt_base[13] = { 0.0 },
|
|
5586
|
+ float z_at_pt[NPP + 1] = { 0.0 },
|
|
5587
|
+ z_at_pt_base[NPP + 1] = { 0.0 },
|
5542
|
5588
|
z_temp, h_fac = 0.0, r_fac = 0.0, a_fac = 0.0, norm = 0.8;
|
5543
|
5589
|
|
5544
|
5590
|
#define ZP(N,I) ((N) * z_at_pt[I])
|
|
@@ -5565,18 +5611,18 @@ void home_all_axes() { gcode_G28(true); }
|
5565
|
5611
|
SERIAL_EOL();
|
5566
|
5612
|
|
5567
|
5613
|
probe_G33_points(z_at_pt, 3, true, false);
|
5568
|
|
- for (int8_t i = 0; i <= 12; i++) z_at_pt[i] -= z_at_pt_base[i];
|
|
5614
|
+ LOOP_CAL_ALL(axis) z_at_pt[axis] -= z_at_pt_base[axis];
|
5569
|
5615
|
print_G33_results(z_at_pt, true, true);
|
5570
|
5616
|
delta_endstop_adj[axis] += 1.0;
|
5571
|
5617
|
switch (axis) {
|
5572
|
5618
|
case A_AXIS :
|
5573
|
|
- h_fac += 4.0 / (Z03(0) +Z01(1) +Z32(11) +Z32(3)); // Offset by X-tower end-stop
|
|
5619
|
+ h_fac += 4.0 / (Z03(CEN) +Z01(__A) +Z32(_CA) +Z32(_AB)); // Offset by X-tower end-stop
|
5574
|
5620
|
break;
|
5575
|
5621
|
case B_AXIS :
|
5576
|
|
- h_fac += 4.0 / (Z03(0) +Z01(5) +Z32(7) +Z32(3)); // Offset by Y-tower end-stop
|
|
5622
|
+ h_fac += 4.0 / (Z03(CEN) +Z01(__B) +Z32(_BC) +Z32(_AB)); // Offset by Y-tower end-stop
|
5577
|
5623
|
break;
|
5578
|
5624
|
case C_AXIS :
|
5579
|
|
- h_fac += 4.0 / (Z03(0) +Z01(9) +Z32(7) +Z32(11) ); // Offset by Z-tower end-stop
|
|
5625
|
+ h_fac += 4.0 / (Z03(CEN) +Z01(__C) +Z32(_BC) +Z32(_CA) ); // Offset by Z-tower end-stop
|
5580
|
5626
|
break;
|
5581
|
5627
|
}
|
5582
|
5628
|
}
|
|
@@ -5595,11 +5641,11 @@ void home_all_axes() { gcode_G28(true); }
|
5595
|
5641
|
SERIAL_PROTOCOL(zig_zag == -1 ? "-" : "+");
|
5596
|
5642
|
SERIAL_EOL();
|
5597
|
5643
|
probe_G33_points(z_at_pt, 3, true, false);
|
5598
|
|
- for (int8_t i = 0; i <= 12; i++) z_at_pt[i] -= z_at_pt_base[i];
|
|
5644
|
+ LOOP_CAL_ALL(axis) z_at_pt[axis] -= z_at_pt_base[axis];
|
5599
|
5645
|
print_G33_results(z_at_pt, true, true);
|
5600
|
5646
|
delta_radius -= 1.0 * zig_zag;
|
5601
|
5647
|
recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim);
|
5602
|
|
- r_fac -= zig_zag * 6.0 / (Z03(1) + Z03(5) + Z03(9) + Z03(7) + Z03(11) + Z03(3)); // Offset by delta radius
|
|
5648
|
+ r_fac -= zig_zag * 6.0 / (Z03(__A) +Z03(__B) +Z03(__C) +Z03(_BC) +Z03(_CA) +Z03(_AB)); // Offset by delta radius
|
5603
|
5649
|
}
|
5604
|
5650
|
r_fac /= 2.0;
|
5605
|
5651
|
r_fac *= 3 * norm; // Normalize to 2.25 for Kossel mini
|
|
@@ -5622,7 +5668,7 @@ void home_all_axes() { gcode_G28(true); }
|
5622
|
5668
|
SERIAL_EOL();
|
5623
|
5669
|
|
5624
|
5670
|
probe_G33_points(z_at_pt, 3, true, false);
|
5625
|
|
- for (int8_t i = 0; i <= 12; i++) z_at_pt[i] -= z_at_pt_base[i];
|
|
5671
|
+ LOOP_CAL_ALL(axis) z_at_pt[axis] -= z_at_pt_base[axis];
|
5626
|
5672
|
print_G33_results(z_at_pt, true, true);
|
5627
|
5673
|
|
5628
|
5674
|
delta_tower_angle_trim[axis] -= 1.0;
|
|
@@ -5634,13 +5680,13 @@ void home_all_axes() { gcode_G28(true); }
|
5634
|
5680
|
recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim);
|
5635
|
5681
|
switch (axis) {
|
5636
|
5682
|
case A_AXIS :
|
5637
|
|
- a_fac += 4.0 / ( Z06(5) -Z06(9) +Z06(11) -Z06(3)); // Offset by alpha tower angle
|
|
5683
|
+ a_fac += 4.0 / ( Z06(__B) -Z06(__C) +Z06(_CA) -Z06(_AB)); // Offset by alpha tower angle
|
5638
|
5684
|
break;
|
5639
|
5685
|
case B_AXIS :
|
5640
|
|
- a_fac += 4.0 / (-Z06(1) +Z06(9) -Z06(7) +Z06(3)); // Offset by beta tower angle
|
|
5686
|
+ a_fac += 4.0 / (-Z06(__A) +Z06(__C) -Z06(_BC) +Z06(_AB)); // Offset by beta tower angle
|
5641
|
5687
|
break;
|
5642
|
5688
|
case C_AXIS :
|
5643
|
|
- a_fac += 4.0 / (Z06(1) -Z06(5) +Z06(7) -Z06(11) ); // Offset by gamma tower angle
|
|
5689
|
+ a_fac += 4.0 / (Z06(__A) -Z06(__B) +Z06(_BC) -Z06(_CA) ); // Offset by gamma tower angle
|
5644
|
5690
|
break;
|
5645
|
5691
|
}
|
5646
|
5692
|
}
|
|
@@ -5671,7 +5717,7 @@ void home_all_axes() { gcode_G28(true); }
|
5671
|
5717
|
* P1 Probe center and set height only.
|
5672
|
5718
|
* P2 Probe center and towers. Set height, endstops and delta radius.
|
5673
|
5719
|
* P3 Probe all positions: center, towers and opposite towers. Set all.
|
5674
|
|
- * P4-P7 Probe all positions at different locations and average them.
|
|
5720
|
+ * P4-P10 Probe all positions + at different itermediate locations and average them.
|
5675
|
5721
|
*
|
5676
|
5722
|
* T Don't calibrate tower angle corrections
|
5677
|
5723
|
*
|
|
@@ -5691,8 +5737,8 @@ void home_all_axes() { gcode_G28(true); }
|
5691
|
5737
|
inline void gcode_G33() {
|
5692
|
5738
|
|
5693
|
5739
|
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
|
5694
|
|
- if (!WITHIN(probe_points, 0, 7)) {
|
5695
|
|
- SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (0-7).");
|
|
5740
|
+ if (!WITHIN(probe_points, 0, 10)) {
|
|
5741
|
+ SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (0-10).");
|
5696
|
5742
|
return;
|
5697
|
5743
|
}
|
5698
|
5744
|
|
|
@@ -5720,15 +5766,13 @@ void home_all_axes() { gcode_G28(true); }
|
5720
|
5766
|
_0p_calibration = probe_points == 0,
|
5721
|
5767
|
_1p_calibration = probe_points == 1,
|
5722
|
5768
|
_4p_calibration = probe_points == 2,
|
|
5769
|
+ _7p_9_centre = probe_points >= 8,
|
5723
|
5770
|
_tower_results = (_4p_calibration && towers_set)
|
5724
|
5771
|
|| probe_points >= 3 || probe_points == 0,
|
5725
|
5772
|
_opposite_results = (_4p_calibration && !towers_set)
|
5726
|
5773
|
|| probe_points >= 3 || probe_points == 0,
|
5727
|
5774
|
_endstop_results = probe_points != 1,
|
5728
|
|
- _angle_results = (probe_points >= 3 || probe_points == 0) && towers_set,
|
5729
|
|
- _7p_double_circle = probe_points == 5,
|
5730
|
|
- _7p_triple_circle = probe_points == 6,
|
5731
|
|
- _7p_quadruple_circle = probe_points == 7;
|
|
5775
|
+ _angle_results = (probe_points >= 3 || probe_points == 0) && towers_set;
|
5732
|
5776
|
const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h";
|
5733
|
5777
|
int8_t iterations = 0;
|
5734
|
5778
|
float test_precision,
|
|
@@ -5750,12 +5794,9 @@ void home_all_axes() { gcode_G28(true); }
|
5750
|
5794
|
SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate");
|
5751
|
5795
|
|
5752
|
5796
|
if (!_1p_calibration && !_0p_calibration) { // test if the outer radius is reachable
|
5753
|
|
- const float circles = (_7p_quadruple_circle ? 1.5 :
|
5754
|
|
- _7p_triple_circle ? 1.0 :
|
5755
|
|
- _7p_double_circle ? 0.5 : 0),
|
5756
|
|
- r = (1 + circles * 0.1) * delta_calibration_radius;
|
5757
|
|
- for (uint8_t axis = 1; axis <= 12; ++axis) {
|
5758
|
|
- const float a = RADIANS(180 + 30 * axis);
|
|
5797
|
+ LOOP_CAL_RAD(axis) {
|
|
5798
|
+ const float a = RADIANS(210 + (360 / NPP) * (axis - 1)),
|
|
5799
|
+ r = delta_calibration_radius * (1 + (_7p_9_centre ? 0.1 : 0.0));
|
5759
|
5800
|
if (!position_is_reachable_xy(cos(a) * r, sin(a) * r)) {
|
5760
|
5801
|
SERIAL_PROTOCOLLNPGM("?(M665 B)ed radius is implausible.");
|
5761
|
5802
|
return;
|
|
@@ -5806,7 +5847,7 @@ void home_all_axes() { gcode_G28(true); }
|
5806
|
5847
|
|
5807
|
5848
|
do {
|
5808
|
5849
|
|
5809
|
|
- float z_at_pt[13] = { 0.0 };
|
|
5850
|
+ float z_at_pt[NPP + 1] = { 0.0 };
|
5810
|
5851
|
|
5811
|
5852
|
test_precision = zero_std_dev;
|
5812
|
5853
|
|
|
@@ -5864,34 +5905,34 @@ void home_all_axes() { gcode_G28(true); }
|
5864
|
5905
|
|
5865
|
5906
|
case 1:
|
5866
|
5907
|
test_precision = 0.00; // forced end
|
5867
|
|
- LOOP_XYZ(axis) e_delta[axis] = Z1(0);
|
|
5908
|
+ LOOP_XYZ(axis) e_delta[axis] = Z1(CEN);
|
5868
|
5909
|
break;
|
5869
|
5910
|
|
5870
|
5911
|
case 2:
|
5871
|
5912
|
if (towers_set) {
|
5872
|
|
- e_delta[A_AXIS] = (Z6(0) + Z4(1) - Z2(5) - Z2(9)) * h_factor;
|
5873
|
|
- e_delta[B_AXIS] = (Z6(0) - Z2(1) + Z4(5) - Z2(9)) * h_factor;
|
5874
|
|
- e_delta[C_AXIS] = (Z6(0) - Z2(1) - Z2(5) + Z4(9)) * h_factor;
|
5875
|
|
- r_delta = (Z6(0) - Z2(1) - Z2(5) - Z2(9)) * r_factor;
|
|
5913
|
+ e_delta[A_AXIS] = (Z6(CEN) +Z4(__A) -Z2(__B) -Z2(__C)) * h_factor;
|
|
5914
|
+ e_delta[B_AXIS] = (Z6(CEN) -Z2(__A) +Z4(__B) -Z2(__C)) * h_factor;
|
|
5915
|
+ e_delta[C_AXIS] = (Z6(CEN) -Z2(__A) -Z2(__B) +Z4(__C)) * h_factor;
|
|
5916
|
+ r_delta = (Z6(CEN) -Z2(__A) -Z2(__B) -Z2(__C)) * r_factor;
|
5876
|
5917
|
}
|
5877
|
5918
|
else {
|
5878
|
|
- e_delta[A_AXIS] = (Z6(0) - Z4(7) + Z2(11) + Z2(3)) * h_factor;
|
5879
|
|
- e_delta[B_AXIS] = (Z6(0) + Z2(7) - Z4(11) + Z2(3)) * h_factor;
|
5880
|
|
- e_delta[C_AXIS] = (Z6(0) + Z2(7) + Z2(11) - Z4(3)) * h_factor;
|
5881
|
|
- r_delta = (Z6(0) - Z2(7) - Z2(11) - Z2(3)) * r_factor;
|
|
5919
|
+ e_delta[A_AXIS] = (Z6(CEN) -Z4(_BC) +Z2(_CA) +Z2(_AB)) * h_factor;
|
|
5920
|
+ e_delta[B_AXIS] = (Z6(CEN) +Z2(_BC) -Z4(_CA) +Z2(_AB)) * h_factor;
|
|
5921
|
+ e_delta[C_AXIS] = (Z6(CEN) +Z2(_BC) +Z2(_CA) -Z4(_AB)) * h_factor;
|
|
5922
|
+ r_delta = (Z6(CEN) -Z2(_BC) -Z2(_CA) -Z2(_AB)) * r_factor;
|
5882
|
5923
|
}
|
5883
|
5924
|
break;
|
5884
|
5925
|
|
5885
|
5926
|
default:
|
5886
|
|
- e_delta[A_AXIS] = (Z6(0) + Z2(1) - Z1(5) - Z1(9) - Z2(7) + Z1(11) + Z1(3)) * h_factor;
|
5887
|
|
- e_delta[B_AXIS] = (Z6(0) - Z1(1) + Z2(5) - Z1(9) + Z1(7) - Z2(11) + Z1(3)) * h_factor;
|
5888
|
|
- e_delta[C_AXIS] = (Z6(0) - Z1(1) - Z1(5) + Z2(9) + Z1(7) + Z1(11) - Z2(3)) * h_factor;
|
5889
|
|
- r_delta = (Z6(0) - Z1(1) - Z1(5) - Z1(9) - Z1(7) - Z1(11) - Z1(3)) * r_factor;
|
|
5927
|
+ e_delta[A_AXIS] = (Z6(CEN) +Z2(__A) -Z1(__B) -Z1(__C) -Z2(_BC) +Z1(_CA) +Z1(_AB)) * h_factor;
|
|
5928
|
+ e_delta[B_AXIS] = (Z6(CEN) -Z1(__A) +Z2(__B) -Z1(__C) +Z1(_BC) -Z2(_CA) +Z1(_AB)) * h_factor;
|
|
5929
|
+ e_delta[C_AXIS] = (Z6(CEN) -Z1(__A) -Z1(__B) +Z2(__C) +Z1(_BC) +Z1(_CA) -Z2(_AB)) * h_factor;
|
|
5930
|
+ r_delta = (Z6(CEN) -Z1(__A) -Z1(__B) -Z1(__C) -Z1(_BC) -Z1(_CA) -Z1(_AB)) * r_factor;
|
5890
|
5931
|
|
5891
|
5932
|
if (towers_set) {
|
5892
|
|
- t_delta[A_AXIS] = ( - Z4(5) + Z4(9) - Z4(11) + Z4(3)) * a_factor;
|
5893
|
|
- t_delta[B_AXIS] = ( Z4(1) - Z4(9) + Z4(7) - Z4(3)) * a_factor;
|
5894
|
|
- t_delta[C_AXIS] = (-Z4(1) + Z4(5) - Z4(7) + Z4(11) ) * a_factor;
|
|
5933
|
+ t_delta[A_AXIS] = ( -Z4(__B) +Z4(__C) -Z4(_CA) +Z4(_AB)) * a_factor;
|
|
5934
|
+ t_delta[B_AXIS] = ( Z4(__A) -Z4(__C) +Z4(_BC) -Z4(_AB)) * a_factor;
|
|
5935
|
+ t_delta[C_AXIS] = (-Z4(__A) +Z4(__B) -Z4(_BC) +Z4(_CA) ) * a_factor;
|
5895
|
5936
|
e_delta[A_AXIS] += (t_delta[B_AXIS] - t_delta[C_AXIS]) / 4.5;
|
5896
|
5937
|
e_delta[B_AXIS] += (t_delta[C_AXIS] - t_delta[A_AXIS]) / 4.5;
|
5897
|
5938
|
e_delta[C_AXIS] += (t_delta[A_AXIS] - t_delta[B_AXIS]) / 4.5;
|