From bfdd1f4662f74c9db1cb62cc4f134d4e66a2da4f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 30 Mar 2021 23:57:57 -0500 Subject: [PATCH] Update UBL param --- Marlin/src/feature/bedlevel/ubl/ubl.h | 2 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.h b/Marlin/src/feature/bedlevel/ubl/ubl.h index 56de4e45ba3a..acc191908c84 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.h +++ b/Marlin/src/feature/bedlevel/ubl/ubl.h @@ -57,7 +57,7 @@ typedef struct { xy_pos_t XY_pos; xy_bool_t XY_seen; #if HAS_BED_PROBE - int grid_size; + uint8_t J_grid_size; #endif } G29_parameters_t; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index c11962bf9d60..3282ebe6208e 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -391,7 +391,7 @@ void unified_bed_leveling::G29() { if (parser.seen('J')) { save_ubl_active_state_and_disable(); - tilt_mesh_based_on_probed_grid(param.grid_size == 0); // Zero size does 3-Point + tilt_mesh_based_on_probed_grid(param.J_grid_size == 0); // Zero size does 3-Point restore_ubl_active_state_and_leave(); #if ENABLED(UBL_G29_J_RECENTER) do_blocking_move_to_xy(0.5f * ((MESH_MIN_X) + (MESH_MAX_X)), 0.5f * ((MESH_MIN_Y) + (MESH_MAX_Y))); @@ -1118,8 +1118,8 @@ bool unified_bed_leveling::G29_parse_parameters() { if (parser.seen('J')) { #if HAS_BED_PROBE - param.grid_size = parser.has_value() ? parser.value_int() : 0; - if (param.grid_size && !WITHIN(param.grid_size, 2, 9)) { + param.J_grid_size = parser.value_byte(); + if (param.J_grid_size && !WITHIN(param.J_grid_size, 2, 9)) { SERIAL_ECHOLNPGM("?Invalid grid size (J) specified (2-9).\n"); err_flag = true; } @@ -1420,8 +1420,8 @@ void unified_bed_leveling::smart_fill_mesh() { void unified_bed_leveling::tilt_mesh_based_on_probed_grid(const bool do_3_pt_leveling) { const float x_min = probe.min_x(), x_max = probe.max_x(), y_min = probe.min_y(), y_max = probe.max_y(), - dx = (x_max - x_min) / (param.grid_size - 1), - dy = (y_max - y_min) / (param.grid_size - 1); + dx = (x_max - x_min) / (param.J_grid_size - 1), + dy = (y_max - y_min) / (param.J_grid_size - 1); xy_float_t points[3]; probe.get_three_points(points); @@ -1507,14 +1507,14 @@ void unified_bed_leveling::smart_fill_mesh() { bool zig_zag = false; - const uint16_t total_points = sq(param.grid_size); + const uint16_t total_points = sq(param.J_grid_size); uint16_t point_num = 1; xy_pos_t rpos; - LOOP_L_N(ix, param.grid_size) { + LOOP_L_N(ix, param.J_grid_size) { rpos.x = x_min + ix * dx; - LOOP_L_N(iy, param.grid_size) { - rpos.y = y_min + dy * (zig_zag ? param.grid_size - 1 - iy : iy); + LOOP_L_N(iy, param.J_grid_size) { + rpos.y = y_min + dy * (zig_zag ? param.J_grid_size - 1 - iy : iy); if (!abort_flag) { SERIAL_ECHOLNPAIR("Tilting mesh point ", point_num, "/", total_points, "\n");