From fd582dc863785b53048834d0c9789f1d264603b2 Mon Sep 17 00:00:00 2001 From: tombrazier <68918209+tombrazier@users.noreply.github.com> Date: Fri, 4 Mar 2022 21:57:51 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20Improve=20and=20apply=20XATC=20r?= =?UTF-8?q?eset()=20(#23840)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/x_twist.cpp | 7 +++++-- Marlin/src/lcd/menu/menu_x_twist.cpp | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Marlin/src/feature/x_twist.cpp b/Marlin/src/feature/x_twist.cpp index deac1bceba..8910091239 100644 --- a/Marlin/src/feature/x_twist.cpp +++ b/Marlin/src/feature/x_twist.cpp @@ -24,18 +24,21 @@ #if ENABLED(X_AXIS_TWIST_COMPENSATION) #include "x_twist.h" +#include "../module/probe.h" XATC xatc; -bool XATC::enabled = true; +bool XATC::enabled; float XATC::spacing, XATC::start; xatc_array_t XATC::z_offset; // Initialized by settings.load() void XATC::reset() { constexpr float xzo[] = XATC_Z_OFFSETS; static_assert(COUNT(xzo) == XATC_MAX_POINTS, "XATC_Z_OFFSETS is the wrong size."); - enabled = false; COPY(z_offset, xzo); + xatc.spacing = (probe.max_x() - probe.min_x()) / (XATC_MAX_POINTS - 1); + xatc.start = probe.min_x(); + enabled = true; } void XATC::print_points() { diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp index ca385ebfeb..93f8de07ad 100644 --- a/Marlin/src/lcd/menu/menu_x_twist.cpp +++ b/Marlin/src/lcd/menu/menu_x_twist.cpp @@ -189,8 +189,7 @@ void xatc_wizard_homing_done() { } if (ui.use_click()) { - xatc.spacing = (probe.max_x() - probe.min_x()) / (XATC_MAX_POINTS - 1); - xatc.start = probe.min_x(); + xatc.reset(); SET_SOFT_ENDSTOP_LOOSE(true); // Disable soft endstops for free Z movement