From 663ff7f92a299ace2aa87dfe9771ffe1b040d79c Mon Sep 17 00:00:00 2001 From: MagoKimbra Date: Sun, 4 Jun 2017 14:39:31 +0200 Subject: [PATCH] Fix G29 with 3 point --- Marlin/Marlin_main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 6fbc9a60b3..77076dac3b 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4198,19 +4198,19 @@ void home_all_axes() { gcode_G28(true); } ABL_VAR int left_probe_bed_position, right_probe_bed_position, front_probe_bed_position, back_probe_bed_position; ABL_VAR float xGridSpacing, yGridSpacing; - #if ABL_PLANAR + #if ENABLED(AUTO_BED_LEVELING_LINEAR) ABL_VAR uint8_t abl_grid_points_x = GRID_MAX_POINTS_X, abl_grid_points_y = GRID_MAX_POINTS_Y; ABL_VAR bool do_topography_map; - #else // 3-point + #else // Bilinear uint8_t constexpr abl_grid_points_x = GRID_MAX_POINTS_X, abl_grid_points_y = GRID_MAX_POINTS_Y; #endif #if ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(PROBE_MANUALLY) - #if ABL_PLANAR + #if ENABLED(AUTO_BED_LEVELING_LINEAR) ABL_VAR int abl2; - #else // 3-point + #else // Bilinear int constexpr abl2 = GRID_MAX_POINTS; #endif #endif @@ -4230,6 +4230,8 @@ void home_all_axes() { gcode_G28(true); } #elif ENABLED(AUTO_BED_LEVELING_3POINT) + int constexpr abl2 = 3; + // Probe at 3 arbitrary points ABL_VAR vector_3 points[3] = { vector_3(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, 0), @@ -4522,7 +4524,7 @@ void home_all_axes() { gcode_G28(true); } #elif ENABLED(AUTO_BED_LEVELING_3POINT) - points[i].z = measured_z; + points[abl_probe_index].z = measured_z; #endif }