From bfdb7c71358bb787a6b8d2a9e4948ad19fac93db Mon Sep 17 00:00:00 2001
From: Giuseppe499 <giuseppe499@live.it>
Date: Tue, 15 Feb 2022 20:21:05 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20XATC=20divide-by-zero=20(#?=
 =?UTF-8?q?23743)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Marlin/src/feature/bedlevel/abl/x_twist.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Marlin/src/feature/bedlevel/abl/x_twist.cpp b/Marlin/src/feature/bedlevel/abl/x_twist.cpp
index c4a62c3595..000c1e2294 100644
--- a/Marlin/src/feature/bedlevel/abl/x_twist.cpp
+++ b/Marlin/src/feature/bedlevel/abl/x_twist.cpp
@@ -49,6 +49,7 @@ void XATC::print_points() {
 float lerp(const_float_t t, const_float_t a, const_float_t b) { return a + t * (b - a); }
 
 float XATC::compensation(const xy_pos_t &raw) {
+  if (NEAR_ZERO(spacing)) return 0;
   float t = (raw.x - start) / spacing;
   int i = FLOOR(t);
   LIMIT(i, 0, XATC_MAX_POINTS - 2);