From 1aa4becc60b5ef5f18f3ad6bc419e05ce1eb2e12 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 17 Aug 2021 12:04:58 -0400 Subject: [PATCH] bed_mesh: Fix off-by-one error in faulty region error report Reported by @craiglink. Signed-off-by: Kevin O'Connor --- klippy/extras/bed_mesh.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/klippy/extras/bed_mesh.py b/klippy/extras/bed_mesh.py index d513db8c..799bf84c 100644 --- a/klippy/extras/bed_mesh.py +++ b/klippy/extras/bed_mesh.py @@ -443,14 +443,16 @@ class BedMeshCalibrate: raise config.error( "bed_mesh: Existing faulty_region_%d %s overlaps " "added faulty_region_%d %s" - % (j, repr([prev_c1, prev_c3]), i, repr([c1, c3]))) + % (j+1, repr([prev_c1, prev_c3]), + i, repr([c1, c3]))) # Validate that no new corner is within an existing region for coord in [c1, c2, c3, c4]: if within(coord, prev_c1, prev_c3): raise config.error( "bed_mesh: Added faulty_region_%d %s overlaps " "existing faulty_region_%d %s" - % (i, repr([c1, c3]), j, repr([prev_c1, prev_c3]))) + % (i, repr([c1, c3]), + j+1, repr([prev_c1, prev_c3]))) self.faulty_regions.append((c1, c3)) self._verify_algorithm(config.error) def _verify_algorithm(self, error):