Browse Source

🩹 Improve and apply XATC reset() (#23840)

tombrazier 3 years ago
parent
commit
687dc9ad4d
No account linked to committer's email address
2 changed files with 6 additions and 4 deletions
  1. 5
    2
      Marlin/src/feature/x_twist.cpp
  2. 1
    2
      Marlin/src/lcd/menu/menu_x_twist.cpp

+ 5
- 2
Marlin/src/feature/x_twist.cpp View File

@@ -24,18 +24,21 @@
24 24
 #if ENABLED(X_AXIS_TWIST_COMPENSATION)
25 25
 
26 26
 #include "x_twist.h"
27
+#include "../module/probe.h"
27 28
 
28 29
 XATC xatc;
29 30
 
30
-bool XATC::enabled = true;
31
+bool XATC::enabled;
31 32
 float XATC::spacing, XATC::start;
32 33
 xatc_array_t XATC::z_offset; // Initialized by settings.load()
33 34
 
34 35
 void XATC::reset() {
35 36
   constexpr float xzo[] = XATC_Z_OFFSETS;
36 37
   static_assert(COUNT(xzo) == XATC_MAX_POINTS, "XATC_Z_OFFSETS is the wrong size.");
37
-  enabled = false;
38 38
   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;
39 42
 }
40 43
 
41 44
 void XATC::print_points() {

+ 1
- 2
Marlin/src/lcd/menu/menu_x_twist.cpp View File

@@ -189,8 +189,7 @@ void xatc_wizard_homing_done() {
189 189
   }
190 190
 
191 191
   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();
194 193
 
195 194
     SET_SOFT_ENDSTOP_LOOSE(true); // Disable soft endstops for free Z movement
196 195
 

Loading…
Cancel
Save