|
@@ -1721,6 +1721,21 @@ static void setup_for_endstop_move() {
|
1721
|
1721
|
|
1722
|
1722
|
#endif
|
1723
|
1723
|
|
|
1724
|
+#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || HAS_PROBING_PROCEDURE
|
|
1725
|
+ static void axis_unhomed_error(bool xyz=false) {
|
|
1726
|
+ if (xyz) {
|
|
1727
|
+ LCD_MESSAGEPGM(MSG_XYZ_UNHOMED);
|
|
1728
|
+ SERIAL_ECHO_START;
|
|
1729
|
+ SERIAL_ECHOLNPGM(MSG_XYZ_UNHOMED);
|
|
1730
|
+ }
|
|
1731
|
+ else {
|
|
1732
|
+ LCD_MESSAGEPGM(MSG_YX_UNHOMED);
|
|
1733
|
+ SERIAL_ECHO_START;
|
|
1734
|
+ SERIAL_ECHOLNPGM(MSG_YX_UNHOMED);
|
|
1735
|
+ }
|
|
1736
|
+ }
|
|
1737
|
+#endif
|
|
1738
|
+
|
1724
|
1739
|
#if ENABLED(Z_PROBE_SLED)
|
1725
|
1740
|
|
1726
|
1741
|
#ifndef SLED_DOCKING_OFFSET
|
|
@@ -2052,81 +2067,7 @@ static void setup_for_endstop_move() {
|
2052
|
2067
|
|
2053
|
2068
|
#endif // HAS_BED_PROBE
|
2054
|
2069
|
|
2055
|
|
-#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
2056
|
|
-
|
2057
|
|
- #if ENABLED(AUTO_BED_LEVELING_GRID)
|
2058
|
|
-
|
2059
|
|
- #if DISABLED(DELTA)
|
2060
|
|
-
|
2061
|
|
- static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
|
2062
|
|
-
|
2063
|
|
- //planner.bed_level_matrix.debug("bed level before");
|
2064
|
|
-
|
2065
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2066
|
|
- planner.bed_level_matrix.set_to_identity();
|
2067
|
|
- if (DEBUGGING(LEVELING)) {
|
2068
|
|
- vector_3 uncorrected_position = planner.adjusted_position();
|
2069
|
|
- DEBUG_POS(">>> set_bed_level_equation_lsq", uncorrected_position);
|
2070
|
|
- DEBUG_POS(">>> set_bed_level_equation_lsq", current_position);
|
2071
|
|
- }
|
2072
|
|
- #endif
|
2073
|
|
-
|
2074
|
|
- vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
2075
|
|
- planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
2076
|
|
-
|
2077
|
|
- vector_3 corrected_position = planner.adjusted_position();
|
2078
|
|
- current_position[X_AXIS] = corrected_position.x;
|
2079
|
|
- current_position[Y_AXIS] = corrected_position.y;
|
2080
|
|
- current_position[Z_AXIS] = corrected_position.z;
|
2081
|
|
-
|
2082
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2083
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
|
2084
|
|
- #endif
|
2085
|
|
-
|
2086
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
2087
|
|
- }
|
2088
|
|
-
|
2089
|
|
- #endif // !DELTA
|
2090
|
|
-
|
2091
|
|
- #else // !AUTO_BED_LEVELING_GRID
|
2092
|
|
-
|
2093
|
|
- static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
2094
|
|
-
|
2095
|
|
- planner.bed_level_matrix.set_to_identity();
|
2096
|
|
-
|
2097
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2098
|
|
- if (DEBUGGING(LEVELING)) {
|
2099
|
|
- vector_3 uncorrected_position = planner.adjusted_position();
|
2100
|
|
- DEBUG_POS("set_bed_level_equation_3pts", uncorrected_position);
|
2101
|
|
- }
|
2102
|
|
- #endif
|
2103
|
|
-
|
2104
|
|
- vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
2105
|
|
- vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
2106
|
|
- vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
|
2107
|
|
- vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal();
|
2108
|
|
-
|
2109
|
|
- if (planeNormal.z < 0) {
|
2110
|
|
- planeNormal.x = -planeNormal.x;
|
2111
|
|
- planeNormal.y = -planeNormal.y;
|
2112
|
|
- planeNormal.z = -planeNormal.z;
|
2113
|
|
- }
|
2114
|
|
-
|
2115
|
|
- planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
2116
|
|
- vector_3 corrected_position = planner.adjusted_position();
|
2117
|
|
-
|
2118
|
|
- current_position[X_AXIS] = corrected_position.x;
|
2119
|
|
- current_position[Y_AXIS] = corrected_position.y;
|
2120
|
|
- current_position[Z_AXIS] = corrected_position.z;
|
2121
|
|
-
|
2122
|
|
- #if ENABLED(DEBUG_LEVELING_FEATURE)
|
2123
|
|
- if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
|
2124
|
|
- #endif
|
2125
|
|
-
|
2126
|
|
- SYNC_PLAN_POSITION_KINEMATIC();
|
2127
|
|
- }
|
2128
|
|
-
|
2129
|
|
- #endif // !AUTO_BED_LEVELING_GRID
|
|
2070
|
+#if HAS_PROBING_PROCEDURE
|
2130
|
2071
|
|
2131
|
2072
|
inline void do_blocking_move_to_xy(float x, float y) {
|
2132
|
2073
|
do_blocking_move_to(x, y, current_position[Z_AXIS]);
|
|
@@ -2207,6 +2148,84 @@ static void setup_for_endstop_move() {
|
2207
|
2148
|
return measured_z;
|
2208
|
2149
|
}
|
2209
|
2150
|
|
|
2151
|
+#endif // AUTO_BED_LEVELING_FEATURE || Z_MIN_PROBE_REPEATABILITY_TEST
|
|
2152
|
+
|
|
2153
|
+#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
|
2154
|
+
|
|
2155
|
+ #if ENABLED(AUTO_BED_LEVELING_GRID)
|
|
2156
|
+
|
|
2157
|
+ #if DISABLED(DELTA)
|
|
2158
|
+
|
|
2159
|
+ static void set_bed_level_equation_lsq(double* plane_equation_coefficients) {
|
|
2160
|
+
|
|
2161
|
+ //planner.bed_level_matrix.debug("bed level before");
|
|
2162
|
+
|
|
2163
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2164
|
+ planner.bed_level_matrix.set_to_identity();
|
|
2165
|
+ if (DEBUGGING(LEVELING)) {
|
|
2166
|
+ vector_3 uncorrected_position = planner.adjusted_position();
|
|
2167
|
+ DEBUG_POS(">>> set_bed_level_equation_lsq", uncorrected_position);
|
|
2168
|
+ DEBUG_POS(">>> set_bed_level_equation_lsq", current_position);
|
|
2169
|
+ }
|
|
2170
|
+ #endif
|
|
2171
|
+
|
|
2172
|
+ vector_3 planeNormal = vector_3(-plane_equation_coefficients[0], -plane_equation_coefficients[1], 1);
|
|
2173
|
+ planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
2174
|
+
|
|
2175
|
+ vector_3 corrected_position = planner.adjusted_position();
|
|
2176
|
+ current_position[X_AXIS] = corrected_position.x;
|
|
2177
|
+ current_position[Y_AXIS] = corrected_position.y;
|
|
2178
|
+ current_position[Z_AXIS] = corrected_position.z;
|
|
2179
|
+
|
|
2180
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2181
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("<<< set_bed_level_equation_lsq", corrected_position);
|
|
2182
|
+ #endif
|
|
2183
|
+
|
|
2184
|
+ SYNC_PLAN_POSITION_KINEMATIC();
|
|
2185
|
+ }
|
|
2186
|
+
|
|
2187
|
+ #endif // !DELTA
|
|
2188
|
+
|
|
2189
|
+ #else // !AUTO_BED_LEVELING_GRID
|
|
2190
|
+
|
|
2191
|
+ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float z_at_pt_3) {
|
|
2192
|
+
|
|
2193
|
+ planner.bed_level_matrix.set_to_identity();
|
|
2194
|
+
|
|
2195
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2196
|
+ if (DEBUGGING(LEVELING)) {
|
|
2197
|
+ vector_3 uncorrected_position = planner.adjusted_position();
|
|
2198
|
+ DEBUG_POS("set_bed_level_equation_3pts", uncorrected_position);
|
|
2199
|
+ }
|
|
2200
|
+ #endif
|
|
2201
|
+
|
|
2202
|
+ vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
|
2203
|
+ vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
|
2204
|
+ vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
|
|
2205
|
+ vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal();
|
|
2206
|
+
|
|
2207
|
+ if (planeNormal.z < 0) {
|
|
2208
|
+ planeNormal.x = -planeNormal.x;
|
|
2209
|
+ planeNormal.y = -planeNormal.y;
|
|
2210
|
+ planeNormal.z = -planeNormal.z;
|
|
2211
|
+ }
|
|
2212
|
+
|
|
2213
|
+ planner.bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
|
2214
|
+ vector_3 corrected_position = planner.adjusted_position();
|
|
2215
|
+
|
|
2216
|
+ current_position[X_AXIS] = corrected_position.x;
|
|
2217
|
+ current_position[Y_AXIS] = corrected_position.y;
|
|
2218
|
+ current_position[Z_AXIS] = corrected_position.z;
|
|
2219
|
+
|
|
2220
|
+ #if ENABLED(DEBUG_LEVELING_FEATURE)
|
|
2221
|
+ if (DEBUGGING(LEVELING)) DEBUG_POS("set_bed_level_equation_3pts", corrected_position);
|
|
2222
|
+ #endif
|
|
2223
|
+
|
|
2224
|
+ SYNC_PLAN_POSITION_KINEMATIC();
|
|
2225
|
+ }
|
|
2226
|
+
|
|
2227
|
+ #endif // !AUTO_BED_LEVELING_GRID
|
|
2228
|
+
|
2210
|
2229
|
#if ENABLED(DELTA)
|
2211
|
2230
|
|
2212
|
2231
|
/**
|
|
@@ -2279,21 +2298,6 @@ static void setup_for_endstop_move() {
|
2279
|
2298
|
|
2280
|
2299
|
#endif // AUTO_BED_LEVELING_FEATURE
|
2281
|
2300
|
|
2282
|
|
-#if ENABLED(Z_PROBE_SLED) || ENABLED(Z_SAFE_HOMING) || ENABLED(AUTO_BED_LEVELING_FEATURE)
|
2283
|
|
- static void axis_unhomed_error(bool xyz=false) {
|
2284
|
|
- if (xyz) {
|
2285
|
|
- LCD_MESSAGEPGM(MSG_XYZ_UNHOMED);
|
2286
|
|
- SERIAL_ECHO_START;
|
2287
|
|
- SERIAL_ECHOLNPGM(MSG_XYZ_UNHOMED);
|
2288
|
|
- }
|
2289
|
|
- else {
|
2290
|
|
- LCD_MESSAGEPGM(MSG_YX_UNHOMED);
|
2291
|
|
- SERIAL_ECHO_START;
|
2292
|
|
- SERIAL_ECHOLNPGM(MSG_YX_UNHOMED);
|
2293
|
|
- }
|
2294
|
|
- }
|
2295
|
|
-#endif
|
2296
|
|
-
|
2297
|
2301
|
/**
|
2298
|
2302
|
* Home an individual axis
|
2299
|
2303
|
*/
|
|
@@ -3103,6 +3107,16 @@ inline void gcode_G28() {
|
3103
|
3107
|
report_current_position();
|
3104
|
3108
|
}
|
3105
|
3109
|
|
|
3110
|
+#if HAS_PROBING_PROCEDURE
|
|
3111
|
+
|
|
3112
|
+ void out_of_range_error(const char* p_edge) {
|
|
3113
|
+ SERIAL_PROTOCOLPGM("?Probe ");
|
|
3114
|
+ serialprintPGM(p_edge);
|
|
3115
|
+ SERIAL_PROTOCOLLNPGM(" position out of range.");
|
|
3116
|
+ }
|
|
3117
|
+
|
|
3118
|
+#endif
|
|
3119
|
+
|
3106
|
3120
|
#if ENABLED(MESH_BED_LEVELING)
|
3107
|
3121
|
|
3108
|
3122
|
enum MeshLevelingState { MeshReport, MeshStart, MeshNext, MeshSet, MeshSetZOffset, MeshReset };
|
|
@@ -3300,12 +3314,6 @@ inline void gcode_G28() {
|
3300
|
3314
|
|
3301
|
3315
|
#elif ENABLED(AUTO_BED_LEVELING_FEATURE)
|
3302
|
3316
|
|
3303
|
|
- void out_of_range_error(const char* p_edge) {
|
3304
|
|
- SERIAL_PROTOCOLPGM("?Probe ");
|
3305
|
|
- serialprintPGM(p_edge);
|
3306
|
|
- SERIAL_PROTOCOLLNPGM(" position out of range.");
|
3307
|
|
- }
|
3308
|
|
-
|
3309
|
3317
|
/**
|
3310
|
3318
|
* G29: Detailed Z probe, probes the bed at 3 or more points.
|
3311
|
3319
|
* Will fail if the printer has not been homed with G28.
|