From f0d673561fa2e555b5de3a285cb0830f0b5df7c8 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Wed, 26 Oct 2016 04:56:42 -0500 Subject: [PATCH] Fix for bilinear grid outside bounds --- Marlin/Marlin_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 1300196667..b99ae27df4 100755 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -8313,8 +8313,8 @@ void ok_to_send() { // Whole unit is the grid box index const int gridx = constrain(floor(ratio_x), 0, ABL_GRID_POINTS_X - 2), gridy = constrain(floor(ratio_y), 0, ABL_GRID_POINTS_Y - 2), - nextx = gridx + (x < PROBE_BED_WIDTH ? 1 : 0), - nexty = gridy + (y < PROBE_BED_HEIGHT ? 1 : 0); + nextx = min(gridx + 1, ABL_GRID_POINTS_X - 2), + nexty = min(gridy + 1, ABL_GRID_POINTS_Y - 2); // Subtract whole to get the ratio within the grid box ratio_x = constrain(ratio_x - gridx, 0.0, 1.0);