Simpler Allen Key config. Fixes, cleanups from refactor (#15256)
This commit is contained in:
@ -769,11 +769,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
|
||||
if (!dryrun && !isnan(measured_z)) {
|
||||
vector_3 planeNormal = vector_3::cross(points[0] - points[1], points[2] - points[1]).get_normal();
|
||||
if (planeNormal.z < 0) {
|
||||
planeNormal.x *= -1;
|
||||
planeNormal.y *= -1;
|
||||
planeNormal.z *= -1;
|
||||
}
|
||||
if (planeNormal.z < 0) planeNormal *= -1;
|
||||
planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
||||
|
||||
// Can't re-enable (on error) until the new grid is written
|
||||
|
@ -369,10 +369,11 @@ static float auto_tune_a() {
|
||||
delta_r = {0.0},
|
||||
delta_t[ABC] = {0.0};
|
||||
|
||||
ZERO(delta_t);
|
||||
LOOP_XYZ(axis) {
|
||||
LOOP_XYZ(axis_2) delta_t[axis_2] = 0.0;
|
||||
delta_t[axis] = diff;
|
||||
calc_kinematics_diff_probe_points(z_pt, delta_e, delta_r, delta_t);
|
||||
delta_t[axis] = 0;
|
||||
a_fac += z_pt[uint8_t((axis * _4P_STEP) - _7P_STEP + NPP) % NPP + 1] / 6.0;
|
||||
a_fac -= z_pt[uint8_t((axis * _4P_STEP) + 1 + _7P_STEP)] / 6.0;
|
||||
}
|
||||
|
@ -314,18 +314,16 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
||||
|
||||
// The difference between the known and the measured location
|
||||
// of the calibration object is the positional error
|
||||
m.pos_error[X_AXIS] =
|
||||
#if HAS_X_CENTER
|
||||
m.true_center[X_AXIS] - m.obj_center[X_AXIS];
|
||||
#else
|
||||
0;
|
||||
#endif
|
||||
m.pos_error[Y_AXIS] =
|
||||
#if HAS_Y_CENTER
|
||||
m.true_center[Y_AXIS] - m.obj_center[Y_AXIS];
|
||||
#else
|
||||
0;
|
||||
#endif
|
||||
m.pos_error[X_AXIS] = (0
|
||||
#if HAS_X_CENTER
|
||||
+ m.true_center[X_AXIS] - m.obj_center[X_AXIS]
|
||||
#endif
|
||||
);
|
||||
m.pos_error[Y_AXIS] = (0
|
||||
#if HAS_Y_CENTER
|
||||
+ m.true_center[Y_AXIS] - m.obj_center[Y_AXIS]
|
||||
#endif
|
||||
);
|
||||
m.pos_error[Z_AXIS] = m.true_center[Z_AXIS] - m.obj_center[Z_AXIS];
|
||||
}
|
||||
|
||||
@ -394,13 +392,13 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
||||
|
||||
inline void report_measured_nozzle_dimensions(const measurements_t &m) {
|
||||
SERIAL_ECHOLNPGM("Nozzle Tip Outer Dimensions:");
|
||||
#if HAS_X_CENTER
|
||||
SERIAL_ECHOLNPAIR(" X", m.nozzle_outer_dimension[X_AXIS]);
|
||||
#else
|
||||
UNUSED(m);
|
||||
#endif
|
||||
#if HAS_Y_CENTER
|
||||
SERIAL_ECHOLNPAIR(" Y", m.nozzle_outer_dimension[Y_AXIS]);
|
||||
#if HAS_X_CENTER || HAS_Y_CENTER
|
||||
#if HAS_X_CENTER
|
||||
SERIAL_ECHOLNPAIR(" X", m.nozzle_outer_dimension[X_AXIS]);
|
||||
#endif
|
||||
#if HAS_Y_CENTER
|
||||
SERIAL_ECHOLNPAIR(" Y", m.nozzle_outer_dimension[Y_AXIS]);
|
||||
#endif
|
||||
#else
|
||||
UNUSED(m);
|
||||
#endif
|
||||
@ -412,16 +410,11 @@ inline void probe_sides(measurements_t &m, const float uncertainty) {
|
||||
// This function requires normalize_hotend_offsets() to be called
|
||||
//
|
||||
inline void report_hotend_offsets() {
|
||||
for (uint8_t e = 1; e < HOTENDS; e++) {
|
||||
SERIAL_ECHOPAIR("T", int(e));
|
||||
SERIAL_ECHOLNPGM(" Hotend Offset:");
|
||||
SERIAL_ECHOLNPAIR(" X: ", hotend_offset[X_AXIS][e]);
|
||||
SERIAL_ECHOLNPAIR(" Y: ", hotend_offset[Y_AXIS][e]);
|
||||
SERIAL_ECHOLNPAIR(" Z: ", hotend_offset[Z_AXIS][e]);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
for (uint8_t e = 1; e < HOTENDS; e++)
|
||||
SERIAL_ECHOLNPAIR("T", int(e), " Hotend Offset X", hotend_offset[X_AXIS][e], " Y", hotend_offset[Y_AXIS][e], " Z", hotend_offset[Z_AXIS][e]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CALIBRATION_REPORTING
|
||||
|
||||
/**
|
||||
|
@ -46,10 +46,10 @@
|
||||
void GcodeSuite::M425() {
|
||||
bool noArgs = true;
|
||||
|
||||
LOOP_XYZ(i) {
|
||||
if (parser.seen(axis_codes[i])) {
|
||||
LOOP_XYZ(a) {
|
||||
if (parser.seen(axis_codes[a])) {
|
||||
planner.synchronize();
|
||||
backlash.distance_mm[i] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(i);
|
||||
backlash.distance_mm[a] = parser.has_value() ? parser.value_linear_units() : backlash.get_measurement(AxisEnum(a));
|
||||
noArgs = false;
|
||||
}
|
||||
}
|
||||
@ -88,10 +88,10 @@ void GcodeSuite::M425() {
|
||||
#if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)
|
||||
SERIAL_ECHOPGM(" Average measured backlash (mm):");
|
||||
if (backlash.has_any_measurement()) {
|
||||
LOOP_XYZ(a) if (backlash.has_measurement(a)) {
|
||||
LOOP_XYZ(a) if (backlash.has_measurement(AxisEnum(a))) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_ECHO(backlash.get_measurement(a));
|
||||
SERIAL_ECHO(backlash.get_measurement(AxisEnum(a)));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -137,8 +137,8 @@
|
||||
DEBUG_EOL();
|
||||
|
||||
HOTEND_LOOP() {
|
||||
DEBUG_ECHOPAIR(" nozzle:", int(e));
|
||||
LOOP_XYZ(j) DEBUG_ECHOPAIR(" hotend_offset[", axis_codes[j], "_AXIS][", int(e), "]=", hotend_offset[j][e]);
|
||||
DEBUG_ECHOPAIR(" T", int(e));
|
||||
LOOP_XYZ(a) DEBUG_ECHOPAIR(" hotend_offset[", axis_codes[a], "_AXIS][", int(e), "]=", hotend_offset[a][e]);
|
||||
DEBUG_EOL();
|
||||
}
|
||||
DEBUG_EOL();
|
||||
|
@ -30,15 +30,12 @@
|
||||
#include "../../../feature/mixing.h"
|
||||
|
||||
inline void echo_mix() {
|
||||
SERIAL_ECHOPAIR(" (", int(mixer.mix[0]));
|
||||
SERIAL_ECHOPAIR("%|", int(mixer.mix[1]));
|
||||
SERIAL_ECHOPGM("%)");
|
||||
SERIAL_ECHOPAIR(" (", int(mixer.mix[0]), "%|", int(mixer.mix[1]), "%)");
|
||||
}
|
||||
|
||||
inline void echo_zt(const int t, const float &z) {
|
||||
mixer.update_mix_from_vtool(t);
|
||||
SERIAL_ECHOPAIR(" Z", z);
|
||||
SERIAL_ECHOPAIR(" T", t);
|
||||
SERIAL_ECHOPAIR(" Z", z, " T", t);
|
||||
echo_mix();
|
||||
}
|
||||
|
||||
|
@ -38,11 +38,11 @@
|
||||
|
||||
void report_xyze(const float pos[], const uint8_t n = 4, const uint8_t precision = 3) {
|
||||
char str[12];
|
||||
for (uint8_t i = 0; i < n; i++) {
|
||||
for (uint8_t a = 0; a < n; a++) {
|
||||
SERIAL_CHAR(' ');
|
||||
SERIAL_CHAR(axis_codes[i]);
|
||||
SERIAL_CHAR(axis_codes[a]);
|
||||
SERIAL_CHAR(':');
|
||||
SERIAL_ECHO(dtostrf(pos[i], 1, precision, str));
|
||||
SERIAL_ECHO(dtostrf(pos[a], 1, precision, str));
|
||||
}
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
@ -280,20 +280,22 @@ void GcodeSuite::G2_G3(const bool clockwise) {
|
||||
|
||||
float arc_offset[2] = { 0, 0 };
|
||||
if (parser.seenval('R')) {
|
||||
const float r = parser.value_linear_units(),
|
||||
p1 = current_position[X_AXIS], q1 = current_position[Y_AXIS],
|
||||
p2 = destination[X_AXIS], q2 = destination[Y_AXIS];
|
||||
if (r && (p2 != p1 || q2 != q1)) {
|
||||
const float e = clockwise ^ (r < 0) ? -1 : 1, // clockwise -1/1, counterclockwise 1/-1
|
||||
dx = p2 - p1, dy = q2 - q1, // X and Y differences
|
||||
d = HYPOT(dx, dy), // Linear distance between the points
|
||||
dinv = 1/d, // Inverse of d
|
||||
h = SQRT(sq(r) - sq(d * 0.5f)), // Distance to the arc pivot-point
|
||||
mx = (p1 + p2) * 0.5f, my = (q1 + q2) * 0.5f,// Point between the two points
|
||||
sx = -dy * dinv, sy = dx * dinv, // Slope of the perpendicular bisector
|
||||
cx = mx + e * h * sx, cy = my + e * h * sy; // Pivot-point of the arc
|
||||
arc_offset[0] = cx - p1;
|
||||
arc_offset[1] = cy - q1;
|
||||
const float r = parser.value_linear_units();
|
||||
if (r) {
|
||||
const float p1 = current_position[X_AXIS], q1 = current_position[Y_AXIS],
|
||||
p2 = destination[X_AXIS], q2 = destination[Y_AXIS];
|
||||
if (p2 != p1 || q2 != q1) {
|
||||
const float e = clockwise ^ (r < 0) ? -1 : 1, // clockwise -1/1, counterclockwise 1/-1
|
||||
dx = p2 - p1, dy = q2 - q1, // X and Y differences
|
||||
d = HYPOT(dx, dy), // Linear distance between the points
|
||||
dinv = 1/d, // Inverse of d
|
||||
h = SQRT(sq(r) - sq(d * 0.5f)), // Distance to the arc pivot-point
|
||||
mx = (p1 + p2) * 0.5f, my = (q1 + q2) * 0.5f,// Point between the two points
|
||||
sx = -dy * dinv, sy = dx * dinv, // Slope of the perpendicular bisector
|
||||
cx = mx + e * h * sx, cy = my + e * h * sy; // Pivot-point of the arc
|
||||
arc_offset[0] = cx - p1;
|
||||
arc_offset[1] = cy - q1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -54,11 +54,8 @@ void GcodeSuite::G30() {
|
||||
const ProbePtRaise raise_after = parser.boolval('E', true) ? PROBE_PT_STOW : PROBE_PT_NONE;
|
||||
const float measured_z = probe_pt(xpos, ypos, raise_after, 1);
|
||||
|
||||
if (!isnan(measured_z)) {
|
||||
SERIAL_ECHOPAIR("Bed X: ", FIXFLOAT(xpos));
|
||||
SERIAL_ECHOPAIR(" Y: ", FIXFLOAT(ypos));
|
||||
SERIAL_ECHOLNPAIR(" Z: ", FIXFLOAT(measured_z));
|
||||
}
|
||||
if (!isnan(measured_z))
|
||||
SERIAL_ECHOLNPAIR("Bed X: ", FIXFLOAT(xpos), " Y: ", FIXFLOAT(ypos), " Z: ", FIXFLOAT(measured_z));
|
||||
|
||||
clean_up_after_endstop_or_probe_move();
|
||||
|
||||
|
Reference in New Issue
Block a user