|
@@ -1960,89 +1960,6 @@ static void setup_for_endstop_move() {
|
1960
|
1960
|
endstops.enable_z_probe(false);
|
1961
|
1961
|
}
|
1962
|
1962
|
|
1963
|
|
-#endif // HAS_BED_PROBE
|
1964
|
|
-
|
1965
|
|
-#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
1966
|
|
-
|
1967
|
|
- #if ENABLED(AUTO_BED_LEVELING_GRID)
|
1968
|
|
-
|
1969
|
|
- #if DISABLED(DELTA)
|
1970
|
|
-
|
1971
|
|
- static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
|
1972
|
|
-
|
1973
|
|
- //planner.bed_level_matrix.debug("bed level before");
|
1974
|
|
-
|
1975
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
1976
|
|
- planner.bed_level_matrix.set_to_identity();
|
1977
|
|
- if (DEBUGGING(LEVELING)) {
|
1978
|
|
- vector_3 uncorrected_position = planner.adjusted_position();
|
1979
|
|
- DEBUG_POS(">>> set_bed_level_equation_lsq", uncorrected_position);
|
1980
|
|
- DEBUG_POS(">>> set_bed_level_equation_lsq", current_position);
|
1981
|
|
- }
|
1982
|
|
- #endif
|
1983
|
|
-
|
1984
|
|
- vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
1985
|
|
- planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
1986
|
|
-
|
1987
|
|
- vector_3 corrected_position = planner.adjusted_position();
|
1988
|
|
- current_position[X_AXIS] = corrected_position.x;
|
1989
|
|
- current_position[Y_AXIS] = corrected_position.y;
|
1990
|
|
- current_position[Z_AXIS] = corrected_position.z;
|
1991
|
|
-
|
1992
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
1993
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
|
1994
|
|
- #endif
|
1995
|
|
-
|
1996
|
|
- sync_plan_position();
|
1997
|
|
- }
|
1998
|
|
-
|
1999
|
|
- #endif // !DELTA
|
2000
|
|
-
|
2001
|
|
- #else // !AUTO_BED_LEVELING_GRID
|
2002
|
|
-
|
2003
|
|
- static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
2004
|
|
-
|
2005
|
|
- planner.bed_level_matrix.set_to_identity();
|
2006
|
|
-
|
2007
|
|
- vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
2008
|
|
- vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
2009
|
|
- vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
|
2010
|
|
- vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal();
|
2011
|
|
-
|
2012
|
|
- if (planeNormal.z < 0) {
|
2013
|
|
- planeNormal.x = -planeNormal.x;
|
2014
|
|
- planeNormal.y = -planeNormal.y;
|
2015
|
|
- planeNormal.z = -planeNormal.z;
|
2016
|
|
- }
|
2017
|
|
-
|
2018
|
|
- planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
2019
|
|
-
|
2020
|
|
- vector_3 corrected_position = planner.adjusted_position();
|
2021
|
|
-
|
2022
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2023
|
|
- if (DEBUGGING(LEVELING)) {
|
2024
|
|
- vector_3 uncorrected_position = corrected_position;
|
2025
|
|
- DEBUG_POS("set_bed_level_equation_3pts", uncorrected_position);
|
2026
|
|
- }
|
2027
|
|
- #endif
|
2028
|
|
-
|
2029
|
|
- current_position[X_AXIS] = corrected_position.x;
|
2030
|
|
- current_position[Y_AXIS] = corrected_position.y;
|
2031
|
|
- current_position[Z_AXIS] = corrected_position.z;
|
2032
|
|
-
|
2033
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2034
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
|
2035
|
|
- #endif
|
2036
|
|
-
|
2037
|
|
- sync_plan_position();
|
2038
|
|
- }
|
2039
|
|
-
|
2040
|
|
- #endif // !AUTO_BED_LEVELING_GRID
|
2041
|
|
-
|
2042
|
|
-#endif // AUTO_BED_LEVELING_FEATURE
|
2043
|
|
-
|
2044
|
|
-#if HAS_BED_PROBE
|
2045
|
|
-
|
2046
|
1963
|
static void run_z_probe() {
|
2047
|
1964
|
|
2048
|
1965
|
float old_feedrate = feedrate;
|
|
@@ -2134,6 +2051,81 @@ static void setup_for_endstop_move() {
|
2134
|
2051
|
|
2135
|
2052
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
2136
|
2053
|
|
|
2054
|
+ #if ENABLED(AUTO_BED_LEVELING_GRID)
|
|
2055
|
+
|
|
2056
|
+ #if DISABLED(DELTA)
|
|
2057
|
+
|
|
2058
|
+ static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
|
|
2059
|
+
|
|
2060
|
+ //planner.bed_level_matrix.debug("bed level before");
|
|
2061
|
+
|
|
2062
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2063
|
+ planner.bed_level_matrix.set_to_identity();
|
|
2064
|
+ if (DEBUGGING(LEVELING)) {
|
|
2065
|
+ vector_3 uncorrected_position = planner.adjusted_position();
|
|
2066
|
+ DEBUG_POS(">>> set_bed_level_equation_lsq", uncorrected_position);
|
|
2067
|
+ DEBUG_POS(">>> set_bed_level_equation_lsq", current_position);
|
|
2068
|
+ }
|
|
2069
|
+ #endif
|
|
2070
|
+
|
|
2071
|
+ vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
|
2072
|
+ planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
2073
|
+
|
|
2074
|
+ vector_3 corrected_position = planner.adjusted_position();
|
|
2075
|
+ current_position[X_AXIS] = corrected_position.x;
|
|
2076
|
+ current_position[Y_AXIS] = corrected_position.y;
|
|
2077
|
+ current_position[Z_AXIS] = corrected_position.z;
|
|
2078
|
+
|
|
2079
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2080
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
|
|
2081
|
+ #endif
|
|
2082
|
+
|
|
2083
|
+ sync_plan_position();
|
|
2084
|
+ }
|
|
2085
|
+
|
|
2086
|
+ #endif // !DELTA
|
|
2087
|
+
|
|
2088
|
+ #else // !AUTO_BED_LEVELING_GRID
|
|
2089
|
+
|
|
2090
|
+ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
|
2091
|
+
|
|
2092
|
+ planner.bed_level_matrix.set_to_identity();
|
|
2093
|
+
|
|
2094
|
+ vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
|
2095
|
+ vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
|
2096
|
+ vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
|
|
2097
|
+ vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal();
|
|
2098
|
+
|
|
2099
|
+ if (planeNormal.z < 0) {
|
|
2100
|
+ planeNormal.x = -planeNormal.x;
|
|
2101
|
+ planeNormal.y = -planeNormal.y;
|
|
2102
|
+ planeNormal.z = -planeNormal.z;
|
|
2103
|
+ }
|
|
2104
|
+
|
|
2105
|
+ planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
2106
|
+
|
|
2107
|
+ vector_3 corrected_position = planner.adjusted_position();
|
|
2108
|
+
|
|
2109
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2110
|
+ if (DEBUGGING(LEVELING)) {
|
|
2111
|
+ vector_3 uncorrected_position = corrected_position;
|
|
2112
|
+ DEBUG_POS("set_bed_level_equation_3pts", uncorrected_position);
|
|
2113
|
+ }
|
|
2114
|
+ #endif
|
|
2115
|
+
|
|
2116
|
+ current_position[X_AXIS] = corrected_position.x;
|
|
2117
|
+ current_position[Y_AXIS] = corrected_position.y;
|
|
2118
|
+ current_position[Z_AXIS] = corrected_position.z;
|
|
2119
|
+
|
|
2120
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2121
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
|
|
2122
|
+ #endif
|
|
2123
|
+
|
|
2124
|
+ sync_plan_position();
|
|
2125
|
+ }
|
|
2126
|
+
|
|
2127
|
+ #endif // !AUTO_BED_LEVELING_GRID
|
|
2128
|
+
|
2137
|
2129
|
inline void do_blocking_move_to_xy(float x, float y) {
|
2138
|
2130
|
do_blocking_move_to(x, y, current_position[Z_AXIS]);
|
2139
|
2131
|
}
|