From 81b8c9f8ec2f6d94433e5b5640c29fc8ed3f7ace Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 29 Sep 2016 01:17:16 -0500 Subject: [PATCH] Add XY parameters to G29 for mesh dimensions --- Marlin/Marlin_main.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 527ea51c2a..f04d410043 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -3635,24 +3635,31 @@ inline void gcode_G28() { #if ABL_GRID - #if ABL_PLANAR - bool do_topography_map = verbose_level > 2 || code_seen('T'); - #endif - if (verbose_level > 0) { SERIAL_PROTOCOLLNPGM("G29 Auto Bed Leveling"); if (dryrun) SERIAL_PROTOCOLLNPGM("Running in DRY-RUN mode"); } - int abl_grid_points_x = ABL_GRID_POINTS_X, - abl_grid_points_y = ABL_GRID_POINTS_Y; - #if ABL_PLANAR + + bool do_topography_map = verbose_level > 2 || code_seen('T'); + + // X and Y specify points in each direction, overriding the default + // These values may be saved with the completed mesh + int abl_grid_points_x = code_seen('X') ? code_value_int() : ABL_GRID_POINTS_X, + abl_grid_points_y = code_seen('Y') ? code_value_int() : ABL_GRID_POINTS_Y; + if (code_seen('P')) abl_grid_points_x = abl_grid_points_y = code_value_int(); - if (abl_grid_points_x < 2) { - SERIAL_PROTOCOLLNPGM("?Number of probed (P)oints is implausible (2 minimum)."); + + if (abl_grid_points_x < 2 || abl_grid_points_y < 2) { + SERIAL_PROTOCOLLNPGM("?Number of probe points is implausible (2 minimum)."); return; } + + #else + + const int abl_grid_points_x = ABL_GRID_POINTS_X, abl_grid_points_y = ABL_GRID_POINTS_Y; + #endif xy_probe_feedrate_mm_s = MMM_TO_MMS(code_seen('S') ? code_value_linear_units() : XY_PROBE_SPEED);