Skip to content

Commit

Permalink
🩹 Improve and apply XATC reset() (MarlinFirmware#23840)
Browse files Browse the repository at this point in the history
  • Loading branch information
tombrazier authored and Omkar Dhekne committed Mar 25, 2024
1 parent 0b67c59 commit b83ee41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions Marlin/src/feature/x_twist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
3 changes: 1 addition & 2 deletions Marlin/src/lcd/menu/menu_x_twist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b83ee41

Please sign in to comment.