Extend M421 with I and J parameters
Extend M421 with I and J parameters
This commit is contained in:
parent
319d184999
commit
f5a036510f
2 changed files with 17 additions and 4 deletions
|
@ -5899,12 +5899,16 @@ inline void gcode_M410() { stepper.quick_stop(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* M421: Set a single Mesh Bed Leveling Z coordinate
|
* M421: Set a single Mesh Bed Leveling Z coordinate
|
||||||
|
* Use either 'M421 X<mm> Y<mm> Z<mm>' or 'M421 I<xindex> J<yindex> Z<mm>'
|
||||||
*/
|
*/
|
||||||
inline void gcode_M421() {
|
inline void gcode_M421() {
|
||||||
float x = 0, y = 0, z = 0;
|
float x = 0, y = 0, z = 0;
|
||||||
bool err = false, hasX, hasY, hasZ;
|
int8_t i = 0, j = 0;
|
||||||
|
bool err = false, hasX, hasY, hasZ, hasI, hasJ;
|
||||||
if ((hasX = code_seen('X'))) x = code_value();
|
if ((hasX = code_seen('X'))) x = code_value();
|
||||||
if ((hasY = code_seen('Y'))) y = code_value();
|
if ((hasY = code_seen('Y'))) y = code_value();
|
||||||
|
if ((hasI = code_seen('I'))) i = code_value();
|
||||||
|
if ((hasJ = code_seen('J'))) j = code_value();
|
||||||
if ((hasZ = code_seen('Z'))) z = code_value();
|
if ((hasZ = code_seen('Z'))) z = code_value();
|
||||||
|
|
||||||
if (hasX && hasY && hasZ) {
|
if (hasX && hasY && hasZ) {
|
||||||
|
@ -5919,7 +5923,16 @@ inline void gcode_M410() { stepper.quick_stop(); }
|
||||||
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (hasI && hasJ && hasZ) {
|
||||||
|
if (i >= 0 && i < MESH_NUM_X_POINTS && j >= 0 && j < MESH_NUM_Y_POINTS)
|
||||||
|
mbl.set_z(i, j, z);
|
||||||
else {
|
else {
|
||||||
|
SERIAL_ERROR_START;
|
||||||
|
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SERIAL_ERROR_START;
|
SERIAL_ERROR_START;
|
||||||
SERIAL_ERRORLNPGM(MSG_ERR_M421_REQUIRES_XYZ);
|
SERIAL_ERRORLNPGM(MSG_ERR_M421_REQUIRES_XYZ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,8 +147,8 @@
|
||||||
#define MSG_Z2_MAX "z2_max: "
|
#define MSG_Z2_MAX "z2_max: "
|
||||||
#define MSG_Z_PROBE "z_probe: "
|
#define MSG_Z_PROBE "z_probe: "
|
||||||
#define MSG_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-1)"
|
#define MSG_ERR_MATERIAL_INDEX "M145 S<index> out of range (0-1)"
|
||||||
#define MSG_ERR_M421_REQUIRES_XYZ "M421 requires XYZ parameters"
|
#define MSG_ERR_M421_REQUIRES_XYZ "M421 requires XYZ or IJZ parameters"
|
||||||
#define MSG_ERR_MESH_XY "Mesh XY cannot be resolved"
|
#define MSG_ERR_MESH_XY "Mesh XY or IJ cannot be resolved"
|
||||||
#define MSG_ERR_M428_TOO_FAR "Too far from reference point"
|
#define MSG_ERR_M428_TOO_FAR "Too far from reference point"
|
||||||
#define MSG_ERR_M303_DISABLED "PIDTEMP disabled"
|
#define MSG_ERR_M303_DISABLED "PIDTEMP disabled"
|
||||||
#define MSG_M119_REPORT "Reporting endstop status"
|
#define MSG_M119_REPORT "Reporting endstop status"
|
||||||
|
|
Reference in a new issue