Merge pull request #7727 from thinkyhead/apply_7697_from_1.1.x
G33 changes from 1.1.x
This commit is contained in:
commit
88407727ec
|
@ -45,6 +45,7 @@
|
|||
*
|
||||
* Pn Number of probe points:
|
||||
*
|
||||
* P0 No probe. Normalize only.
|
||||
* P1 Probe center and set height only.
|
||||
* P2 Probe center and towers. Set height, endstops, and delta radius.
|
||||
* P3 Probe all positions: center, towers and opposite towers. Set all.
|
||||
|
@ -73,7 +74,7 @@ static void print_signed_float(const char * const prefix, const float &f) {
|
|||
SERIAL_PROTOCOL_F(f, 2);
|
||||
}
|
||||
|
||||
static void print_G33_settings(const bool end_stops, const bool tower_angles){ // TODO echo these to LCD ???
|
||||
static void print_G33_settings(const bool end_stops, const bool tower_angles) {
|
||||
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
|
||||
if (end_stops) {
|
||||
print_signed_float(PSTR(" Ex"), delta_endstop_adj[A_AXIS]);
|
||||
|
@ -86,7 +87,8 @@ static void print_G33_settings(const bool end_stops, const bool tower_angles){ /
|
|||
SERIAL_PROTOCOLPGM(".Tower angle : ");
|
||||
print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
|
||||
print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]);
|
||||
SERIAL_PROTOCOLLNPGM(" Tz:+0.00");
|
||||
print_signed_float(PSTR("Tz"), delta_tower_angle_trim[C_AXIS]);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,8 +110,8 @@ static void G33_cleanup(
|
|||
void GcodeSuite::G33() {
|
||||
|
||||
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
|
||||
if (!WITHIN(probe_points, 1, 7)) {
|
||||
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (1-7).");
|
||||
if (!WITHIN(probe_points, 0, 7)) {
|
||||
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (0-7).");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -132,11 +134,12 @@ void GcodeSuite::G33() {
|
|||
}
|
||||
|
||||
const bool towers_set = parser.boolval('T', true),
|
||||
_0p_calibration = probe_points == 0,
|
||||
_1p_calibration = probe_points == 1,
|
||||
_4p_calibration = probe_points == 2,
|
||||
_4p_towers_points = _4p_calibration && towers_set,
|
||||
_4p_opposite_points = _4p_calibration && !towers_set,
|
||||
_7p_calibration = probe_points >= 3,
|
||||
_7p_calibration = probe_points >= 3 || _0p_calibration,
|
||||
_7p_half_circle = probe_points == 3,
|
||||
_7p_double_circle = probe_points == 5,
|
||||
_7p_triple_circle = probe_points == 6,
|
||||
|
@ -157,17 +160,20 @@ void GcodeSuite::G33() {
|
|||
zero_std_dev = (verbose_level ? 999.0 : 0.0), // 0.0 in dry-run mode : forced end
|
||||
zero_std_dev_old = zero_std_dev,
|
||||
zero_std_dev_min = zero_std_dev,
|
||||
e_old[XYZ] = {
|
||||
e_old[ABC] = {
|
||||
delta_endstop_adj[A_AXIS],
|
||||
delta_endstop_adj[B_AXIS],
|
||||
delta_endstop_adj[C_AXIS]
|
||||
},
|
||||
dr_old = delta_radius,
|
||||
zh_old = home_offset[Z_AXIS],
|
||||
alpha_old = delta_tower_angle_trim[A_AXIS],
|
||||
beta_old = delta_tower_angle_trim[B_AXIS];
|
||||
ta_old[ABC] = {
|
||||
delta_tower_angle_trim[A_AXIS],
|
||||
delta_tower_angle_trim[B_AXIS],
|
||||
delta_tower_angle_trim[C_AXIS]
|
||||
};
|
||||
|
||||
if (!_1p_calibration) { // test if the outer radius is reachable
|
||||
if (!_1p_calibration && !_0p_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),
|
||||
|
@ -198,9 +204,11 @@ void GcodeSuite::G33() {
|
|||
|
||||
setup_for_endstop_or_probe_move();
|
||||
endstops.enable(true);
|
||||
if (!home_delta())
|
||||
return;
|
||||
endstops.not_homing();
|
||||
if (!_0p_calibration) {
|
||||
if (!home_delta())
|
||||
return;
|
||||
endstops.not_homing();
|
||||
}
|
||||
|
||||
// print settings
|
||||
|
||||
|
@ -213,67 +221,71 @@ void GcodeSuite::G33() {
|
|||
print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
|
||||
|
||||
#if DISABLED(PROBE_MANUALLY)
|
||||
const float measured_z = probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
|
||||
if (isnan(measured_z)) return G33_CLEANUP();
|
||||
home_offset[Z_AXIS] -= measured_z;
|
||||
if (!_0p_calibration) {
|
||||
const float measured_z = probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
|
||||
if (isnan(measured_z)) return G33_CLEANUP();
|
||||
home_offset[Z_AXIS] -= measured_z;
|
||||
}
|
||||
#endif
|
||||
|
||||
do {
|
||||
|
||||
float z_at_pt[13] = { 0.0 };
|
||||
|
||||
test_precision = zero_std_dev_old != 999.0 ? (zero_std_dev + zero_std_dev_old) / 2 : zero_std_dev;
|
||||
test_precision = _0p_calibration ? 0.00 : zero_std_dev_old != 999.0 ? (zero_std_dev + zero_std_dev_old) / 2 : zero_std_dev;
|
||||
|
||||
iterations++;
|
||||
|
||||
// Probe the points
|
||||
|
||||
if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
z_at_pt[0] += lcd_probe_pt(0, 0);
|
||||
#else
|
||||
z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
|
||||
if (isnan(z_at_pt[0])) return G33_CLEANUP();
|
||||
#endif
|
||||
}
|
||||
if (_7p_calibration) { // probe extra center points
|
||||
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;
|
||||
if (!_0p_calibration){
|
||||
if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
z_at_pt[0] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
||||
z_at_pt[0] += lcd_probe_pt(0, 0);
|
||||
#else
|
||||
z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
||||
z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
|
||||
if (isnan(z_at_pt[0])) return G33_CLEANUP();
|
||||
#endif
|
||||
}
|
||||
z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
|
||||
}
|
||||
if (!_1p_calibration) { // probe the radius
|
||||
bool zig_zag = true;
|
||||
const uint8_t start = _4p_opposite_points ? 3 : 1,
|
||||
step = _4p_calibration ? 4 : _7p_half_circle ? 2 : 1;
|
||||
for (uint8_t axis = start; axis < 13; axis += step) {
|
||||
const float zigadd = (zig_zag ? 0.5 : 0.0),
|
||||
offset_circles = _7p_quadruple_circle ? zigadd + 1.0 :
|
||||
_7p_triple_circle ? zigadd + 0.5 :
|
||||
_7p_double_circle ? zigadd : 0;
|
||||
for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
|
||||
const float a = RADIANS(180 + 30 * axis),
|
||||
r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1));
|
||||
if (_7p_calibration) { // probe extra center points
|
||||
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;
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
z_at_pt[axis] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
||||
z_at_pt[0] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
||||
#else
|
||||
z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
||||
if (isnan(z_at_pt[axis])) return G33_CLEANUP();
|
||||
z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
||||
if (isnan(z_at_pt[0])) return G33_CLEANUP();
|
||||
#endif
|
||||
}
|
||||
zig_zag = !zig_zag;
|
||||
z_at_pt[axis] /= (2 * offset_circles + 1);
|
||||
z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
|
||||
}
|
||||
if (!_1p_calibration) { // probe the radius
|
||||
bool zig_zag = true;
|
||||
const uint8_t start = _4p_opposite_points ? 3 : 1,
|
||||
step = _4p_calibration ? 4 : _7p_half_circle ? 2 : 1;
|
||||
for (uint8_t axis = start; axis < 13; axis += step) {
|
||||
const float zigadd = (zig_zag ? 0.5 : 0.0),
|
||||
offset_circles = _7p_quadruple_circle ? zigadd + 1.0 :
|
||||
_7p_triple_circle ? zigadd + 0.5 :
|
||||
_7p_double_circle ? zigadd : 0;
|
||||
for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
|
||||
const float a = RADIANS(180 + 30 * axis),
|
||||
r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1));
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
z_at_pt[axis] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
||||
#else
|
||||
z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1);
|
||||
if (isnan(z_at_pt[axis])) return G33_CLEANUP();
|
||||
#endif
|
||||
}
|
||||
zig_zag = !zig_zag;
|
||||
z_at_pt[axis] /= (2 * offset_circles + 1);
|
||||
}
|
||||
}
|
||||
if (_7p_intermed_points) // average intermediates to tower and opposites
|
||||
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;
|
||||
}
|
||||
if (_7p_intermed_points) // average intermediates to tower and opposites
|
||||
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;
|
||||
|
||||
float S1 = z_at_pt[0],
|
||||
S2 = sq(z_at_pt[0]);
|
||||
|
@ -294,27 +306,20 @@ void GcodeSuite::G33() {
|
|||
COPY(e_old, delta_endstop_adj);
|
||||
dr_old = delta_radius;
|
||||
zh_old = home_offset[Z_AXIS];
|
||||
alpha_old = delta_tower_angle_trim[A_AXIS];
|
||||
beta_old = delta_tower_angle_trim[B_AXIS];
|
||||
COPY(ta_old, delta_tower_angle_trim);
|
||||
}
|
||||
|
||||
float e_delta[XYZ] = { 0.0 }, r_delta = 0.0, t_alpha = 0.0, t_beta = 0.0;
|
||||
float e_delta[ABC] = { 0.0 }, r_delta = 0.0, t_delta[ABC] = { 0.0 };
|
||||
const float r_diff = delta_radius - delta_calibration_radius,
|
||||
h_factor = 1.00 + r_diff * 0.001, //1.02 for r_diff = 20mm
|
||||
r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)), //2.25 for r_diff = 20mm
|
||||
a_factor = 100.0 / delta_calibration_radius; //1.25 for cal_rd = 80mm
|
||||
h_factor = (1.00 + r_diff * 0.001) / 6.0, //1.02 / 6 for r_diff = 20mm
|
||||
r_factor = -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)) / 6.0, //2.25 / 6 for r_diff = 20mm
|
||||
a_factor = 66.66 / delta_calibration_radius; //1.25 for cal_rd = 80mm
|
||||
|
||||
#define ZP(N,I) ((N) * z_at_pt[I])
|
||||
#define Z1000(I) ZP(1.00, I)
|
||||
#define Z1050(I) ZP(h_factor, I)
|
||||
#define Z0700(I) ZP(h_factor * 2.0 / 3.00, I)
|
||||
#define Z0350(I) ZP(h_factor / 3.00, I)
|
||||
#define Z0175(I) ZP(h_factor / 6.00, I)
|
||||
#define Z2250(I) ZP(r_factor, I)
|
||||
#define Z0750(I) ZP(r_factor / 3.00, I)
|
||||
#define Z0375(I) ZP(r_factor / 6.00, I)
|
||||
#define Z0444(I) ZP(a_factor * 4.0 / 9.0, I)
|
||||
#define Z0888(I) ZP(a_factor * 8.0 / 9.0, I)
|
||||
#define Z6(I) ZP(6, I)
|
||||
#define Z4(I) ZP(4, I)
|
||||
#define Z2(I) ZP(2, I)
|
||||
#define Z1(I) ZP(1, I)
|
||||
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
test_precision = 0.00; // forced end
|
||||
|
@ -323,58 +328,60 @@ void GcodeSuite::G33() {
|
|||
switch (probe_points) {
|
||||
case 1:
|
||||
test_precision = 0.00; // forced end
|
||||
LOOP_XYZ(i) e_delta[i] = Z1000(0);
|
||||
LOOP_XYZ(axis) e_delta[axis] = Z1(0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (towers_set) {
|
||||
e_delta[X_AXIS] = Z1050(0) + Z0700(1) - Z0350(5) - Z0350(9);
|
||||
e_delta[Y_AXIS] = Z1050(0) - Z0350(1) + Z0700(5) - Z0350(9);
|
||||
e_delta[Z_AXIS] = Z1050(0) - Z0350(1) - Z0350(5) + Z0700(9);
|
||||
r_delta = Z2250(0) - Z0750(1) - Z0750(5) - Z0750(9);
|
||||
e_delta[A_AXIS] = (Z6(0) + Z4(1) - Z2(5) - Z2(9)) * h_factor;
|
||||
e_delta[B_AXIS] = (Z6(0) - Z2(1) + Z4(5) - Z2(9)) * h_factor;
|
||||
e_delta[C_AXIS] = (Z6(0) - Z2(1) - Z2(5) + Z4(9)) * h_factor;
|
||||
r_delta = (Z6(0) - Z2(1) - Z2(5) - Z2(9)) * r_factor;
|
||||
}
|
||||
else {
|
||||
e_delta[X_AXIS] = Z1050(0) - Z0700(7) + Z0350(11) + Z0350(3);
|
||||
e_delta[Y_AXIS] = Z1050(0) + Z0350(7) - Z0700(11) + Z0350(3);
|
||||
e_delta[Z_AXIS] = Z1050(0) + Z0350(7) + Z0350(11) - Z0700(3);
|
||||
r_delta = Z2250(0) - Z0750(7) - Z0750(11) - Z0750(3);
|
||||
e_delta[A_AXIS] = (Z6(0) - Z4(7) + Z2(11) + Z2(3)) * h_factor;
|
||||
e_delta[B_AXIS] = (Z6(0) + Z2(7) - Z4(11) + Z2(3)) * h_factor;
|
||||
e_delta[C_AXIS] = (Z6(0) + Z2(7) + Z2(11) - Z4(3)) * h_factor;
|
||||
r_delta = (Z6(0) - Z2(7) - Z2(11) - Z2(3)) * r_factor;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
e_delta[X_AXIS] = Z1050(0) + Z0350(1) - Z0175(5) - Z0175(9) - Z0350(7) + Z0175(11) + Z0175(3);
|
||||
e_delta[Y_AXIS] = Z1050(0) - Z0175(1) + Z0350(5) - Z0175(9) + Z0175(7) - Z0350(11) + Z0175(3);
|
||||
e_delta[Z_AXIS] = Z1050(0) - Z0175(1) - Z0175(5) + Z0350(9) + Z0175(7) + Z0175(11) - Z0350(3);
|
||||
r_delta = Z2250(0) - Z0375(1) - Z0375(5) - Z0375(9) - Z0375(7) - Z0375(11) - Z0375(3);
|
||||
e_delta[A_AXIS] = (Z6(0) + Z2(1) - Z1(5) - Z1(9) - Z2(7) + Z1(11) + Z1(3)) * h_factor;
|
||||
e_delta[B_AXIS] = (Z6(0) - Z1(1) + Z2(5) - Z1(9) + Z1(7) - Z2(11) + Z1(3)) * h_factor;
|
||||
e_delta[C_AXIS] = (Z6(0) - Z1(1) - Z1(5) + Z2(9) + Z1(7) + Z1(11) - Z2(3)) * h_factor;
|
||||
r_delta = (Z6(0) - Z1(1) - Z1(5) - Z1(9) - Z1(7) - Z1(11) - Z1(3)) * r_factor;
|
||||
|
||||
if (towers_set) {
|
||||
t_alpha = Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3);
|
||||
t_beta = Z0888(1) - Z0444(5) - Z0444(9) + Z0888(7) - Z0444(11) - Z0444(3);
|
||||
t_delta[A_AXIS] = ( - Z2(5) + Z1(9) - Z2(11) + Z1(3)) * a_factor;
|
||||
t_delta[B_AXIS] = ( Z2(1) - Z1(9) + Z2(7) - Z1(3)) * a_factor;
|
||||
t_delta[C_AXIS] = ( -Z2(1) + Z1(5) - Z2(7) + Z1(11) ) * a_factor;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
LOOP_XYZ(axis) delta_endstop_adj[axis] += e_delta[axis];
|
||||
delta_radius += r_delta;
|
||||
delta_tower_angle_trim[A_AXIS] += t_alpha;
|
||||
delta_tower_angle_trim[B_AXIS] += t_beta;
|
||||
|
||||
// adjust delta_height and endstops by the max amount
|
||||
const float z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]);
|
||||
home_offset[Z_AXIS] -= z_temp;
|
||||
LOOP_XYZ(i) delta_endstop_adj[i] -= z_temp;
|
||||
|
||||
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
||||
LOOP_XYZ(axis) delta_tower_angle_trim[axis] += t_delta[axis];
|
||||
}
|
||||
else if (zero_std_dev >= test_precision) { // step one back
|
||||
COPY(delta_endstop_adj, e_old);
|
||||
delta_radius = dr_old;
|
||||
home_offset[Z_AXIS] = zh_old;
|
||||
delta_tower_angle_trim[A_AXIS] = alpha_old;
|
||||
delta_tower_angle_trim[B_AXIS] = beta_old;
|
||||
|
||||
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
||||
COPY(delta_tower_angle_trim, ta_old);
|
||||
}
|
||||
if (verbose_level != 0) { // !dry run
|
||||
// normalise angles to least squares
|
||||
float a_sum = 0.0;
|
||||
LOOP_XYZ(axis) a_sum += delta_tower_angle_trim[axis];
|
||||
LOOP_XYZ(axis) delta_tower_angle_trim[axis] -= a_sum / 3.0;
|
||||
|
||||
// adjust delta_height and endstops by the max amount
|
||||
const float z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]);
|
||||
home_offset[Z_AXIS] -= z_temp;
|
||||
LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp;
|
||||
}
|
||||
recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim);
|
||||
NOMORE(zero_std_dev_min, zero_std_dev);
|
||||
|
||||
// print report
|
||||
|
|
|
@ -54,11 +54,8 @@
|
|||
if (parser.seen('B')) delta_calibration_radius = parser.value_float();
|
||||
if (parser.seen('X')) delta_tower_angle_trim[A_AXIS] = parser.value_float();
|
||||
if (parser.seen('Y')) delta_tower_angle_trim[B_AXIS] = parser.value_float();
|
||||
if (parser.seen('Z')) { // rotate all 3 axis for Z = 0
|
||||
delta_tower_angle_trim[A_AXIS] -= parser.value_float();
|
||||
delta_tower_angle_trim[B_AXIS] -= parser.value_float();
|
||||
}
|
||||
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
||||
if (parser.seen('Z')) delta_tower_angle_trim[C_AXIS] = parser.value_float();
|
||||
recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim);
|
||||
}
|
||||
|
||||
#elif IS_SCARA
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
#endif
|
||||
LOOP_XYZ(i) {
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
delta_endstop_adj[i] = parser.value_linear_units();
|
||||
const float v = parser.value_linear_units();
|
||||
if (v * Z_HOME_DIR <= 0) delta_endstop_adj[i] = v;
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
SERIAL_ECHOPAIR("delta_endstop_adj[", axis_codes[i]);
|
||||
|
@ -56,10 +57,6 @@
|
|||
SERIAL_ECHOLNPGM("<<< M666");
|
||||
}
|
||||
#endif
|
||||
// normalize endstops so all are <=0; set the residue to delta height
|
||||
const float z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]);
|
||||
home_offset[Z_AXIS] -= z_temp;
|
||||
LOOP_XYZ(i) delta_endstop_adj[i] -= z_temp;
|
||||
}
|
||||
|
||||
#elif ENABLED(Z_DUAL_ENDSTOPS) // !DELTA && ENABLED(Z_DUAL_ENDSTOPS)
|
||||
|
|
|
@ -2666,7 +2666,7 @@ void kill_screen(const char* lcd_msg) {
|
|||
MENU_ITEM_EDIT(float52, MSG_DELTA_RADIUS, &delta_radius, DELTA_RADIUS - 5.0, DELTA_RADIUS + 5.0);
|
||||
MENU_ITEM_EDIT(float43, "Tx", &delta_tower_angle_trim[A_AXIS], -5.0, 5.0);
|
||||
MENU_ITEM_EDIT(float43, "Ty", &delta_tower_angle_trim[B_AXIS], -5.0, 5.0);
|
||||
MENU_ITEM_EDIT(float43, "Tz", &Tz, -5.0, 5.0);
|
||||
MENU_ITEM_EDIT(float43, "Tz", &delta_tower_angle_trim[C_AXIS], -5.0, 5.0);
|
||||
END_MENU();
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#define EEPROM_VERSION "V40"
|
||||
#define EEPROM_VERSION "V41"
|
||||
|
||||
// Change EEPROM version if these are changed:
|
||||
#define EEPROM_OFFSET 100
|
||||
|
||||
/**
|
||||
* V39 EEPROM Layout:
|
||||
* V41 EEPROM Layout:
|
||||
*
|
||||
* 100 Version (char x4)
|
||||
* 104 EEPROM CRC16 (uint16_t)
|
||||
|
@ -93,14 +93,14 @@
|
|||
* 329 G29 S ubl.state.storage_slot (int8_t)
|
||||
*
|
||||
* DELTA: 48 bytes
|
||||
* 348 M666 XYZ delta_endstop_adj (float x3)
|
||||
* 348 M666 XYZ delta_endstop_adj (float x3)
|
||||
* 360 M665 R delta_radius (float)
|
||||
* 364 M665 L delta_diagonal_rod (float)
|
||||
* 368 M665 S delta_segments_per_second (float)
|
||||
* 372 M665 B delta_calibration_radius (float)
|
||||
* 376 M665 X delta_tower_angle_trim[A] (float)
|
||||
* 380 M665 Y delta_tower_angle_trim[B] (float)
|
||||
* --- M665 Z delta_tower_angle_trim[C] (float) is always 0.0
|
||||
* 384 M665 Z delta_tower_angle_trim[C] (float)
|
||||
*
|
||||
* Z_DUAL_ENDSTOPS: 48 bytes
|
||||
* 348 M666 Z endstops.z_endstop_adj (float)
|
||||
|
@ -213,7 +213,7 @@ void MarlinSettings::postprocess() {
|
|||
// Make sure delta kinematics are updated before refreshing the
|
||||
// planner position so the stepper counts will be set correctly.
|
||||
#if ENABLED(DELTA)
|
||||
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
||||
recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim);
|
||||
#endif
|
||||
|
||||
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
|
||||
|
@ -415,16 +415,16 @@ void MarlinSettings::postprocess() {
|
|||
EEPROM_WRITE(storage_slot);
|
||||
#endif // AUTO_BED_LEVELING_UBL
|
||||
|
||||
// 9 floats for DELTA / Z_DUAL_ENDSTOPS
|
||||
// 10 floats for DELTA / Z_DUAL_ENDSTOPS
|
||||
#if ENABLED(DELTA)
|
||||
EEPROM_WRITE(delta_endstop_adj); // 3 floats
|
||||
EEPROM_WRITE(delta_endstop_adj); // 3 floats
|
||||
EEPROM_WRITE(delta_radius); // 1 float
|
||||
EEPROM_WRITE(delta_diagonal_rod); // 1 float
|
||||
EEPROM_WRITE(delta_segments_per_second); // 1 float
|
||||
EEPROM_WRITE(delta_calibration_radius); // 1 float
|
||||
EEPROM_WRITE(delta_tower_angle_trim); // 2 floats
|
||||
EEPROM_WRITE(delta_tower_angle_trim); // 3 floats
|
||||
dummy = 0.0f;
|
||||
for (uint8_t q = 3; q--;) EEPROM_WRITE(dummy);
|
||||
for (uint8_t q = 2; q--;) EEPROM_WRITE(dummy);
|
||||
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
||||
EEPROM_WRITE(endstops.z_endstop_adj); // 1 float
|
||||
dummy = 0.0f;
|
||||
|
@ -804,14 +804,14 @@ void MarlinSettings::postprocess() {
|
|||
#endif // AUTO_BED_LEVELING_UBL
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
EEPROM_READ(delta_endstop_adj); // 3 floats
|
||||
EEPROM_READ(delta_endstop_adj); // 3 floats
|
||||
EEPROM_READ(delta_radius); // 1 float
|
||||
EEPROM_READ(delta_diagonal_rod); // 1 float
|
||||
EEPROM_READ(delta_segments_per_second); // 1 float
|
||||
EEPROM_READ(delta_calibration_radius); // 1 float
|
||||
EEPROM_READ(delta_tower_angle_trim); // 2 floats
|
||||
EEPROM_READ(delta_tower_angle_trim); // 3 floats
|
||||
dummy = 0.0f;
|
||||
for (uint8_t q=3; q--;) EEPROM_READ(dummy);
|
||||
for (uint8_t q=2; q--;) EEPROM_READ(dummy);
|
||||
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
||||
EEPROM_READ(endstops.z_endstop_adj); // 1 float
|
||||
dummy = 0.0f;
|
||||
|
@ -1199,8 +1199,7 @@ void MarlinSettings::reset() {
|
|||
delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
||||
delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
|
||||
delta_calibration_radius = DELTA_CALIBRATION_RADIUS;
|
||||
delta_tower_angle_trim[A_AXIS] = dta[A_AXIS] - dta[C_AXIS];
|
||||
delta_tower_angle_trim[B_AXIS] = dta[B_AXIS] - dta[C_AXIS];
|
||||
COPY(delta_tower_angle_trim, dta);
|
||||
home_offset[Z_AXIS] = 0;
|
||||
|
||||
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
||||
|
@ -1615,7 +1614,7 @@ void MarlinSettings::reset() {
|
|||
SERIAL_ECHOPAIR(" B", LINEAR_UNIT(delta_calibration_radius));
|
||||
SERIAL_ECHOPAIR(" X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS]));
|
||||
SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(delta_tower_angle_trim[B_AXIS]));
|
||||
SERIAL_ECHOPAIR(" Z", 0.00);
|
||||
SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(delta_tower_angle_trim[C_AXIS]));
|
||||
SERIAL_EOL();
|
||||
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
||||
if (!forReplay) {
|
||||
|
|
|
@ -43,7 +43,7 @@ float delta_endstop_adj[ABC] = { 0 },
|
|||
delta_diagonal_rod,
|
||||
delta_segments_per_second,
|
||||
delta_calibration_radius,
|
||||
delta_tower_angle_trim[2];
|
||||
delta_tower_angle_trim[ABC];
|
||||
|
||||
float delta_tower[ABC][2],
|
||||
delta_diagonal_rod_2_tower[ABC],
|
||||
|
@ -55,15 +55,15 @@ float delta_safe_distance_from_top();
|
|||
* Recalculate factors used for delta kinematics whenever
|
||||
* settings have been changed (e.g., by M665).
|
||||
*/
|
||||
void recalc_delta_settings(float radius, float diagonal_rod) {
|
||||
void recalc_delta_settings(const float radius, const float diagonal_rod, const float tower_angle_trim[ABC]) {
|
||||
const float trt[ABC] = DELTA_RADIUS_TRIM_TOWER,
|
||||
drt[ABC] = DELTA_DIAGONAL_ROD_TRIM_TOWER;
|
||||
delta_tower[A_AXIS][X_AXIS] = cos(RADIANS(210 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); // front left tower
|
||||
delta_tower[A_AXIS][Y_AXIS] = sin(RADIANS(210 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]);
|
||||
delta_tower[B_AXIS][X_AXIS] = cos(RADIANS(330 + delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); // front right tower
|
||||
delta_tower[B_AXIS][Y_AXIS] = sin(RADIANS(330 + delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]);
|
||||
delta_tower[C_AXIS][X_AXIS] = 0.0; // back middle tower
|
||||
delta_tower[C_AXIS][Y_AXIS] = (radius + trt[C_AXIS]);
|
||||
delta_tower[A_AXIS][X_AXIS] = cos(RADIANS(210 + tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]); // front left tower
|
||||
delta_tower[A_AXIS][Y_AXIS] = sin(RADIANS(210 + tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]);
|
||||
delta_tower[B_AXIS][X_AXIS] = cos(RADIANS(330 + tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); // front right tower
|
||||
delta_tower[B_AXIS][Y_AXIS] = sin(RADIANS(330 + tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]);
|
||||
delta_tower[C_AXIS][X_AXIS] = cos(RADIANS( 90 + tower_angle_trim[C_AXIS])) * (radius + trt[C_AXIS]); // back middle tower
|
||||
delta_tower[C_AXIS][Y_AXIS] = sin(RADIANS( 90 + tower_angle_trim[C_AXIS])) * (radius + trt[C_AXIS]);
|
||||
delta_diagonal_rod_2_tower[A_AXIS] = sq(diagonal_rod + drt[A_AXIS]);
|
||||
delta_diagonal_rod_2_tower[B_AXIS] = sq(diagonal_rod + drt[B_AXIS]);
|
||||
delta_diagonal_rod_2_tower[C_AXIS] = sq(diagonal_rod + drt[C_AXIS]);
|
||||
|
|
|
@ -32,7 +32,7 @@ extern float delta_endstop_adj[ABC],
|
|||
delta_diagonal_rod,
|
||||
delta_segments_per_second,
|
||||
delta_calibration_radius,
|
||||
delta_tower_angle_trim[2];
|
||||
delta_tower_angle_trim[ABC];
|
||||
|
||||
extern float delta_tower[ABC][2],
|
||||
delta_diagonal_rod_2_tower[ABC],
|
||||
|
@ -42,7 +42,7 @@ extern float delta_tower[ABC][2],
|
|||
* Recalculate factors used for delta kinematics whenever
|
||||
* settings have been changed (e.g., by M665).
|
||||
*/
|
||||
void recalc_delta_settings(float radius, float diagonal_rod);
|
||||
void recalc_delta_settings(const float radius, const float diagonal_rod, const float tower_angle_trim[ABC]);
|
||||
|
||||
/**
|
||||
* Delta Inverse Kinematics
|
||||
|
|
|
@ -1134,7 +1134,7 @@ void homeaxis(const AxisEnum axis) {
|
|||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("delta_endstop_adj:");
|
||||
#endif
|
||||
do_homing_move(axis, delta_endstop_adj[axis] - 0.1);
|
||||
do_homing_move(axis, delta_endstop_adj[axis] - 0.1 * Z_HOME_DIR);
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
Loading…
Reference in a new issue