Add M851 X Y probe offsets (#15202)

This commit is contained in:
InsanityAutomation
2019-09-24 22:29:21 -04:00
committed by Scott Lahteine
parent ebc9a8a0b0
commit df1e51258a
151 changed files with 1009 additions and 1878 deletions

View File

@@ -47,10 +47,12 @@ void GcodeSuite::G42() {
set_destination_from_current();
if (hasI) destination[X_AXIS] = _GET_MESH_X(ix);
if (hasJ) destination[Y_AXIS] = _GET_MESH_Y(iy);
if (parser.boolval('P')) {
if (hasI) destination[X_AXIS] -= X_PROBE_OFFSET_FROM_EXTRUDER;
if (hasJ) destination[Y_AXIS] -= Y_PROBE_OFFSET_FROM_EXTRUDER;
}
#if HAS_BED_PROBE
if (parser.boolval('P')) {
if (hasI) destination[X_AXIS] -= zprobe_offset[X_AXIS];
if (hasJ) destination[Y_AXIS] -= zprobe_offset[Y_AXIS];
}
#endif
const float fval = parser.linearval('F');
if (fval > 0.0) feedrate_mm_s = MMM_TO_MMS(fval);

View File

@@ -64,10 +64,12 @@ void GcodeSuite::M420() {
#if ENABLED(MARLIN_DEV_MODE)
if (parser.intval('S') == 2) {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
bilinear_start[X_AXIS] = MIN_PROBE_X;
bilinear_start[Y_AXIS] = MIN_PROBE_Y;
bilinear_grid_spacing[X_AXIS] = (MAX_PROBE_X - (MIN_PROBE_X)) / (GRID_MAX_POINTS_X - 1);
bilinear_grid_spacing[Y_AXIS] = (MAX_PROBE_Y - (MIN_PROBE_Y)) / (GRID_MAX_POINTS_Y - 1);
const float x_min = probe_min_x(), x_max = probe_max_x(),
y_min = probe_min_y(), y_max = probe_max_y();
bilinear_start[X_AXIS] = x_min;
bilinear_start[Y_AXIS] = y_min;
bilinear_grid_spacing[X_AXIS] = (x_max - x_min) / (GRID_MAX_POINTS_X - 1);
bilinear_grid_spacing[Y_AXIS] = (y_max - y_min) / (GRID_MAX_POINTS_Y - 1);
#endif
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) {
@@ -76,11 +78,11 @@ void GcodeSuite::M420() {
ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y));
#endif
}
SERIAL_ECHOPGM("Simulated " STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_X) " mesh ");
SERIAL_ECHOPAIR(" (", MIN_PROBE_X);
SERIAL_CHAR(','); SERIAL_ECHO(MIN_PROBE_Y);
SERIAL_ECHOPAIR(")-(", MAX_PROBE_X);
SERIAL_CHAR(','); SERIAL_ECHO(MAX_PROBE_Y);
SERIAL_ECHOPGM("Simulated " STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh ");
SERIAL_ECHOPAIR(" (", x_min);
SERIAL_CHAR(','); SERIAL_ECHO(y_min);
SERIAL_ECHOPAIR(")-(", x_max);
SERIAL_CHAR(','); SERIAL_ECHO(y_max);
SERIAL_ECHOLNPGM(")");
}
#endif

View File

@@ -393,16 +393,16 @@ G29_TYPE GcodeSuite::G29() {
if (parser.seen('H')) {
const int16_t size = (int16_t)parser.value_linear_units();
left_probe_bed_position = _MAX(X_CENTER - size / 2, MIN_PROBE_X);
right_probe_bed_position = _MIN(left_probe_bed_position + size, MAX_PROBE_X);
front_probe_bed_position = _MAX(Y_CENTER - size / 2, MIN_PROBE_Y);
back_probe_bed_position = _MIN(front_probe_bed_position + size, MAX_PROBE_Y);
left_probe_bed_position = _MAX(X_CENTER - size / 2, probe_min_x());
right_probe_bed_position = _MIN(left_probe_bed_position + size, probe_max_x());
front_probe_bed_position = _MAX(Y_CENTER - size / 2, probe_min_y());
back_probe_bed_position = _MIN(front_probe_bed_position + size, probe_max_y());
}
else {
left_probe_bed_position = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : LEFT_PROBE_BED_POSITION;
right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : RIGHT_PROBE_BED_POSITION;
front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : FRONT_PROBE_BED_POSITION;
back_probe_bed_position = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : BACK_PROBE_BED_POSITION;
left_probe_bed_position = parser.seenval('L') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MAX(X_CENTER - X_BED_SIZE / 2, probe_min_x());
right_probe_bed_position = parser.seenval('R') ? (int)RAW_X_POSITION(parser.value_linear_units()) : _MIN(left_probe_bed_position + X_BED_SIZE, probe_max_x());
front_probe_bed_position = parser.seenval('F') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MAX(Y_CENTER - Y_BED_SIZE / 2, probe_min_y());
back_probe_bed_position = parser.seenval('B') ? (int)RAW_Y_POSITION(parser.value_linear_units()) : _MIN(front_probe_bed_position + Y_BED_SIZE, probe_max_y());
}
if (
@@ -947,8 +947,8 @@ G29_TYPE GcodeSuite::G29() {
planner.leveling_active = false;
// Use the last measured distance to the bed, if possible
if ( NEAR(current_position[X_AXIS], xProbe - (X_PROBE_OFFSET_FROM_EXTRUDER))
&& NEAR(current_position[Y_AXIS], yProbe - (Y_PROBE_OFFSET_FROM_EXTRUDER))
if ( NEAR(current_position[X_AXIS], xProbe - zprobe_offset[X_AXIS])
&& NEAR(current_position[Y_AXIS], yProbe - zprobe_offset[Y_AXIS])
) {
const float simple_z = current_position[Z_AXIS] - measured_z;
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Probed Z", simple_z, " Matrix Z", converted[Z_AXIS], " Discrepancy ", simple_z - converted[Z_AXIS]);