Skip to content

Commit 687dc9a

Browse files
authored
🩹 Improve and apply XATC reset() (MarlinFirmware#23840)
1 parent 755c196 commit 687dc9a

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Marlin/src/feature/x_twist.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,21 @@
2424
#if ENABLED(X_AXIS_TWIST_COMPENSATION)
2525

2626
#include "x_twist.h"
27+
#include "../module/probe.h"
2728

2829
XATC xatc;
2930

30-
bool XATC::enabled = true;
31+
bool XATC::enabled;
3132
float XATC::spacing, XATC::start;
3233
xatc_array_t XATC::z_offset; // Initialized by settings.load()
3334

3435
void XATC::reset() {
3536
constexpr float xzo[] = XATC_Z_OFFSETS;
3637
static_assert(COUNT(xzo) == XATC_MAX_POINTS, "XATC_Z_OFFSETS is the wrong size.");
37-
enabled = false;
3838
COPY(z_offset, xzo);
39+
xatc.spacing = (probe.max_x() - probe.min_x()) / (XATC_MAX_POINTS - 1);
40+
xatc.start = probe.min_x();
41+
enabled = true;
3942
}
4043

4144
void XATC::print_points() {

Marlin/src/lcd/menu/menu_x_twist.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ void xatc_wizard_homing_done() {
189189
}
190190

191191
if (ui.use_click()) {
192-
xatc.spacing = (probe.max_x() - probe.min_x()) / (XATC_MAX_POINTS - 1);
193-
xatc.start = probe.min_x();
192+
xatc.reset();
194193

195194
SET_SOFT_ENDSTOP_LOOSE(true); // Disable soft endstops for free Z movement
196195

0 commit comments

Comments
 (0)