|
|
@ -2299,18 +2299,23 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
* - Raise to the BETWEEN height
|
|
|
|
* - Raise to the BETWEEN height
|
|
|
|
* - Return the probed Z position
|
|
|
|
* - Return the probed Z position
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
float probe_pt(const float &x, const float &y, const bool stow, const uint8_t verbose_level) {
|
|
|
|
float probe_pt(const float &lx, const float &ly, const bool stow, const uint8_t verbose_level, const bool printable=true) {
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
if (DEBUGGING(LEVELING)) {
|
|
|
|
SERIAL_ECHOPAIR(">>> probe_pt(", x);
|
|
|
|
SERIAL_ECHOPAIR(">>> probe_pt(", lx);
|
|
|
|
SERIAL_ECHOPAIR(", ", y);
|
|
|
|
SERIAL_ECHOPAIR(", ", ly);
|
|
|
|
SERIAL_ECHOPAIR(", ", stow ? "" : "no ");
|
|
|
|
SERIAL_ECHOPAIR(", ", stow ? "" : "no ");
|
|
|
|
SERIAL_ECHOLNPGM("stow)");
|
|
|
|
SERIAL_ECHOLNPGM("stow)");
|
|
|
|
DEBUG_POS("", current_position);
|
|
|
|
DEBUG_POS("", current_position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (!position_is_reachable_by_probe_xy(x, y)) return NAN;
|
|
|
|
const float nx = lx - (X_PROBE_OFFSET_FROM_EXTRUDER), ny = ly - (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (printable)
|
|
|
|
|
|
|
|
if (!position_is_reachable_by_probe_xy(lx, ly)) return NAN;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
if (!position_is_reachable_xy(nx, ny)) return NAN;
|
|
|
|
|
|
|
|
|
|
|
|
const float old_feedrate_mm_s = feedrate_mm_s;
|
|
|
|
const float old_feedrate_mm_s = feedrate_mm_s;
|
|
|
|
|
|
|
|
|
|
|
@ -2325,7 +2330,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S;
|
|
|
|
feedrate_mm_s = XY_PROBE_FEEDRATE_MM_S;
|
|
|
|
|
|
|
|
|
|
|
|
// Move the probe to the given XY
|
|
|
|
// Move the probe to the given XY
|
|
|
|
do_blocking_move_to_xy(x - (X_PROBE_OFFSET_FROM_EXTRUDER), y - (Y_PROBE_OFFSET_FROM_EXTRUDER));
|
|
|
|
do_blocking_move_to_xy(nx, ny);
|
|
|
|
|
|
|
|
|
|
|
|
if (DEPLOY_PROBE()) return NAN;
|
|
|
|
if (DEPLOY_PROBE()) return NAN;
|
|
|
|
|
|
|
|
|
|
|
@ -2338,9 +2343,9 @@ static void clean_up_after_endstop_or_probe_move() {
|
|
|
|
|
|
|
|
|
|
|
|
if (verbose_level > 2) {
|
|
|
|
if (verbose_level > 2) {
|
|
|
|
SERIAL_PROTOCOLPGM("Bed X: ");
|
|
|
|
SERIAL_PROTOCOLPGM("Bed X: ");
|
|
|
|
SERIAL_PROTOCOL_F(x, 3);
|
|
|
|
SERIAL_PROTOCOL_F(lx, 3);
|
|
|
|
SERIAL_PROTOCOLPGM(" Y: ");
|
|
|
|
SERIAL_PROTOCOLPGM(" Y: ");
|
|
|
|
SERIAL_PROTOCOL_F(y, 3);
|
|
|
|
SERIAL_PROTOCOL_F(ly, 3);
|
|
|
|
SERIAL_PROTOCOLPGM(" Z: ");
|
|
|
|
SERIAL_PROTOCOLPGM(" Z: ");
|
|
|
|
SERIAL_PROTOCOL_F(measured_z, 3);
|
|
|
|
SERIAL_PROTOCOL_F(measured_z, 3);
|
|
|
|
SERIAL_EOL();
|
|
|
|
SERIAL_EOL();
|
|
|
@ -5136,7 +5141,7 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
* P3 Probe all positions: center, towers and opposite towers. Set all.
|
|
|
|
* P3 Probe all positions: center, towers and opposite towers. Set all.
|
|
|
|
* P4-P7 Probe all positions at different locations and average them.
|
|
|
|
* P4-P7 Probe all positions at different locations and average them.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* T Don't calibrate tower angle corrections
|
|
|
|
* T0 Don't calibrate tower angle corrections
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Cn.nn Calibration precision; when omitted calibrates to maximum precision
|
|
|
|
* Cn.nn Calibration precision; when omitted calibrates to maximum precision
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -5185,7 +5190,7 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const bool towers_set = !parser.boolval('T'),
|
|
|
|
const bool towers_set = parser.boolval('T', true),
|
|
|
|
stow_after_each = parser.boolval('E'),
|
|
|
|
stow_after_each = parser.boolval('E'),
|
|
|
|
_1p_calibration = probe_points == 1,
|
|
|
|
_1p_calibration = probe_points == 1,
|
|
|
|
_4p_calibration = probe_points == 2,
|
|
|
|
_4p_calibration = probe_points == 2,
|
|
|
@ -5198,20 +5203,6 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
_7p_quadruple_circle = probe_points == 7,
|
|
|
|
_7p_quadruple_circle = probe_points == 7,
|
|
|
|
_7p_multi_circle = _7p_double_circle || _7p_triple_circle || _7p_quadruple_circle,
|
|
|
|
_7p_multi_circle = _7p_double_circle || _7p_triple_circle || _7p_quadruple_circle,
|
|
|
|
_7p_intermed_points = _7p_calibration && !_7p_half_circle;
|
|
|
|
_7p_intermed_points = _7p_calibration && !_7p_half_circle;
|
|
|
|
|
|
|
|
|
|
|
|
if (!_1p_calibration) { // test if the outer radius is reachable
|
|
|
|
|
|
|
|
const float circles = (_7p_quadruple_circle ? 1.5 :
|
|
|
|
|
|
|
|
_7p_triple_circle ? 1.0 :
|
|
|
|
|
|
|
|
_7p_double_circle ? 0.5 : 0),
|
|
|
|
|
|
|
|
radius = (1 + circles * 0.1) * delta_calibration_radius;
|
|
|
|
|
|
|
|
for (uint8_t axis = 1; axis < 13; ++axis) {
|
|
|
|
|
|
|
|
if (!position_is_reachable_xy(cos(RADIANS(180 + 30 * axis)) * radius, sin(RADIANS(180 + 30 * axis)) * radius)) {
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("?(M665 B)ed radius is implausible.");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h";
|
|
|
|
const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h";
|
|
|
|
const float dx = (X_PROBE_OFFSET_FROM_EXTRUDER),
|
|
|
|
const float dx = (X_PROBE_OFFSET_FROM_EXTRUDER),
|
|
|
|
dy = (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
|
|
|
dy = (Y_PROBE_OFFSET_FROM_EXTRUDER);
|
|
|
@ -5230,6 +5221,19 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
alpha_old = delta_tower_angle_trim[A_AXIS],
|
|
|
|
alpha_old = delta_tower_angle_trim[A_AXIS],
|
|
|
|
beta_old = delta_tower_angle_trim[B_AXIS];
|
|
|
|
beta_old = delta_tower_angle_trim[B_AXIS];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!_1p_calibration) { // test if the outer radius is reachable
|
|
|
|
|
|
|
|
const float circles = (_7p_quadruple_circle ? 1.5 :
|
|
|
|
|
|
|
|
_7p_triple_circle ? 1.0 :
|
|
|
|
|
|
|
|
_7p_double_circle ? 0.5 : 0),
|
|
|
|
|
|
|
|
r = (1 + circles * 0.1) * delta_calibration_radius;
|
|
|
|
|
|
|
|
for (uint8_t axis = 1; axis < 13; ++axis) {
|
|
|
|
|
|
|
|
const float a = RADIANS(180 + 30 * axis);
|
|
|
|
|
|
|
|
if (!position_is_reachable_xy(cos(a) * r, sin(a) * r)) {
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("?(M665 B)ed radius is implausible.");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate");
|
|
|
|
SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate");
|
|
|
|
|
|
|
|
|
|
|
|
stepper.synchronize();
|
|
|
|
stepper.synchronize();
|
|
|
@ -5269,13 +5273,11 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
SERIAL_EOL();
|
|
|
|
SERIAL_EOL();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1); // 1st probe to set height
|
|
|
|
home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
|
|
|
|
do_probe_raise(Z_CLEARANCE_BETWEEN_PROBES);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
|
|
|
|
|
|
|
|
float z_at_pt[13] = { 0.0 }, S1 = 0.0, S2 = 0.0;
|
|
|
|
float z_at_pt[13] = { 0.0 };
|
|
|
|
int16_t N = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_precision = zero_std_dev_old != 999.0 ? (zero_std_dev + zero_std_dev_old) / 2 : zero_std_dev;
|
|
|
|
test_precision = zero_std_dev_old != 999.0 ? (zero_std_dev + zero_std_dev_old) / 2 : zero_std_dev;
|
|
|
|
|
|
|
|
|
|
|
@ -5284,12 +5286,12 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
// Probe the points
|
|
|
|
// Probe the points
|
|
|
|
|
|
|
|
|
|
|
|
if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
|
|
|
|
if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
|
|
|
|
z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1);
|
|
|
|
z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_7p_calibration) { // probe extra center points
|
|
|
|
if (_7p_calibration) { // probe extra center points
|
|
|
|
for (int8_t axis = _7p_multi_circle ? 11 : 9; axis > 0; axis -= _7p_multi_circle ? 2 : 4) {
|
|
|
|
for (int8_t axis = _7p_multi_circle ? 11 : 9; axis > 0; axis -= _7p_multi_circle ? 2 : 4) {
|
|
|
|
const float a = RADIANS(180 + 30 * axis), r = delta_calibration_radius * 0.1;
|
|
|
|
const float a = RADIANS(180 + 30 * axis), r = delta_calibration_radius * 0.1;
|
|
|
|
z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
|
|
|
z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
|
|
|
|
z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -5305,19 +5307,19 @@ void home_all_axes() { gcode_G28(true); }
|
|
|
|
for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
|
|
|
|
for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
|
|
|
|
const float a = RADIANS(180 + 30 * axis),
|
|
|
|
const float a = RADIANS(180 + 30 * axis),
|
|
|
|
r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1));
|
|
|
|
r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1));
|
|
|
|
z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
|
|
|
z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
zig_zag = !zig_zag;
|
|
|
|
zig_zag = !zig_zag;
|
|
|
|
z_at_pt[axis] /= (2 * offset_circles + 1);
|
|
|
|
z_at_pt[axis] /= (2 * offset_circles + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (_7p_intermed_points) // average intermediates to tower and opposites
|
|
|
|
if (_7p_intermed_points) // average intermediates to tower and opposites
|
|
|
|
for (uint8_t axis = 1; axis <= 11; axis += 2)
|
|
|
|
for (uint8_t axis = 1; axis < 13; axis += 2)
|
|
|
|
z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0;
|
|
|
|
z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0;
|
|
|
|
|
|
|
|
|
|
|
|
S1 += z_at_pt[0];
|
|
|
|
float S1 = z_at_pt[0],
|
|
|
|
S2 += sq(z_at_pt[0]);
|
|
|
|
S2 = sq(z_at_pt[0]);
|
|
|
|
N++;
|
|
|
|
int16_t N = 1;
|
|
|
|
if (!_1p_calibration) // std dev from zero plane
|
|
|
|
if (!_1p_calibration) // std dev from zero plane
|
|
|
|
for (uint8_t axis = (_4p_opposite_points ? 3 : 1); axis < 13; axis += (_4p_calibration ? 4 : 2)) {
|
|
|
|
for (uint8_t axis = (_4p_opposite_points ? 3 : 1); axis < 13; axis += (_4p_calibration ? 4 : 2)) {
|
|
|
|
S1 += z_at_pt[axis];
|
|
|
|
S1 += z_at_pt[axis];
|
|
|
|