Shrink 3-point leveling code
This commit is contained in:
parent
4f75ce6957
commit
0e38bea79d
|
@ -3518,23 +3518,21 @@ inline void gcode_G28() {
|
|||
#endif
|
||||
|
||||
// Probe at 3 arbitrary points
|
||||
float z_at_pt_1 = probe_pt( LOGICAL_X_POSITION(ABL_PROBE_PT_1_X),
|
||||
LOGICAL_Y_POSITION(ABL_PROBE_PT_1_Y),
|
||||
stow_probe_after_each, verbose_level),
|
||||
z_at_pt_2 = probe_pt( LOGICAL_X_POSITION(ABL_PROBE_PT_2_X),
|
||||
LOGICAL_Y_POSITION(ABL_PROBE_PT_2_Y),
|
||||
stow_probe_after_each, verbose_level),
|
||||
z_at_pt_3 = probe_pt( LOGICAL_X_POSITION(ABL_PROBE_PT_3_X),
|
||||
LOGICAL_Y_POSITION(ABL_PROBE_PT_3_Y),
|
||||
stow_probe_after_each, verbose_level);
|
||||
vector_3 points[3] = {
|
||||
vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, 0),
|
||||
vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, 0),
|
||||
vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, 0)
|
||||
};
|
||||
|
||||
for (uint8_t i = 0; i < 3; ++i)
|
||||
points[i].z = probe_pt(
|
||||
LOGICAL_X_POSITION(points[i].x),
|
||||
LOGICAL_Y_POSITION(points[i].y),
|
||||
stow_probe_after_each, verbose_level
|
||||
);
|
||||
|
||||
if (!dryrun) {
|
||||
vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1),
|
||||
pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2),
|
||||
pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
|
||||
|
||||
vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal();
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue