|
@@ -203,7 +203,8 @@
|
203
|
203
|
|
204
|
204
|
float homing_feedrate[] = HOMING_FEEDRATE;
|
205
|
205
|
#ifdef ENABLE_AUTO_BED_LEVELING
|
206
|
|
-int xy_travel_speed = XY_TRAVEL_SPEED;
|
|
206
|
+ int xy_travel_speed = XY_TRAVEL_SPEED;
|
|
207
|
+ float zprobe_zoffset = -Z_PROBE_OFFSET_FROM_EXTRUDER;
|
207
|
208
|
#endif
|
208
|
209
|
int homing_bump_divisor[] = HOMING_BUMP_DIVISOR;
|
209
|
210
|
bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
|
|
@@ -255,7 +256,6 @@ float home_offset[3] = { 0, 0, 0 };
|
255
|
256
|
float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
|
256
|
257
|
float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
257
|
258
|
bool axis_known_position[3] = { false, false, false };
|
258
|
|
-float zprobe_zoffset;
|
259
|
259
|
|
260
|
260
|
// Extruder offset
|
261
|
261
|
#if EXTRUDERS > 1
|
|
@@ -1097,9 +1097,6 @@ static void set_bed_level_equation_lsq(double *plane_equation_coefficients)
|
1097
|
1097
|
current_position[Y_AXIS] = corrected_position.y;
|
1098
|
1098
|
current_position[Z_AXIS] = corrected_position.z;
|
1099
|
1099
|
|
1100
|
|
- // put the bed at 0 so we don't go below it.
|
1101
|
|
- current_position[Z_AXIS] = zprobe_zoffset; // in the lsq we reach here after raising the extruder due to the loop structure
|
1102
|
|
-
|
1103
|
1100
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1104
|
1101
|
}
|
1105
|
1102
|
#endif
|
|
@@ -1113,11 +1110,13 @@ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float
|
1113
|
1110
|
vector_3 pt1 = vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, z_at_pt_1);
|
1114
|
1111
|
vector_3 pt2 = vector_3(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, z_at_pt_2);
|
1115
|
1112
|
vector_3 pt3 = vector_3(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, z_at_pt_3);
|
|
1113
|
+ vector_3 planeNormal = vector_3::cross(pt1 - pt2, pt3 - pt2).get_normal();
|
1116
|
1114
|
|
1117
|
|
- vector_3 from_2_to_1 = (pt1 - pt2).get_normal();
|
1118
|
|
- vector_3 from_2_to_3 = (pt3 - pt2).get_normal();
|
1119
|
|
- vector_3 planeNormal = vector_3::cross(from_2_to_1, from_2_to_3).get_normal();
|
1120
|
|
- planeNormal = vector_3(planeNormal.x, planeNormal.y, abs(planeNormal.z));
|
|
1115
|
+ if (planeNormal.z < 0) {
|
|
1116
|
+ planeNormal.x = -planeNormal.x;
|
|
1117
|
+ planeNormal.y = -planeNormal.y;
|
|
1118
|
+ planeNormal.z = -planeNormal.z;
|
|
1119
|
+ }
|
1121
|
1120
|
|
1122
|
1121
|
plan_bed_level_matrix = matrix_3x3::create_look_at(planeNormal);
|
1123
|
1122
|
|
|
@@ -1126,11 +1125,7 @@ static void set_bed_level_equation_3pts(float z_at_pt_1, float z_at_pt_2, float
|
1126
|
1125
|
current_position[Y_AXIS] = corrected_position.y;
|
1127
|
1126
|
current_position[Z_AXIS] = corrected_position.z;
|
1128
|
1127
|
|
1129
|
|
- // put the bed at 0 so we don't go below it.
|
1130
|
|
- current_position[Z_AXIS] = zprobe_zoffset;
|
1131
|
|
-
|
1132
|
1128
|
plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
1133
|
|
-
|
1134
|
1129
|
}
|
1135
|
1130
|
|
1136
|
1131
|
#endif // AUTO_BED_LEVELING_GRID
|
|
@@ -2017,8 +2012,19 @@ inline void gcode_G28() {
|
2017
|
2012
|
endstops_hit_on_purpose();
|
2018
|
2013
|
}
|
2019
|
2014
|
|
2020
|
|
-#if defined(MESH_BED_LEVELING)
|
|
2015
|
+#ifdef MESH_BED_LEVELING
|
2021
|
2016
|
|
|
2017
|
+ /**
|
|
2018
|
+ * G29: Mesh-based Z-Probe, probes a grid and produces a
|
|
2019
|
+ * mesh to compensate for variable bed height
|
|
2020
|
+ *
|
|
2021
|
+ * Parameters With MESH_BED_LEVELING:
|
|
2022
|
+ *
|
|
2023
|
+ * S0 Produce a mesh report
|
|
2024
|
+ * S1 Start probing mesh points
|
|
2025
|
+ * S2 Probe the next mesh point
|
|
2026
|
+ *
|
|
2027
|
+ */
|
2022
|
2028
|
inline void gcode_G29() {
|
2023
|
2029
|
static int probe_point = -1;
|
2024
|
2030
|
int state = 0;
|
|
@@ -2060,7 +2066,7 @@ inline void gcode_G28() {
|
2060
|
2066
|
} else if (state == 2) { // Goto next point
|
2061
|
2067
|
|
2062
|
2068
|
if (probe_point < 0) {
|
2063
|
|
- SERIAL_PROTOCOLPGM("Mesh probing not started.\n");
|
|
2069
|
+ SERIAL_PROTOCOLPGM("Start mesh probing with \"G29 S1\" first.\n");
|
2064
|
2070
|
return;
|
2065
|
2071
|
}
|
2066
|
2072
|
int ix, iy;
|
|
@@ -2070,16 +2076,14 @@ inline void gcode_G28() {
|
2070
|
2076
|
} else {
|
2071
|
2077
|
ix = (probe_point-1) % MESH_NUM_X_POINTS;
|
2072
|
2078
|
iy = (probe_point-1) / MESH_NUM_X_POINTS;
|
2073
|
|
- if (iy&1) { // Zig zag
|
2074
|
|
- ix = (MESH_NUM_X_POINTS - 1) - ix;
|
2075
|
|
- }
|
|
2079
|
+ if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag
|
2076
|
2080
|
mbl.set_z(ix, iy, current_position[Z_AXIS]);
|
2077
|
2081
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
2078
|
2082
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS]/60, active_extruder);
|
2079
|
2083
|
st_synchronize();
|
2080
|
2084
|
}
|
2081
|
|
- if (probe_point == MESH_NUM_X_POINTS*MESH_NUM_Y_POINTS) {
|
2082
|
|
- SERIAL_PROTOCOLPGM("Mesh done.\n");
|
|
2085
|
+ if (probe_point == MESH_NUM_X_POINTS * MESH_NUM_Y_POINTS) {
|
|
2086
|
+ SERIAL_PROTOCOLPGM("Mesh probing done.\n");
|
2083
|
2087
|
probe_point = -1;
|
2084
|
2088
|
mbl.active = 1;
|
2085
|
2089
|
enquecommands_P(PSTR("G28"));
|
|
@@ -2087,9 +2091,7 @@ inline void gcode_G28() {
|
2087
|
2091
|
}
|
2088
|
2092
|
ix = probe_point % MESH_NUM_X_POINTS;
|
2089
|
2093
|
iy = probe_point / MESH_NUM_X_POINTS;
|
2090
|
|
- if (iy&1) { // Zig zag
|
2091
|
|
- ix = (MESH_NUM_X_POINTS - 1) - ix;
|
2092
|
|
- }
|
|
2094
|
+ if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // zig-zag
|
2093
|
2095
|
current_position[X_AXIS] = mbl.get_x(ix);
|
2094
|
2096
|
current_position[Y_AXIS] = mbl.get_y(iy);
|
2095
|
2097
|
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[X_AXIS]/60, active_extruder);
|
|
@@ -2098,9 +2100,7 @@ inline void gcode_G28() {
|
2098
|
2100
|
}
|
2099
|
2101
|
}
|
2100
|
2102
|
|
2101
|
|
-#endif
|
2102
|
|
-
|
2103
|
|
-#ifdef ENABLE_AUTO_BED_LEVELING
|
|
2103
|
+#elif defined(ENABLE_AUTO_BED_LEVELING)
|
2104
|
2104
|
|
2105
|
2105
|
/**
|
2106
|
2106
|
* G29: Detailed Z-Probe, probes the bed at 3 or more points.
|
|
@@ -2116,8 +2116,9 @@ inline void gcode_G28() {
|
2116
|
2116
|
*
|
2117
|
2117
|
* S Set the XY travel speed between probe points (in mm/min)
|
2118
|
2118
|
*
|
2119
|
|
- * D Dry-Run mode. Just evaluate the bed Topology - It does not apply or clean the rotation Matrix
|
2120
|
|
- * Useful to check the topology after a first run of G29.
|
|
2119
|
+ * D Dry-Run mode. Just evaluate the bed Topology - Don't apply
|
|
2120
|
+ * or clean the rotation Matrix. Useful to check the topology
|
|
2121
|
+ * after a first run of G29.
|
2121
|
2122
|
*
|
2122
|
2123
|
* V Set the verbose level (0-4). Example: "G29 V3"
|
2123
|
2124
|
*
|
|
@@ -2165,9 +2166,9 @@ inline void gcode_G28() {
|
2165
|
2166
|
|
2166
|
2167
|
#ifdef AUTO_BED_LEVELING_GRID
|
2167
|
2168
|
|
2168
|
|
- #ifndef DELTA
|
2169
|
|
- bool do_topography_map = verbose_level > 2 || code_seen('T') || code_seen('t');
|
2170
|
|
- #endif
|
|
2169
|
+ #ifndef DELTA
|
|
2170
|
+ bool do_topography_map = verbose_level > 2 || code_seen('T') || code_seen('t');
|
|
2171
|
+ #endif
|
2171
|
2172
|
|
2172
|
2173
|
if (verbose_level > 0)
|
2173
|
2174
|
{
|
|
@@ -2224,7 +2225,7 @@ inline void gcode_G28() {
|
2224
|
2225
|
|
2225
|
2226
|
#ifdef Z_PROBE_SLED
|
2226
|
2227
|
dock_sled(false); // engage (un-dock) the probe
|
2227
|
|
- #elif defined(Z_PROBE_ALLEN_KEY)
|
|
2228
|
+ #elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING)
|
2228
|
2229
|
engage_z_probe();
|
2229
|
2230
|
#endif
|
2230
|
2231
|
|
|
@@ -2234,19 +2235,18 @@ inline void gcode_G28() {
|
2234
|
2235
|
{
|
2235
|
2236
|
#ifdef DELTA
|
2236
|
2237
|
reset_bed_level();
|
2237
|
|
- #else
|
2238
|
|
-
|
2239
|
|
- // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
|
2240
|
|
- //vector_3 corrected_position = plan_get_position_mm();
|
2241
|
|
- //corrected_position.debug("position before G29");
|
2242
|
|
- plan_bed_level_matrix.set_to_identity();
|
2243
|
|
- vector_3 uncorrected_position = plan_get_position();
|
2244
|
|
-// uncorrected_position.debug("position during G29");
|
2245
|
|
-
|
2246
|
|
- current_position[X_AXIS] = uncorrected_position.x;
|
2247
|
|
- current_position[Y_AXIS] = uncorrected_position.y;
|
2248
|
|
- current_position[Z_AXIS] = uncorrected_position.z;
|
2249
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
2238
|
+ #else //!DELTA
|
|
2239
|
+
|
|
2240
|
+ // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
|
|
2241
|
+ //vector_3 corrected_position = plan_get_position_mm();
|
|
2242
|
+ //corrected_position.debug("position before G29");
|
|
2243
|
+ plan_bed_level_matrix.set_to_identity();
|
|
2244
|
+ vector_3 uncorrected_position = plan_get_position();
|
|
2245
|
+ //uncorrected_position.debug("position during G29");
|
|
2246
|
+ current_position[X_AXIS] = uncorrected_position.x;
|
|
2247
|
+ current_position[Y_AXIS] = uncorrected_position.y;
|
|
2248
|
+ current_position[Z_AXIS] = uncorrected_position.z;
|
|
2249
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
2250
|
2250
|
|
2251
|
2251
|
#endif
|
2252
|
2252
|
}
|
|
@@ -2261,26 +2261,24 @@ inline void gcode_G28() {
|
2261
|
2261
|
const int xGridSpacing = (right_probe_bed_position - left_probe_bed_position) / (auto_bed_leveling_grid_points-1);
|
2262
|
2262
|
const int yGridSpacing = (back_probe_bed_position - front_probe_bed_position) / (auto_bed_leveling_grid_points-1);
|
2263
|
2263
|
|
2264
|
|
- #ifndef DELTA
|
2265
|
|
- // solve the plane equation ax + by + d = z
|
2266
|
|
- // A is the matrix with rows [x y 1] for all the probed points
|
2267
|
|
- // B is the vector of the Z positions
|
2268
|
|
- // the normal vector to the plane is formed by the coefficients of the plane equation in the standard form, which is Vx*x+Vy*y+Vz*z+d = 0
|
2269
|
|
- // so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
|
2270
|
|
-
|
2271
|
|
- int abl2 = auto_bed_leveling_grid_points * auto_bed_leveling_grid_points;
|
2272
|
|
-
|
2273
|
|
- double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations
|
2274
|
|
- eqnBVector[abl2], // "B" vector of Z points
|
2275
|
|
- mean = 0.0;
|
2276
|
|
-
|
2277
|
|
- #else
|
2278
|
|
- delta_grid_spacing[0] = xGridSpacing;
|
2279
|
|
- delta_grid_spacing[1] = yGridSpacing;
|
2280
|
|
-
|
2281
|
|
- float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER;
|
2282
|
|
- if (code_seen(axis_codes[Z_AXIS])) z_offset += code_value();
|
2283
|
|
- #endif
|
|
2264
|
+ #ifdef DELTA
|
|
2265
|
+ delta_grid_spacing[0] = xGridSpacing;
|
|
2266
|
+ delta_grid_spacing[1] = yGridSpacing;
|
|
2267
|
+ float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER;
|
|
2268
|
+ if (code_seen(axis_codes[Z_AXIS])) z_offset += code_value();
|
|
2269
|
+ #else // !DELTA
|
|
2270
|
+ // solve the plane equation ax + by + d = z
|
|
2271
|
+ // A is the matrix with rows [x y 1] for all the probed points
|
|
2272
|
+ // B is the vector of the Z positions
|
|
2273
|
+ // the normal vector to the plane is formed by the coefficients of the plane equation in the standard form, which is Vx*x+Vy*y+Vz*z+d = 0
|
|
2274
|
+ // so Vx = -a Vy = -b Vz = 1 (we want the vector facing towards positive Z
|
|
2275
|
+
|
|
2276
|
+ int abl2 = auto_bed_leveling_grid_points * auto_bed_leveling_grid_points;
|
|
2277
|
+
|
|
2278
|
+ double eqnAMatrix[abl2 * 3], // "A" matrix of the linear system of equations
|
|
2279
|
+ eqnBVector[abl2], // "B" vector of Z points
|
|
2280
|
+ mean = 0.0;
|
|
2281
|
+ #endif // !DELTA
|
2284
|
2282
|
|
2285
|
2283
|
int probePointCounter = 0;
|
2286
|
2284
|
bool zig = true;
|
|
@@ -2313,12 +2311,12 @@ inline void gcode_G28() {
|
2313
|
2311
|
float measured_z,
|
2314
|
2312
|
z_before = probePointCounter == 0 ? Z_RAISE_BEFORE_PROBING : current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS;
|
2315
|
2313
|
|
2316
|
|
- #ifdef DELTA
|
2317
|
|
- // Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
|
2318
|
|
- float distance_from_center = sqrt(xProbe*xProbe + yProbe*yProbe);
|
2319
|
|
- if (distance_from_center > DELTA_PROBABLE_RADIUS)
|
2320
|
|
- continue;
|
2321
|
|
- #endif //DELTA
|
|
2314
|
+ #ifdef DELTA
|
|
2315
|
+ // Avoid probing the corners (outside the round or hexagon print surface) on a delta printer.
|
|
2316
|
+ float distance_from_center = sqrt(xProbe*xProbe + yProbe*yProbe);
|
|
2317
|
+ if (distance_from_center > DELTA_PROBABLE_RADIUS)
|
|
2318
|
+ continue;
|
|
2319
|
+ #endif //DELTA
|
2322
|
2320
|
|
2323
|
2321
|
// Enhanced G29 - Do not retract servo between probes
|
2324
|
2322
|
ProbeAction act;
|
|
@@ -2335,16 +2333,16 @@ inline void gcode_G28() {
|
2335
|
2333
|
|
2336
|
2334
|
measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level);
|
2337
|
2335
|
|
2338
|
|
- #ifndef DELTA
|
2339
|
|
- mean += measured_z;
|
|
2336
|
+ #ifndef DELTA
|
|
2337
|
+ mean += measured_z;
|
2340
|
2338
|
|
2341
|
|
- eqnBVector[probePointCounter] = measured_z;
|
2342
|
|
- eqnAMatrix[probePointCounter + 0 * abl2] = xProbe;
|
2343
|
|
- eqnAMatrix[probePointCounter + 1 * abl2] = yProbe;
|
2344
|
|
- eqnAMatrix[probePointCounter + 2 * abl2] = 1;
|
2345
|
|
- #else
|
2346
|
|
- bed_level[xCount][yCount] = measured_z + z_offset;
|
2347
|
|
- #endif
|
|
2339
|
+ eqnBVector[probePointCounter] = measured_z;
|
|
2340
|
+ eqnAMatrix[probePointCounter + 0 * abl2] = xProbe;
|
|
2341
|
+ eqnAMatrix[probePointCounter + 1 * abl2] = yProbe;
|
|
2342
|
+ eqnAMatrix[probePointCounter + 2 * abl2] = 1;
|
|
2343
|
+ #else
|
|
2344
|
+ bed_level[xCount][yCount] = measured_z + z_offset;
|
|
2345
|
+ #endif
|
2348
|
2346
|
|
2349
|
2347
|
probePointCounter++;
|
2350
|
2348
|
} //xProbe
|
|
@@ -2352,60 +2350,64 @@ inline void gcode_G28() {
|
2352
|
2350
|
|
2353
|
2351
|
clean_up_after_endstop_move();
|
2354
|
2352
|
|
2355
|
|
- #ifndef DELTA
|
2356
|
|
- // solve lsq problem
|
2357
|
|
- double *plane_equation_coefficients = qr_solve(abl2, 3, eqnAMatrix, eqnBVector);
|
2358
|
|
-
|
2359
|
|
- mean /= abl2;
|
2360
|
|
-
|
2361
|
|
- if (verbose_level) {
|
2362
|
|
- SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
|
2363
|
|
- SERIAL_PROTOCOL_F(plane_equation_coefficients[0], 8);
|
2364
|
|
- SERIAL_PROTOCOLPGM(" b: ");
|
2365
|
|
- SERIAL_PROTOCOL_F(plane_equation_coefficients[1], 8);
|
2366
|
|
- SERIAL_PROTOCOLPGM(" d: ");
|
2367
|
|
- SERIAL_PROTOCOL_F(plane_equation_coefficients[2], 8);
|
2368
|
|
- SERIAL_EOL;
|
2369
|
|
- if (verbose_level > 2) {
|
2370
|
|
- SERIAL_PROTOCOLPGM("Mean of sampled points: ");
|
2371
|
|
- SERIAL_PROTOCOL_F(mean, 8);
|
|
2353
|
+ #ifdef DELTA
|
|
2354
|
+
|
|
2355
|
+ if (!dryrun) extrapolate_unprobed_bed_level();
|
|
2356
|
+ print_bed_level();
|
|
2357
|
+
|
|
2358
|
+ #else // !DELTA
|
|
2359
|
+
|
|
2360
|
+ // solve lsq problem
|
|
2361
|
+ double *plane_equation_coefficients = qr_solve(abl2, 3, eqnAMatrix, eqnBVector);
|
|
2362
|
+
|
|
2363
|
+ mean /= abl2;
|
|
2364
|
+
|
|
2365
|
+ if (verbose_level) {
|
|
2366
|
+ SERIAL_PROTOCOLPGM("Eqn coefficients: a: ");
|
|
2367
|
+ SERIAL_PROTOCOL_F(plane_equation_coefficients[0], 8);
|
|
2368
|
+ SERIAL_PROTOCOLPGM(" b: ");
|
|
2369
|
+ SERIAL_PROTOCOL_F(plane_equation_coefficients[1], 8);
|
|
2370
|
+ SERIAL_PROTOCOLPGM(" d: ");
|
|
2371
|
+ SERIAL_PROTOCOL_F(plane_equation_coefficients[2], 8);
|
2372
|
2372
|
SERIAL_EOL;
|
|
2373
|
+ if (verbose_level > 2) {
|
|
2374
|
+ SERIAL_PROTOCOLPGM("Mean of sampled points: ");
|
|
2375
|
+ SERIAL_PROTOCOL_F(mean, 8);
|
|
2376
|
+ SERIAL_EOL;
|
|
2377
|
+ }
|
2373
|
2378
|
}
|
2374
|
|
- }
|
2375
|
2379
|
|
2376
|
|
- // Show the Topography map if enabled
|
2377
|
|
- if (do_topography_map) {
|
2378
|
|
-
|
2379
|
|
- SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n");
|
2380
|
|
- SERIAL_PROTOCOLPGM("+-----------+\n");
|
2381
|
|
- SERIAL_PROTOCOLPGM("|...Back....|\n");
|
2382
|
|
- SERIAL_PROTOCOLPGM("|Left..Right|\n");
|
2383
|
|
- SERIAL_PROTOCOLPGM("|...Front...|\n");
|
2384
|
|
- SERIAL_PROTOCOLPGM("+-----------+\n");
|
2385
|
|
-
|
2386
|
|
- for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
|
2387
|
|
- for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
|
2388
|
|
- int ind = yy * auto_bed_leveling_grid_points + xx;
|
2389
|
|
- float diff = eqnBVector[ind] - mean;
|
2390
|
|
- if (diff >= 0.0)
|
2391
|
|
- SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment
|
2392
|
|
- else
|
2393
|
|
- SERIAL_PROTOCOLPGM(" ");
|
2394
|
|
- SERIAL_PROTOCOL_F(diff, 5);
|
2395
|
|
- } // xx
|
|
2380
|
+ // Show the Topography map if enabled
|
|
2381
|
+ if (do_topography_map) {
|
|
2382
|
+
|
|
2383
|
+ SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n");
|
|
2384
|
+ SERIAL_PROTOCOLPGM("+-----------+\n");
|
|
2385
|
+ SERIAL_PROTOCOLPGM("|...Back....|\n");
|
|
2386
|
+ SERIAL_PROTOCOLPGM("|Left..Right|\n");
|
|
2387
|
+ SERIAL_PROTOCOLPGM("|...Front...|\n");
|
|
2388
|
+ SERIAL_PROTOCOLPGM("+-----------+\n");
|
|
2389
|
+
|
|
2390
|
+ for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
|
|
2391
|
+ for (int xx = 0; xx < auto_bed_leveling_grid_points; xx++) {
|
|
2392
|
+ int ind = yy * auto_bed_leveling_grid_points + xx;
|
|
2393
|
+ float diff = eqnBVector[ind] - mean;
|
|
2394
|
+ if (diff >= 0.0)
|
|
2395
|
+ SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment
|
|
2396
|
+ else
|
|
2397
|
+ SERIAL_PROTOCOLPGM(" ");
|
|
2398
|
+ SERIAL_PROTOCOL_F(diff, 5);
|
|
2399
|
+ } // xx
|
|
2400
|
+ SERIAL_EOL;
|
|
2401
|
+ } // yy
|
2396
|
2402
|
SERIAL_EOL;
|
2397
|
|
- } // yy
|
2398
|
|
- SERIAL_EOL;
|
2399
|
2403
|
|
2400
|
|
- } //do_topography_map
|
|
2404
|
+ } //do_topography_map
|
|
2405
|
+
|
2401
|
2406
|
|
|
2407
|
+ if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients);
|
|
2408
|
+ free(plane_equation_coefficients);
|
2402
|
2409
|
|
2403
|
|
- if (!dryrun) set_bed_level_equation_lsq(plane_equation_coefficients);
|
2404
|
|
- free(plane_equation_coefficients);
|
2405
|
|
- #else //Delta
|
2406
|
|
- if (!dryrun) extrapolate_unprobed_bed_level();
|
2407
|
|
- print_bed_level();
|
2408
|
|
- #endif //Delta
|
|
2410
|
+ #endif //!DELTA
|
2409
|
2411
|
|
2410
|
2412
|
#else // !AUTO_BED_LEVELING_GRID
|
2411
|
2413
|
|
|
@@ -2428,35 +2430,36 @@ inline void gcode_G28() {
|
2428
|
2430
|
|
2429
|
2431
|
#endif // !AUTO_BED_LEVELING_GRID
|
2430
|
2432
|
|
2431
|
|
- #ifndef DELTA
|
2432
|
|
- if (verbose_level > 0) plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
|
|
2433
|
+ #ifndef DELTA
|
|
2434
|
+ if (verbose_level > 0)
|
|
2435
|
+ plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:");
|
2433
|
2436
|
|
2434
|
|
- // Correct the Z height difference from z-probe position and hotend tip position.
|
2435
|
|
- // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
|
2436
|
|
- // When the bed is uneven, this height must be corrected.
|
2437
|
|
- if (!dryrun)
|
2438
|
|
- {
|
2439
|
|
- real_z = float(st_get_position(Z_AXIS)) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
|
2440
|
|
- x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
|
2441
|
|
- y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
2442
|
|
- z_tmp = current_position[Z_AXIS];
|
|
2437
|
+ // Correct the Z height difference from z-probe position and hotend tip position.
|
|
2438
|
+ // The Z height on homing is measured by Z-Probe, but the probe is quite far from the hotend.
|
|
2439
|
+ // When the bed is uneven, this height must be corrected.
|
|
2440
|
+ if (!dryrun)
|
|
2441
|
+ {
|
|
2442
|
+ real_z = float(st_get_position(Z_AXIS)) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane)
|
|
2443
|
+ x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER;
|
|
2444
|
+ y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER;
|
|
2445
|
+ z_tmp = current_position[Z_AXIS];
|
2443
|
2446
|
|
2444
|
|
- apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
|
2445
|
|
- current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner.
|
2446
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
2447
|
|
- }
|
2448
|
|
- #endif
|
|
2447
|
+ apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); //Apply the correction sending the probe offset
|
|
2448
|
+ current_position[Z_AXIS] = z_tmp - real_z + current_position[Z_AXIS]; //The difference is added to current position and sent to planner.
|
|
2449
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
2450
|
+ }
|
|
2451
|
+ #endif // !DELTA
|
2449
|
2452
|
|
2450
|
|
- #ifdef Z_PROBE_SLED
|
2451
|
|
- dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel
|
2452
|
|
- #elif defined(Z_PROBE_ALLEN_KEY)
|
2453
|
|
- retract_z_probe();
|
2454
|
|
- #endif
|
2455
|
|
-
|
2456
|
|
- #ifdef Z_PROBE_END_SCRIPT
|
2457
|
|
- enquecommands_P(PSTR(Z_PROBE_END_SCRIPT));
|
2458
|
|
- st_synchronize();
|
2459
|
|
- #endif
|
|
2453
|
+ #ifdef Z_PROBE_SLED
|
|
2454
|
+ dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel
|
|
2455
|
+ #elif defined(Z_PROBE_ALLEN_KEY) //|| defined(SERVO_LEVELING)
|
|
2456
|
+ retract_z_probe();
|
|
2457
|
+ #endif
|
|
2458
|
+
|
|
2459
|
+ #ifdef Z_PROBE_END_SCRIPT
|
|
2460
|
+ enquecommands_P(PSTR(Z_PROBE_END_SCRIPT));
|
|
2461
|
+ st_synchronize();
|
|
2462
|
+ #endif
|
2460
|
2463
|
}
|
2461
|
2464
|
|
2462
|
2465
|
#ifndef Z_PROBE_SLED
|
|
@@ -2919,7 +2922,7 @@ inline void gcode_M42() {
|
2919
|
2922
|
do_blocking_move_to( X_probe_location, Y_probe_location, Z_start_location); // Make sure we are at the probe location
|
2920
|
2923
|
|
2921
|
2924
|
if (n_legs) {
|
2922
|
|
- double radius=0.0, theta=0.0, x_sweep, y_sweep;
|
|
2925
|
+ double radius=0.0, theta=0.0;
|
2923
|
2926
|
int l;
|
2924
|
2927
|
int rotational_direction = (unsigned long) millis() & 0x0001; // clockwise or counter clockwise
|
2925
|
2928
|
radius = (unsigned long)millis() % (long)(X_MAX_LENGTH / 4); // limit how far out to go
|
|
@@ -3545,7 +3548,6 @@ inline void gcode_M200() {
|
3545
|
3548
|
}
|
3546
|
3549
|
}
|
3547
|
3550
|
|
3548
|
|
- float area = .0;
|
3549
|
3551
|
if (code_seen('D')) {
|
3550
|
3552
|
float diameter = code_value();
|
3551
|
3553
|
// setting any extruder filament size disables volumetric on the assumption that
|
|
@@ -4283,7 +4285,7 @@ inline void gcode_M502() {
|
4283
|
4285
|
* M503: print settings currently in memory
|
4284
|
4286
|
*/
|
4285
|
4287
|
inline void gcode_M503() {
|
4286
|
|
- Config_PrintSettings(code_seen('S') && code_value == 0);
|
|
4288
|
+ Config_PrintSettings(code_seen('S') && code_value() == 0);
|
4287
|
4289
|
}
|
4288
|
4290
|
|
4289
|
4291
|
#ifdef ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED
|
|
@@ -4580,9 +4582,14 @@ inline void gcode_T() {
|
4580
|
4582
|
SERIAL_ECHOLN(MSG_INVALID_EXTRUDER);
|
4581
|
4583
|
}
|
4582
|
4584
|
else {
|
4583
|
|
- boolean make_move = false;
|
|
4585
|
+ #if EXTRUDERS > 1
|
|
4586
|
+ bool make_move = false;
|
|
4587
|
+ #endif
|
|
4588
|
+
|
4584
|
4589
|
if (code_seen('F')) {
|
4585
|
|
- make_move = true;
|
|
4590
|
+ #if EXTRUDERS > 1
|
|
4591
|
+ make_move = true;
|
|
4592
|
+ #endif
|
4586
|
4593
|
next_feedrate = code_value();
|
4587
|
4594
|
if (next_feedrate > 0.0) feedrate = next_feedrate;
|
4588
|
4595
|
}
|
|
@@ -5179,20 +5186,22 @@ void ClearToSend()
|
5179
|
5186
|
SERIAL_PROTOCOLLNPGM(MSG_OK);
|
5180
|
5187
|
}
|
5181
|
5188
|
|
5182
|
|
-void get_coordinates()
|
5183
|
|
-{
|
5184
|
|
- bool seen[4]={false,false,false,false};
|
5185
|
|
- for(int8_t i=0; i < NUM_AXIS; i++) {
|
5186
|
|
- if(code_seen(axis_codes[i]))
|
5187
|
|
- {
|
5188
|
|
- destination[i] = (float)code_value() + (axis_relative_modes[i] || relative_mode)*current_position[i];
|
5189
|
|
- seen[i]=true;
|
|
5189
|
+void get_coordinates() {
|
|
5190
|
+ for (int i = 0; i < NUM_AXIS; i++) {
|
|
5191
|
+ float dest;
|
|
5192
|
+ if (code_seen(axis_codes[i])) {
|
|
5193
|
+ dest = code_value();
|
|
5194
|
+ if (axis_relative_modes[i] || relative_mode)
|
|
5195
|
+ dest += current_position[i];
|
5190
|
5196
|
}
|
5191
|
|
- else destination[i] = current_position[i]; //Are these else lines really needed?
|
|
5197
|
+ else
|
|
5198
|
+ dest = current_position[i];
|
|
5199
|
+
|
|
5200
|
+ destination[i] = dest;
|
5192
|
5201
|
}
|
5193
|
|
- if(code_seen('F')) {
|
|
5202
|
+ if (code_seen('F')) {
|
5194
|
5203
|
next_feedrate = code_value();
|
5195
|
|
- if(next_feedrate > 0.0) feedrate = next_feedrate;
|
|
5204
|
+ if (next_feedrate > 0.0) feedrate = next_feedrate;
|
5196
|
5205
|
}
|
5197
|
5206
|
}
|
5198
|
5207
|
|