|
@@ -5901,12 +5901,16 @@ inline void gcode_M410() { stepper.quick_stop(); }
|
5901
|
5901
|
|
5902
|
5902
|
/**
|
5903
|
5903
|
* M421: Set a single Mesh Bed Leveling Z coordinate
|
|
5904
|
+ * Use either 'M421 X<mm> Y<mm> Z<mm>' or 'M421 I<xindex> J<yindex> Z<mm>'
|
5904
|
5905
|
*/
|
5905
|
5906
|
inline void gcode_M421() {
|
5906
|
5907
|
float x = 0, y = 0, z = 0;
|
5907
|
|
- bool err = false, hasX, hasY, hasZ;
|
|
5908
|
+ int8_t i = 0, j = 0;
|
|
5909
|
+ bool err = false, hasX, hasY, hasZ, hasI, hasJ;
|
5908
|
5910
|
if ((hasX = code_seen('X'))) x = code_value();
|
5909
|
5911
|
if ((hasY = code_seen('Y'))) y = code_value();
|
|
5912
|
+ if ((hasI = code_seen('I'))) i = code_value();
|
|
5913
|
+ if ((hasJ = code_seen('J'))) j = code_value();
|
5910
|
5914
|
if ((hasZ = code_seen('Z'))) z = code_value();
|
5911
|
5915
|
|
5912
|
5916
|
if (hasX && hasY && hasZ) {
|
|
@@ -5921,7 +5925,16 @@ inline void gcode_M410() { stepper.quick_stop(); }
|
5921
|
5925
|
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
5922
|
5926
|
}
|
5923
|
5927
|
}
|
5924
|
|
- else {
|
|
5928
|
+ else if (hasI && hasJ && hasZ) {
|
|
5929
|
+ if (i >= 0 && i < MESH_NUM_X_POINTS && j >= 0 && j < MESH_NUM_Y_POINTS)
|
|
5930
|
+ mbl.set_z(i, j, z);
|
|
5931
|
+ else {
|
|
5932
|
+ SERIAL_ERROR_START;
|
|
5933
|
+ SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
|
5934
|
+ }
|
|
5935
|
+ }
|
|
5936
|
+ else
|
|
5937
|
+ {
|
5925
|
5938
|
SERIAL_ERROR_START;
|
5926
|
5939
|
SERIAL_ERRORLNPGM(MSG_ERR_M421_REQUIRES_XYZ);
|
5927
|
5940
|
}
|