|
@@ -2386,7 +2386,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2386
|
2386
|
}
|
2387
|
2387
|
#endif
|
2388
|
2388
|
|
2389
|
|
- return current_position[Z_AXIS] + zprobe_zoffset;
|
|
2389
|
+ return current_position[Z_AXIS];
|
2390
|
2390
|
}
|
2391
|
2391
|
|
2392
|
2392
|
/**
|
|
@@ -2398,7 +2398,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2398
|
2398
|
* - Raise to the BETWEEN height
|
2399
|
2399
|
* - Return the probed Z position
|
2400
|
2400
|
*/
|
2401
|
|
- float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t verbose_level, const bool printable=true) {
|
|
2401
|
+ float probe_pt(const float &rx, const float &ry, const bool stow, const uint8_t verbose_level, const bool probe_relative=true) {
|
2402
|
2402
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
2403
|
2403
|
if (DEBUGGING(LEVELING)) {
|
2404
|
2404
|
SERIAL_ECHOPAIR(">>> probe_pt(", LOGICAL_X_POSITION(rx));
|
|
@@ -2409,13 +2409,15 @@ static void clean_up_after_endstop_or_probe_move() {
|
2409
|
2409
|
}
|
2410
|
2410
|
#endif
|
2411
|
2411
|
|
2412
|
|
- const float nx = rx - (X_PROBE_OFFSET_FROM_EXTRUDER), ny = ry - (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
2413
|
|
-
|
2414
|
|
- if (!printable
|
2415
|
|
- ? !position_is_reachable(nx, ny)
|
2416
|
|
- : !position_is_reachable_by_probe(rx, ry)
|
2417
|
|
- ) return NAN;
|
2418
|
|
-
|
|
2412
|
+ // TODO: Adapt for SCARA, where the offset rotates
|
|
2413
|
+ float nx = rx, ny = ry;
|
|
2414
|
+ if (probe_relative) {
|
|
2415
|
+ if (!position_is_reachable_by_probe(rx, ry)) return NAN; // The given position is in terms of the probe
|
|
2416
|
+ nx -= (X_PROBE_OFFSET_FROM_EXTRUDER); // Get the nozzle position
|
|
2417
|
+ ny -= (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
|
2418
|
+ }
|
|
2419
|
+ else if (!position_is_reachable(nx, ny)) return NAN; // The given position is in terms of the nozzle
|
|
2420
|
+
|
2419
|
2421
|
const float nz =
|
2420
|
2422
|
#if ENABLED(DELTA)
|
2421
|
2423
|
// Move below clip height or xy move will be aborted by do_blocking_move_to
|
|
@@ -2433,7 +2435,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2433
|
2435
|
|
2434
|
2436
|
float measured_z = NAN;
|
2435
|
2437
|
if (!DEPLOY_PROBE()) {
|
2436
|
|
- measured_z = run_z_probe();
|
|
2438
|
+ measured_z = run_z_probe() + zprobe_zoffset;
|
2437
|
2439
|
|
2438
|
2440
|
if (!stow)
|
2439
|
2441
|
do_blocking_move_to_z(current_position[Z_AXIS] + Z_CLEARANCE_BETWEEN_PROBES, MMM_TO_MMS(Z_PROBE_SPEED_FAST));
|
|
@@ -5541,6 +5543,16 @@ void home_all_axes() { gcode_G28(true); }
|
5541
|
5543
|
#endif
|
5542
|
5544
|
}
|
5543
|
5545
|
|
|
5546
|
+ inline float calibration_probe(const float nx, const float ny, const bool stow) {
|
|
5547
|
+ return
|
|
5548
|
+ #if HAS_BED_PROBE
|
|
5549
|
+ probe_pt(nx, ny, stow, 0, false)
|
|
5550
|
+ #else
|
|
5551
|
+ lcd_probe_pt(nx, ny)
|
|
5552
|
+ #endif
|
|
5553
|
+ ;
|
|
5554
|
+ }
|
|
5555
|
+
|
5544
|
5556
|
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) {
|
5545
|
5557
|
const bool _0p_calibration = probe_points == 0,
|
5546
|
5558
|
_1p_calibration = probe_points == 1,
|
|
@@ -5559,23 +5571,13 @@ void home_all_axes() { gcode_G28(true); }
|
5559
|
5571
|
_7p_6_centre = probe_points >= 5 && probe_points <= 7,
|
5560
|
5572
|
_7p_9_centre = probe_points >= 8;
|
5561
|
5573
|
|
5562
|
|
- #if HAS_BED_PROBE
|
5563
|
|
- const float dx = (X_PROBE_OFFSET_FROM_EXTRUDER),
|
5564
|
|
- dy = (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
5565
|
|
- #endif
|
5566
|
|
-
|
5567
|
5574
|
LOOP_CAL_ALL(axis) z_at_pt[axis] = 0.0;
|
5568
|
5575
|
|
5569
|
5576
|
if (!_0p_calibration) {
|
5570
|
5577
|
|
5571
|
5578
|
if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
|
5572
|
|
- z_at_pt[CEN] +=
|
5573
|
|
- #if HAS_BED_PROBE
|
5574
|
|
- probe_pt(dx, dy, stow_after_each, 1, false)
|
5575
|
|
- #else
|
5576
|
|
- lcd_probe_pt(0, 0)
|
5577
|
|
- #endif
|
5578
|
|
- ;
|
|
5579
|
+ z_at_pt[CEN] += calibration_probe(0, 0, stow_after_each);
|
|
5580
|
+ if (isnan(z_at_pt[CEN])) return NAN;
|
5579
|
5581
|
}
|
5580
|
5582
|
|
5581
|
5583
|
if (_7p_calibration) { // probe extra center points
|
|
@@ -5584,14 +5586,9 @@ void home_all_axes() { gcode_G28(true); }
|
5584
|
5586
|
I_LOOP_CAL_PT(axis, start, steps) {
|
5585
|
5587
|
const float a = RADIANS(210 + (360 / NPP) * (axis - 1)),
|
5586
|
5588
|
r = delta_calibration_radius * 0.1;
|
5587
|
|
- z_at_pt[CEN] +=
|
5588
|
|
- #if HAS_BED_PROBE
|
5589
|
|
- probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false)
|
5590
|
|
- #else
|
5591
|
|
- lcd_probe_pt(cos(a) * r, sin(a) * r)
|
5592
|
|
- #endif
|
5593
|
|
- ;
|
5594
|
|
- }
|
|
5589
|
+ z_at_pt[CEN] += calibration_probe(cos(a) * r, sin(a) * r, stow_after_each);
|
|
5590
|
+ if (isnan(z_at_pt[CEN])) return NAN;
|
|
5591
|
+ }
|
5595
|
5592
|
z_at_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points);
|
5596
|
5593
|
}
|
5597
|
5594
|
|
|
@@ -5613,22 +5610,17 @@ void home_all_axes() { gcode_G28(true); }
|
5613
|
5610
|
const float a = RADIANS(210 + (360 / NPP) * (axis - 1)),
|
5614
|
5611
|
r = delta_calibration_radius * (1 + 0.1 * (zig_zag ? circle : - circle)),
|
5615
|
5612
|
interpol = fmod(axis, 1);
|
5616
|
|
- const float z_temp =
|
5617
|
|
- #if HAS_BED_PROBE
|
5618
|
|
- probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false)
|
5619
|
|
- #else
|
5620
|
|
- lcd_probe_pt(cos(a) * r, sin(a) * r)
|
5621
|
|
- #endif
|
5622
|
|
- ;
|
|
5613
|
+ const float z_temp = calibration_probe(cos(a) * r, sin(a) * r, stow_after_each);
|
|
5614
|
+ if (isnan(z_temp)) return NAN;
|
5623
|
5615
|
// split probe point to neighbouring calibration points
|
5624
|
5616
|
z_at_pt[uint8_t(round(axis - interpol + NPP - 1)) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90)));
|
5625
|
|
- z_at_pt[uint8_t(round(axis - interpol )) % NPP + 1] += z_temp * sq(sin(RADIANS(interpol * 90)));
|
|
5617
|
+ z_at_pt[uint8_t(round(axis - interpol)) % NPP + 1] += z_temp * sq(sin(RADIANS(interpol * 90)));
|
5626
|
5618
|
}
|
5627
|
5619
|
zig_zag = !zig_zag;
|
5628
|
5620
|
}
|
5629
|
5621
|
if (_7p_intermed_points)
|
5630
|
5622
|
LOOP_CAL_RAD(axis)
|
5631
|
|
- z_at_pt[axis] /= _7P_STEP / steps;
|
|
5623
|
+ z_at_pt[axis] /= _7P_STEP / steps;
|
5632
|
5624
|
}
|
5633
|
5625
|
|
5634
|
5626
|
float S1 = z_at_pt[CEN],
|
|
@@ -5649,7 +5641,7 @@ void home_all_axes() { gcode_G28(true); }
|
5649
|
5641
|
|
5650
|
5642
|
#if HAS_BED_PROBE
|
5651
|
5643
|
|
5652
|
|
- static void G33_auto_tune() {
|
|
5644
|
+ static bool G33_auto_tune() {
|
5653
|
5645
|
float z_at_pt[NPP + 1] = { 0.0 },
|
5654
|
5646
|
z_at_pt_base[NPP + 1] = { 0.0 },
|
5655
|
5647
|
z_temp, h_fac = 0.0, r_fac = 0.0, a_fac = 0.0, norm = 0.8;
|
|
@@ -5663,7 +5655,7 @@ void home_all_axes() { gcode_G28(true); }
|
5663
|
5655
|
|
5664
|
5656
|
SERIAL_PROTOCOLPGM("AUTO TUNE baseline");
|
5665
|
5657
|
SERIAL_EOL();
|
5666
|
|
- probe_G33_points(z_at_pt_base, 3, true, false);
|
|
5658
|
+ if (isnan(probe_G33_points(z_at_pt_base, 3, true, false))) return false;
|
5667
|
5659
|
print_G33_results(z_at_pt_base, true, true);
|
5668
|
5660
|
|
5669
|
5661
|
LOOP_XYZ(axis) {
|
|
@@ -5678,7 +5670,7 @@ void home_all_axes() { gcode_G28(true); }
|
5678
|
5670
|
SERIAL_CHAR(tolower(axis_codes[axis]));
|
5679
|
5671
|
SERIAL_EOL();
|
5680
|
5672
|
|
5681
|
|
- probe_G33_points(z_at_pt, 3, true, false);
|
|
5673
|
+ if (isnan(probe_G33_points(z_at_pt, 3, true, false))) return false;
|
5682
|
5674
|
LOOP_CAL_ALL(axis) z_at_pt[axis] -= z_at_pt_base[axis];
|
5683
|
5675
|
print_G33_results(z_at_pt, true, true);
|
5684
|
5676
|
delta_endstop_adj[axis] += 1.0;
|
|
@@ -5709,7 +5701,7 @@ void home_all_axes() { gcode_G28(true); }
|
5709
|
5701
|
SERIAL_PROTOCOLPGM("Tuning R");
|
5710
|
5702
|
SERIAL_PROTOCOL(zig_zag == -1 ? "-" : "+");
|
5711
|
5703
|
SERIAL_EOL();
|
5712
|
|
- probe_G33_points(z_at_pt, 3, true, false);
|
|
5704
|
+ if (isnan(probe_G33_points(z_at_pt, 3, true, false))) return false;
|
5713
|
5705
|
LOOP_CAL_ALL(axis) z_at_pt[axis] -= z_at_pt_base[axis];
|
5714
|
5706
|
print_G33_results(z_at_pt, true, true);
|
5715
|
5707
|
delta_radius -= 1.0 * zig_zag;
|
|
@@ -5736,7 +5728,7 @@ void home_all_axes() { gcode_G28(true); }
|
5736
|
5728
|
SERIAL_CHAR(tolower(axis_codes[axis]));
|
5737
|
5729
|
SERIAL_EOL();
|
5738
|
5730
|
|
5739
|
|
- probe_G33_points(z_at_pt, 3, true, false);
|
|
5731
|
+ if (isnan(probe_G33_points(z_at_pt, 3, true, false))) return false;
|
5740
|
5732
|
LOOP_CAL_ALL(axis) z_at_pt[axis] -= z_at_pt_base[axis];
|
5741
|
5733
|
print_G33_results(z_at_pt, true, true);
|
5742
|
5734
|
|
|
@@ -5749,14 +5741,14 @@ void home_all_axes() { gcode_G28(true); }
|
5749
|
5741
|
recalc_delta_settings();
|
5750
|
5742
|
switch (axis) {
|
5751
|
5743
|
case A_AXIS :
|
5752
|
|
- a_fac += 4.0 / ( Z06(__B) -Z06(__C) +Z06(_CA) -Z06(_AB)); // Offset by alpha tower angle
|
5753
|
|
- break;
|
|
5744
|
+ a_fac += 4.0 / ( Z06(__B) -Z06(__C) +Z06(_CA) -Z06(_AB)); // Offset by alpha tower angle
|
|
5745
|
+ break;
|
5754
|
5746
|
case B_AXIS :
|
5755
|
|
- a_fac += 4.0 / (-Z06(__A) +Z06(__C) -Z06(_BC) +Z06(_AB)); // Offset by beta tower angle
|
5756
|
|
- break;
|
|
5747
|
+ a_fac += 4.0 / (-Z06(__A) +Z06(__C) -Z06(_BC) +Z06(_AB)); // Offset by beta tower angle
|
|
5748
|
+ break;
|
5757
|
5749
|
case C_AXIS :
|
5758
|
|
- a_fac += 4.0 / (Z06(__A) -Z06(__B) +Z06(_BC) -Z06(_CA) ); // Offset by gamma tower angle
|
5759
|
|
- break;
|
|
5750
|
+ a_fac += 4.0 / (Z06(__A) -Z06(__B) +Z06(_BC) -Z06(_CA) ); // Offset by gamma tower angle
|
|
5751
|
+ break;
|
5760
|
5752
|
}
|
5761
|
5753
|
}
|
5762
|
5754
|
a_fac /= 3.0;
|
|
@@ -5771,6 +5763,7 @@ void home_all_axes() { gcode_G28(true); }
|
5771
|
5763
|
SERIAL_EOL();
|
5772
|
5764
|
SERIAL_PROTOCOLPGM("Copy these values to Configuration.h");
|
5773
|
5765
|
SERIAL_EOL();
|
|
5766
|
+ return true;
|
5774
|
5767
|
}
|
5775
|
5768
|
|
5776
|
5769
|
#endif // HAS_BED_PROBE
|
|
@@ -5798,8 +5791,9 @@ void home_all_axes() { gcode_G28(true); }
|
5798
|
5791
|
*
|
5799
|
5792
|
* Vn Verbose level:
|
5800
|
5793
|
* V0 Dry-run mode. Report settings and probe results. No calibration.
|
5801
|
|
- * V1 Report settings
|
5802
|
|
- * V2 Report settings and probe results
|
|
5794
|
+ * V1 Report start and end settings only
|
|
5795
|
+ * V2 Report settings at each iteration
|
|
5796
|
+ * V3 Report settings and probe results
|
5803
|
5797
|
*
|
5804
|
5798
|
* E Engage the probe for each point
|
5805
|
5799
|
*/
|
|
@@ -5812,12 +5806,12 @@ void home_all_axes() { gcode_G28(true); }
|
5812
|
5806
|
}
|
5813
|
5807
|
|
5814
|
5808
|
const int8_t verbose_level = parser.byteval('V', 1);
|
5815
|
|
- if (!WITHIN(verbose_level, 0, 2)) {
|
5816
|
|
- SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-2).");
|
|
5809
|
+ if (!WITHIN(verbose_level, 0, 3)) {
|
|
5810
|
+ SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-3).");
|
5817
|
5811
|
return;
|
5818
|
5812
|
}
|
5819
|
5813
|
|
5820
|
|
- const float calibration_precision = parser.floatval('C');
|
|
5814
|
+ const float calibration_precision = parser.floatval('C', 0.0);
|
5821
|
5815
|
if (calibration_precision < 0) {
|
5822
|
5816
|
SERIAL_PROTOCOLLNPGM("?(C)alibration precision is implausible (>=0).");
|
5823
|
5817
|
return;
|
|
@@ -5925,6 +5919,11 @@ void home_all_axes() { gcode_G28(true); }
|
5925
|
5919
|
// Probe the points
|
5926
|
5920
|
|
5927
|
5921
|
zero_std_dev = probe_G33_points(z_at_pt, probe_points, towers_set, stow_after_each);
|
|
5922
|
+ if (isnan(zero_std_dev)) {
|
|
5923
|
+ SERIAL_PROTOCOLPGM("Correct delta_radius with M665 R or end-stops with M666 X Y Z");
|
|
5924
|
+ SERIAL_EOL();
|
|
5925
|
+ return G33_CLEANUP();
|
|
5926
|
+ }
|
5928
|
5927
|
|
5929
|
5928
|
// Solve matrices
|
5930
|
5929
|
|
|
@@ -6038,7 +6037,7 @@ void home_all_axes() { gcode_G28(true); }
|
6038
|
6037
|
|
6039
|
6038
|
// print report
|
6040
|
6039
|
|
6041
|
|
- if (verbose_level != 1)
|
|
6040
|
+ if (verbose_level > 2)
|
6042
|
6041
|
print_G33_results(z_at_pt, _tower_results, _opposite_results);
|
6043
|
6042
|
|
6044
|
6043
|
if (verbose_level != 0) { // !dry run
|
|
@@ -6078,7 +6077,8 @@ void home_all_axes() { gcode_G28(true); }
|
6078
|
6077
|
SERIAL_PROTOCOL_F(zero_std_dev, 3);
|
6079
|
6078
|
SERIAL_EOL();
|
6080
|
6079
|
lcd_setstatus(mess);
|
6081
|
|
- print_G33_settings(_endstop_results, _angle_results);
|
|
6080
|
+ if (verbose_level > 1)
|
|
6081
|
+ print_G33_settings(_endstop_results, _angle_results);
|
6082
|
6082
|
}
|
6083
|
6083
|
}
|
6084
|
6084
|
else { // dry run
|
|
@@ -8981,10 +8981,7 @@ inline void gcode_M205() {
|
8981
|
8981
|
* Z = Rotate A and B by this angle
|
8982
|
8982
|
*/
|
8983
|
8983
|
inline void gcode_M665() {
|
8984
|
|
- if (parser.seen('H')) {
|
8985
|
|
- delta_height = parser.value_linear_units();
|
8986
|
|
- update_software_endstops(Z_AXIS);
|
8987
|
|
- }
|
|
8984
|
+ if (parser.seen('H')) delta_height = parser.value_linear_units();
|
8988
|
8985
|
if (parser.seen('L')) delta_diagonal_rod = parser.value_linear_units();
|
8989
|
8986
|
if (parser.seen('R')) delta_radius = parser.value_linear_units();
|
8990
|
8987
|
if (parser.seen('S')) delta_segments_per_second = parser.value_float();
|