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:
|
* Pn Number of probe points:
|
||||||
*
|
*
|
||||||
|
* P0 No probe. Normalize only.
|
||||||
* P1 Probe center and set height only.
|
* P1 Probe center and set height only.
|
||||||
* P2 Probe center and towers. Set height, endstops, and delta radius.
|
* P2 Probe center and towers. Set height, endstops, and delta radius.
|
||||||
* P3 Probe all positions: center, towers and opposite towers. Set all.
|
* 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);
|
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]);
|
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
|
||||||
if (end_stops) {
|
if (end_stops) {
|
||||||
print_signed_float(PSTR(" Ex"), delta_endstop_adj[A_AXIS]);
|
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 : ");
|
SERIAL_PROTOCOLPGM(".Tower angle : ");
|
||||||
print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
|
print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]);
|
||||||
print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_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() {
|
void GcodeSuite::G33() {
|
||||||
|
|
||||||
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
|
const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
|
||||||
if (!WITHIN(probe_points, 1, 7)) {
|
if (!WITHIN(probe_points, 0, 7)) {
|
||||||
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (1-7).");
|
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (0-7).");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,11 +134,12 @@ void GcodeSuite::G33() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool towers_set = parser.boolval('T', true),
|
const bool towers_set = parser.boolval('T', true),
|
||||||
|
_0p_calibration = probe_points == 0,
|
||||||
_1p_calibration = probe_points == 1,
|
_1p_calibration = probe_points == 1,
|
||||||
_4p_calibration = probe_points == 2,
|
_4p_calibration = probe_points == 2,
|
||||||
_4p_towers_points = _4p_calibration && towers_set,
|
_4p_towers_points = _4p_calibration && towers_set,
|
||||||
_4p_opposite_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_half_circle = probe_points == 3,
|
||||||
_7p_double_circle = probe_points == 5,
|
_7p_double_circle = probe_points == 5,
|
||||||
_7p_triple_circle = probe_points == 6,
|
_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 = (verbose_level ? 999.0 : 0.0), // 0.0 in dry-run mode : forced end
|
||||||
zero_std_dev_old = zero_std_dev,
|
zero_std_dev_old = zero_std_dev,
|
||||||
zero_std_dev_min = zero_std_dev,
|
zero_std_dev_min = zero_std_dev,
|
||||||
e_old[XYZ] = {
|
e_old[ABC] = {
|
||||||
delta_endstop_adj[A_AXIS],
|
delta_endstop_adj[A_AXIS],
|
||||||
delta_endstop_adj[B_AXIS],
|
delta_endstop_adj[B_AXIS],
|
||||||
delta_endstop_adj[C_AXIS]
|
delta_endstop_adj[C_AXIS]
|
||||||
},
|
},
|
||||||
dr_old = delta_radius,
|
dr_old = delta_radius,
|
||||||
zh_old = home_offset[Z_AXIS],
|
zh_old = home_offset[Z_AXIS],
|
||||||
alpha_old = delta_tower_angle_trim[A_AXIS],
|
ta_old[ABC] = {
|
||||||
beta_old = delta_tower_angle_trim[B_AXIS];
|
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 :
|
const float circles = (_7p_quadruple_circle ? 1.5 :
|
||||||
_7p_triple_circle ? 1.0 :
|
_7p_triple_circle ? 1.0 :
|
||||||
_7p_double_circle ? 0.5 : 0),
|
_7p_double_circle ? 0.5 : 0),
|
||||||
|
@ -198,9 +204,11 @@ void GcodeSuite::G33() {
|
||||||
|
|
||||||
setup_for_endstop_or_probe_move();
|
setup_for_endstop_or_probe_move();
|
||||||
endstops.enable(true);
|
endstops.enable(true);
|
||||||
|
if (!_0p_calibration) {
|
||||||
if (!home_delta())
|
if (!home_delta())
|
||||||
return;
|
return;
|
||||||
endstops.not_homing();
|
endstops.not_homing();
|
||||||
|
}
|
||||||
|
|
||||||
// print settings
|
// print settings
|
||||||
|
|
||||||
|
@ -213,21 +221,24 @@ void GcodeSuite::G33() {
|
||||||
print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
|
print_G33_settings(!_1p_calibration, _7p_calibration && towers_set);
|
||||||
|
|
||||||
#if DISABLED(PROBE_MANUALLY)
|
#if DISABLED(PROBE_MANUALLY)
|
||||||
|
if (!_0p_calibration) {
|
||||||
const float measured_z = probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
|
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();
|
if (isnan(measured_z)) return G33_CLEANUP();
|
||||||
home_offset[Z_AXIS] -= measured_z;
|
home_offset[Z_AXIS] -= measured_z;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
float z_at_pt[13] = { 0.0 };
|
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++;
|
iterations++;
|
||||||
|
|
||||||
// Probe the points
|
// Probe the points
|
||||||
|
|
||||||
|
if (!_0p_calibration){
|
||||||
if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
|
if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
|
||||||
#if ENABLED(PROBE_MANUALLY)
|
#if ENABLED(PROBE_MANUALLY)
|
||||||
z_at_pt[0] += lcd_probe_pt(0, 0);
|
z_at_pt[0] += lcd_probe_pt(0, 0);
|
||||||
|
@ -274,6 +285,7 @@ void GcodeSuite::G33() {
|
||||||
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 < 13; 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;
|
||||||
|
}
|
||||||
|
|
||||||
float S1 = z_at_pt[0],
|
float S1 = z_at_pt[0],
|
||||||
S2 = sq(z_at_pt[0]);
|
S2 = sq(z_at_pt[0]);
|
||||||
|
@ -294,27 +306,20 @@ void GcodeSuite::G33() {
|
||||||
COPY(e_old, delta_endstop_adj);
|
COPY(e_old, delta_endstop_adj);
|
||||||
dr_old = delta_radius;
|
dr_old = delta_radius;
|
||||||
zh_old = home_offset[Z_AXIS];
|
zh_old = home_offset[Z_AXIS];
|
||||||
alpha_old = delta_tower_angle_trim[A_AXIS];
|
COPY(ta_old, delta_tower_angle_trim);
|
||||||
beta_old = delta_tower_angle_trim[B_AXIS];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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,
|
const float r_diff = delta_radius - delta_calibration_radius,
|
||||||
h_factor = 1.00 + r_diff * 0.001, //1.02 for r_diff = 20mm
|
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)), //2.25 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 = 100.0 / delta_calibration_radius; //1.25 for cal_rd = 80mm
|
a_factor = 66.66 / delta_calibration_radius; //1.25 for cal_rd = 80mm
|
||||||
|
|
||||||
#define ZP(N,I) ((N) * z_at_pt[I])
|
#define ZP(N,I) ((N) * z_at_pt[I])
|
||||||
#define Z1000(I) ZP(1.00, I)
|
#define Z6(I) ZP(6, I)
|
||||||
#define Z1050(I) ZP(h_factor, I)
|
#define Z4(I) ZP(4, I)
|
||||||
#define Z0700(I) ZP(h_factor * 2.0 / 3.00, I)
|
#define Z2(I) ZP(2, I)
|
||||||
#define Z0350(I) ZP(h_factor / 3.00, I)
|
#define Z1(I) ZP(1, 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)
|
|
||||||
|
|
||||||
#if ENABLED(PROBE_MANUALLY)
|
#if ENABLED(PROBE_MANUALLY)
|
||||||
test_precision = 0.00; // forced end
|
test_precision = 0.00; // forced end
|
||||||
|
@ -323,58 +328,60 @@ void GcodeSuite::G33() {
|
||||||
switch (probe_points) {
|
switch (probe_points) {
|
||||||
case 1:
|
case 1:
|
||||||
test_precision = 0.00; // forced end
|
test_precision = 0.00; // forced end
|
||||||
LOOP_XYZ(i) e_delta[i] = Z1000(0);
|
LOOP_XYZ(axis) e_delta[axis] = Z1(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if (towers_set) {
|
if (towers_set) {
|
||||||
e_delta[X_AXIS] = Z1050(0) + Z0700(1) - Z0350(5) - Z0350(9);
|
e_delta[A_AXIS] = (Z6(0) + Z4(1) - Z2(5) - Z2(9)) * h_factor;
|
||||||
e_delta[Y_AXIS] = Z1050(0) - Z0350(1) + Z0700(5) - Z0350(9);
|
e_delta[B_AXIS] = (Z6(0) - Z2(1) + Z4(5) - Z2(9)) * h_factor;
|
||||||
e_delta[Z_AXIS] = Z1050(0) - Z0350(1) - Z0350(5) + Z0700(9);
|
e_delta[C_AXIS] = (Z6(0) - Z2(1) - Z2(5) + Z4(9)) * h_factor;
|
||||||
r_delta = Z2250(0) - Z0750(1) - Z0750(5) - Z0750(9);
|
r_delta = (Z6(0) - Z2(1) - Z2(5) - Z2(9)) * r_factor;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
e_delta[X_AXIS] = Z1050(0) - Z0700(7) + Z0350(11) + Z0350(3);
|
e_delta[A_AXIS] = (Z6(0) - Z4(7) + Z2(11) + Z2(3)) * h_factor;
|
||||||
e_delta[Y_AXIS] = Z1050(0) + Z0350(7) - Z0700(11) + Z0350(3);
|
e_delta[B_AXIS] = (Z6(0) + Z2(7) - Z4(11) + Z2(3)) * h_factor;
|
||||||
e_delta[Z_AXIS] = Z1050(0) + Z0350(7) + Z0350(11) - Z0700(3);
|
e_delta[C_AXIS] = (Z6(0) + Z2(7) + Z2(11) - Z4(3)) * h_factor;
|
||||||
r_delta = Z2250(0) - Z0750(7) - Z0750(11) - Z0750(3);
|
r_delta = (Z6(0) - Z2(7) - Z2(11) - Z2(3)) * r_factor;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
e_delta[X_AXIS] = Z1050(0) + Z0350(1) - Z0175(5) - Z0175(9) - Z0350(7) + Z0175(11) + Z0175(3);
|
e_delta[A_AXIS] = (Z6(0) + Z2(1) - Z1(5) - Z1(9) - Z2(7) + Z1(11) + Z1(3)) * h_factor;
|
||||||
e_delta[Y_AXIS] = Z1050(0) - Z0175(1) + Z0350(5) - Z0175(9) + Z0175(7) - Z0350(11) + Z0175(3);
|
e_delta[B_AXIS] = (Z6(0) - Z1(1) + Z2(5) - Z1(9) + Z1(7) - Z2(11) + Z1(3)) * h_factor;
|
||||||
e_delta[Z_AXIS] = Z1050(0) - Z0175(1) - Z0175(5) + Z0350(9) + Z0175(7) + Z0175(11) - Z0350(3);
|
e_delta[C_AXIS] = (Z6(0) - Z1(1) - Z1(5) + Z2(9) + Z1(7) + Z1(11) - Z2(3)) * h_factor;
|
||||||
r_delta = Z2250(0) - Z0375(1) - Z0375(5) - Z0375(9) - Z0375(7) - Z0375(11) - Z0375(3);
|
r_delta = (Z6(0) - Z1(1) - Z1(5) - Z1(9) - Z1(7) - Z1(11) - Z1(3)) * r_factor;
|
||||||
|
|
||||||
if (towers_set) {
|
if (towers_set) {
|
||||||
t_alpha = Z0444(1) - Z0888(5) + Z0444(9) + Z0444(7) - Z0888(11) + Z0444(3);
|
t_delta[A_AXIS] = ( - Z2(5) + Z1(9) - Z2(11) + Z1(3)) * a_factor;
|
||||||
t_beta = Z0888(1) - Z0444(5) - Z0444(9) + Z0888(7) - Z0444(11) - Z0444(3);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOOP_XYZ(axis) delta_endstop_adj[axis] += e_delta[axis];
|
LOOP_XYZ(axis) delta_endstop_adj[axis] += e_delta[axis];
|
||||||
delta_radius += r_delta;
|
delta_radius += r_delta;
|
||||||
delta_tower_angle_trim[A_AXIS] += t_alpha;
|
LOOP_XYZ(axis) delta_tower_angle_trim[axis] += t_delta[axis];
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
else if (zero_std_dev >= test_precision) { // step one back
|
else if (zero_std_dev >= test_precision) { // step one back
|
||||||
COPY(delta_endstop_adj, e_old);
|
COPY(delta_endstop_adj, e_old);
|
||||||
delta_radius = dr_old;
|
delta_radius = dr_old;
|
||||||
home_offset[Z_AXIS] = zh_old;
|
home_offset[Z_AXIS] = zh_old;
|
||||||
delta_tower_angle_trim[A_AXIS] = alpha_old;
|
COPY(delta_tower_angle_trim, ta_old);
|
||||||
delta_tower_angle_trim[B_AXIS] = beta_old;
|
|
||||||
|
|
||||||
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
|
||||||
}
|
}
|
||||||
|
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);
|
NOMORE(zero_std_dev_min, zero_std_dev);
|
||||||
|
|
||||||
// print report
|
// print report
|
||||||
|
|
|
@ -54,11 +54,8 @@
|
||||||
if (parser.seen('B')) delta_calibration_radius = parser.value_float();
|
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('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('Y')) delta_tower_angle_trim[B_AXIS] = parser.value_float();
|
||||||
if (parser.seen('Z')) { // rotate all 3 axis for Z = 0
|
if (parser.seen('Z')) delta_tower_angle_trim[C_AXIS] = parser.value_float();
|
||||||
delta_tower_angle_trim[A_AXIS] -= parser.value_float();
|
recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim);
|
||||||
delta_tower_angle_trim[B_AXIS] -= parser.value_float();
|
|
||||||
}
|
|
||||||
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif IS_SCARA
|
#elif IS_SCARA
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
#endif
|
#endif
|
||||||
LOOP_XYZ(i) {
|
LOOP_XYZ(i) {
|
||||||
if (parser.seen(axis_codes[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 ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) {
|
if (DEBUGGING(LEVELING)) {
|
||||||
SERIAL_ECHOPAIR("delta_endstop_adj[", axis_codes[i]);
|
SERIAL_ECHOPAIR("delta_endstop_adj[", axis_codes[i]);
|
||||||
|
@ -56,10 +57,6 @@
|
||||||
SERIAL_ECHOLNPGM("<<< M666");
|
SERIAL_ECHOLNPGM("<<< M666");
|
||||||
}
|
}
|
||||||
#endif
|
#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)
|
#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(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, "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, "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();
|
END_MENU();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,13 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define EEPROM_VERSION "V40"
|
#define EEPROM_VERSION "V41"
|
||||||
|
|
||||||
// Change EEPROM version if these are changed:
|
// Change EEPROM version if these are changed:
|
||||||
#define EEPROM_OFFSET 100
|
#define EEPROM_OFFSET 100
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* V39 EEPROM Layout:
|
* V41 EEPROM Layout:
|
||||||
*
|
*
|
||||||
* 100 Version (char x4)
|
* 100 Version (char x4)
|
||||||
* 104 EEPROM CRC16 (uint16_t)
|
* 104 EEPROM CRC16 (uint16_t)
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
* 372 M665 B delta_calibration_radius (float)
|
* 372 M665 B delta_calibration_radius (float)
|
||||||
* 376 M665 X delta_tower_angle_trim[A] (float)
|
* 376 M665 X delta_tower_angle_trim[A] (float)
|
||||||
* 380 M665 Y delta_tower_angle_trim[B] (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
|
* Z_DUAL_ENDSTOPS: 48 bytes
|
||||||
* 348 M666 Z endstops.z_endstop_adj (float)
|
* 348 M666 Z endstops.z_endstop_adj (float)
|
||||||
|
@ -213,7 +213,7 @@ void MarlinSettings::postprocess() {
|
||||||
// Make sure delta kinematics are updated before refreshing the
|
// Make sure delta kinematics are updated before refreshing the
|
||||||
// planner position so the stepper counts will be set correctly.
|
// planner position so the stepper counts will be set correctly.
|
||||||
#if ENABLED(DELTA)
|
#if ENABLED(DELTA)
|
||||||
recalc_delta_settings(delta_radius, delta_diagonal_rod);
|
recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
|
// Refresh steps_to_mm with the reciprocal of axis_steps_per_mm
|
||||||
|
@ -415,16 +415,16 @@ void MarlinSettings::postprocess() {
|
||||||
EEPROM_WRITE(storage_slot);
|
EEPROM_WRITE(storage_slot);
|
||||||
#endif // AUTO_BED_LEVELING_UBL
|
#endif // AUTO_BED_LEVELING_UBL
|
||||||
|
|
||||||
// 9 floats for DELTA / Z_DUAL_ENDSTOPS
|
// 10 floats for DELTA / Z_DUAL_ENDSTOPS
|
||||||
#if ENABLED(DELTA)
|
#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_radius); // 1 float
|
||||||
EEPROM_WRITE(delta_diagonal_rod); // 1 float
|
EEPROM_WRITE(delta_diagonal_rod); // 1 float
|
||||||
EEPROM_WRITE(delta_segments_per_second); // 1 float
|
EEPROM_WRITE(delta_segments_per_second); // 1 float
|
||||||
EEPROM_WRITE(delta_calibration_radius); // 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;
|
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)
|
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
EEPROM_WRITE(endstops.z_endstop_adj); // 1 float
|
EEPROM_WRITE(endstops.z_endstop_adj); // 1 float
|
||||||
dummy = 0.0f;
|
dummy = 0.0f;
|
||||||
|
@ -809,9 +809,9 @@ void MarlinSettings::postprocess() {
|
||||||
EEPROM_READ(delta_diagonal_rod); // 1 float
|
EEPROM_READ(delta_diagonal_rod); // 1 float
|
||||||
EEPROM_READ(delta_segments_per_second); // 1 float
|
EEPROM_READ(delta_segments_per_second); // 1 float
|
||||||
EEPROM_READ(delta_calibration_radius); // 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;
|
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)
|
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
EEPROM_READ(endstops.z_endstop_adj); // 1 float
|
EEPROM_READ(endstops.z_endstop_adj); // 1 float
|
||||||
dummy = 0.0f;
|
dummy = 0.0f;
|
||||||
|
@ -1199,8 +1199,7 @@ void MarlinSettings::reset() {
|
||||||
delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
delta_diagonal_rod = DELTA_DIAGONAL_ROD;
|
||||||
delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
|
delta_segments_per_second = DELTA_SEGMENTS_PER_SECOND;
|
||||||
delta_calibration_radius = DELTA_CALIBRATION_RADIUS;
|
delta_calibration_radius = DELTA_CALIBRATION_RADIUS;
|
||||||
delta_tower_angle_trim[A_AXIS] = dta[A_AXIS] - dta[C_AXIS];
|
COPY(delta_tower_angle_trim, dta);
|
||||||
delta_tower_angle_trim[B_AXIS] = dta[B_AXIS] - dta[C_AXIS];
|
|
||||||
home_offset[Z_AXIS] = 0;
|
home_offset[Z_AXIS] = 0;
|
||||||
|
|
||||||
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
|
@ -1615,7 +1614,7 @@ void MarlinSettings::reset() {
|
||||||
SERIAL_ECHOPAIR(" B", LINEAR_UNIT(delta_calibration_radius));
|
SERIAL_ECHOPAIR(" B", LINEAR_UNIT(delta_calibration_radius));
|
||||||
SERIAL_ECHOPAIR(" X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS]));
|
SERIAL_ECHOPAIR(" X", LINEAR_UNIT(delta_tower_angle_trim[A_AXIS]));
|
||||||
SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(delta_tower_angle_trim[B_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();
|
SERIAL_EOL();
|
||||||
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
#elif ENABLED(Z_DUAL_ENDSTOPS)
|
||||||
if (!forReplay) {
|
if (!forReplay) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ float delta_endstop_adj[ABC] = { 0 },
|
||||||
delta_diagonal_rod,
|
delta_diagonal_rod,
|
||||||
delta_segments_per_second,
|
delta_segments_per_second,
|
||||||
delta_calibration_radius,
|
delta_calibration_radius,
|
||||||
delta_tower_angle_trim[2];
|
delta_tower_angle_trim[ABC];
|
||||||
|
|
||||||
float delta_tower[ABC][2],
|
float delta_tower[ABC][2],
|
||||||
delta_diagonal_rod_2_tower[ABC],
|
delta_diagonal_rod_2_tower[ABC],
|
||||||
|
@ -55,15 +55,15 @@ float delta_safe_distance_from_top();
|
||||||
* Recalculate factors used for delta kinematics whenever
|
* Recalculate factors used for delta kinematics whenever
|
||||||
* settings have been changed (e.g., by M665).
|
* 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,
|
const float trt[ABC] = DELTA_RADIUS_TRIM_TOWER,
|
||||||
drt[ABC] = DELTA_DIAGONAL_ROD_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][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 + delta_tower_angle_trim[A_AXIS])) * (radius + trt[A_AXIS]);
|
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 + delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]); // front right tower
|
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 + delta_tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]);
|
delta_tower[B_AXIS][Y_AXIS] = sin(RADIANS(330 + tower_angle_trim[B_AXIS])) * (radius + trt[B_AXIS]);
|
||||||
delta_tower[C_AXIS][X_AXIS] = 0.0; // back middle tower
|
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] = (radius + trt[C_AXIS]);
|
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[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[B_AXIS] = sq(diagonal_rod + drt[B_AXIS]);
|
||||||
delta_diagonal_rod_2_tower[C_AXIS] = sq(diagonal_rod + drt[C_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_diagonal_rod,
|
||||||
delta_segments_per_second,
|
delta_segments_per_second,
|
||||||
delta_calibration_radius,
|
delta_calibration_radius,
|
||||||
delta_tower_angle_trim[2];
|
delta_tower_angle_trim[ABC];
|
||||||
|
|
||||||
extern float delta_tower[ABC][2],
|
extern float delta_tower[ABC][2],
|
||||||
delta_diagonal_rod_2_tower[ABC],
|
delta_diagonal_rod_2_tower[ABC],
|
||||||
|
@ -42,7 +42,7 @@ extern float delta_tower[ABC][2],
|
||||||
* Recalculate factors used for delta kinematics whenever
|
* Recalculate factors used for delta kinematics whenever
|
||||||
* settings have been changed (e.g., by M665).
|
* 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
|
* Delta Inverse Kinematics
|
||||||
|
|
|
@ -1134,7 +1134,7 @@ void homeaxis(const AxisEnum axis) {
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("delta_endstop_adj:");
|
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("delta_endstop_adj:");
|
||||||
#endif
|
#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
|
#else
|
||||||
|
|
Loading…
Reference in a new issue