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