Unify M421

This commit is contained in:
Scott Lahteine 2017-04-11 15:46:13 -05:00
parent 4ea447959e
commit 063f641651

View File

@ -7777,7 +7777,7 @@ void quickstop_stepper() {
}
}
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR) || ENABLED(AUTO_BED_LEVELING_UBL)
/**
* M421: Set a single Mesh Bed Leveling Z coordinate
@ -7794,10 +7794,14 @@ void quickstop_stepper() {
if (hasI && hasJ && hasZ) {
if (WITHIN(px, 0, GRID_MAX_POINTS_X - 1) && WITHIN(py, 0, GRID_MAX_POINTS_X - 1)) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
ubl.z_values[px][py] = z;
#else
bed_level_grid[px][py] = z;
#if ENABLED(ABL_BILINEAR_SUBDIVISION)
bed_level_virt_interpolate();
#endif
#endif
}
else {
SERIAL_ERROR_START;
@ -7809,34 +7813,7 @@ void quickstop_stepper() {
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
}
#elif ENABLED(AUTO_BED_LEVELING_UBL)
/**
* M421: Set a single Mesh Bed Leveling Z coordinate
*
* M421 I<xindex> J<yindex> Z<linear>
*/
inline void gcode_M421() {
int8_t px = 0, py = 0;
float z = 0;
bool hasI, hasJ, hasZ;
if ((hasI = code_seen('I'))) px = code_value_axis_units(X_AXIS);
if ((hasJ = code_seen('J'))) py = code_value_axis_units(Y_AXIS);
if ((hasZ = code_seen('Z'))) z = code_value_axis_units(Z_AXIS);
if (hasI && hasJ && hasZ) {
if (WITHIN(px, 0, GRID_MAX_POINTS_Y - 1) && WITHIN(py, 0, GRID_MAX_POINTS_Y - 1)) {
ubl.z_values[px][py] = z;
}
else {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
}
}
else {
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
}
}
#endif
#if DISABLED(NO_WORKSPACE_OFFSETS)