|
@@ -2038,10 +2038,18 @@ inline void gcode_G28() {
|
2038
|
2038
|
*
|
2039
|
2039
|
* Parameters With MESH_BED_LEVELING:
|
2040
|
2040
|
*
|
2041
|
|
- * S0 Produce a mesh report
|
2042
|
|
- * S1 Start probing mesh points
|
2043
|
|
- * S2 Probe the next mesh point
|
|
2041
|
+ * S0 Produce a mesh report
|
|
2042
|
+ * S1 Start probing mesh points
|
|
2043
|
+ * S2 Probe the next mesh point
|
|
2044
|
+ * S3 Xn Yn Zn.nn Manually modify a single point
|
2044
|
2045
|
*
|
|
2046
|
+ * The S0 report the points as below
|
|
2047
|
+ *
|
|
2048
|
+ * +----> X-axis
|
|
2049
|
+ * |
|
|
2050
|
+ * |
|
|
2051
|
+ * v Y-axis
|
|
2052
|
+ *
|
2045
|
2053
|
*/
|
2046
|
2054
|
inline void gcode_G29() {
|
2047
|
2055
|
|
|
@@ -2052,13 +2060,13 @@ inline void gcode_G28() {
|
2052
|
2060
|
int state = 0;
|
2053
|
2061
|
if (code_seen('S') || code_seen('s')) {
|
2054
|
2062
|
state = code_value_long();
|
2055
|
|
- if (state < 0 || state > 2) {
|
2056
|
|
- SERIAL_PROTOCOLPGM("S out of range (0-2).\n");
|
|
2063
|
+ if (state < 0 || state > 3) {
|
|
2064
|
+ SERIAL_PROTOCOLPGM("S out of range (0-3).\n");
|
2057
|
2065
|
return;
|
2058
|
2066
|
}
|
2059
|
2067
|
}
|
2060
|
2068
|
|
2061
|
|
- if (state == 0) { // Dump mesh_bed_leveling
|
|
2069
|
+ if (state == 0) { // Produce a mesh report
|
2062
|
2070
|
if (mbl.active) {
|
2063
|
2071
|
SERIAL_PROTOCOLPGM("Num X,Y: ");
|
2064
|
2072
|
SERIAL_PROTOCOL(MESH_NUM_X_POINTS);
|
|
@@ -2078,14 +2086,14 @@ inline void gcode_G28() {
|
2078
|
2086
|
SERIAL_PROTOCOLPGM("Mesh bed leveling not active.\n");
|
2079
|
2087
|
}
|
2080
|
2088
|
|
2081
|
|
- } else if (state == 1) { // Begin probing mesh points
|
|
2089
|
+ } else if (state == 1) { // Start probing mesh points
|
2082
|
2090
|
|
2083
|
2091
|
mbl.reset();
|
2084
|
2092
|
probe_point = 0;
|
2085
|
2093
|
enquecommands_P(PSTR("G28"));
|
2086
|
2094
|
enquecommands_P(PSTR("G29 S2"));
|
2087
|
2095
|
|
2088
|
|
- } else if (state == 2) { // Goto next point
|
|
2096
|
+ } else if (state == 2) { // Probe the next mesh point
|
2089
|
2097
|
|
2090
|
2098
|
if (probe_point < 0) {
|
2091
|
2099
|
SERIAL_PROTOCOLPGM("Start mesh probing with \"G29 S1\" first.\n");
|
|
@@ -2119,6 +2127,36 @@ inline void gcode_G28() {
|
2119
|
2127
|
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);
|
2120
|
2128
|
st_synchronize();
|
2121
|
2129
|
probe_point++;
|
|
2130
|
+ } else if (state == 3) { // Manually modify a single point
|
|
2131
|
+ int ix, iy;
|
|
2132
|
+ float z;
|
|
2133
|
+ if (code_seen('X') || code_seen('x')) {
|
|
2134
|
+ ix = code_value_long()-1;
|
|
2135
|
+ if (ix < 0 || ix >= MESH_NUM_X_POINTS) {
|
|
2136
|
+ SERIAL_PROTOCOLPGM("X out of range (1-" STRINGIFY(MESH_NUM_X_POINTS) ").\n");
|
|
2137
|
+ return;
|
|
2138
|
+ }
|
|
2139
|
+ } else {
|
|
2140
|
+ SERIAL_PROTOCOLPGM("X not entered.\n");
|
|
2141
|
+ return;
|
|
2142
|
+ }
|
|
2143
|
+ if (code_seen('Y') || code_seen('y')) {
|
|
2144
|
+ iy = code_value_long()-1;
|
|
2145
|
+ if (iy < 0 || iy >= MESH_NUM_Y_POINTS) {
|
|
2146
|
+ SERIAL_PROTOCOLPGM("Y out of range (1-" STRINGIFY(MESH_NUM_Y_POINTS) ").\n");
|
|
2147
|
+ return;
|
|
2148
|
+ }
|
|
2149
|
+ } else {
|
|
2150
|
+ SERIAL_PROTOCOLPGM("Y not entered.\n");
|
|
2151
|
+ return;
|
|
2152
|
+ }
|
|
2153
|
+ if (code_seen('Z') || code_seen('z')) {
|
|
2154
|
+ z = code_value();
|
|
2155
|
+ } else {
|
|
2156
|
+ SERIAL_PROTOCOLPGM("Z not entered.\n");
|
|
2157
|
+ return;
|
|
2158
|
+ }
|
|
2159
|
+ mbl.z_values[iy][ix] = z;
|
2122
|
2160
|
}
|
2123
|
2161
|
}
|
2124
|
2162
|
|