🩹 Improve and apply XATC reset() (#23840)
This commit is contained in:
		
				
					committed by
					
						
						Scott Lahteine
					
				
			
			
				
	
			
			
			
						parent
						
							2986bc3b76
						
					
				
				
					commit
					fd582dc863
				
			@@ -24,18 +24,21 @@
 | 
				
			|||||||
#if ENABLED(X_AXIS_TWIST_COMPENSATION)
 | 
					#if ENABLED(X_AXIS_TWIST_COMPENSATION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "x_twist.h"
 | 
					#include "x_twist.h"
 | 
				
			||||||
 | 
					#include "../module/probe.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
XATC xatc;
 | 
					XATC xatc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool XATC::enabled = true;
 | 
					bool XATC::enabled;
 | 
				
			||||||
float XATC::spacing, XATC::start;
 | 
					float XATC::spacing, XATC::start;
 | 
				
			||||||
xatc_array_t XATC::z_offset; // Initialized by settings.load()
 | 
					xatc_array_t XATC::z_offset; // Initialized by settings.load()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void XATC::reset() {
 | 
					void XATC::reset() {
 | 
				
			||||||
  constexpr float xzo[] = XATC_Z_OFFSETS;
 | 
					  constexpr float xzo[] = XATC_Z_OFFSETS;
 | 
				
			||||||
  static_assert(COUNT(xzo) == XATC_MAX_POINTS, "XATC_Z_OFFSETS is the wrong size.");
 | 
					  static_assert(COUNT(xzo) == XATC_MAX_POINTS, "XATC_Z_OFFSETS is the wrong size.");
 | 
				
			||||||
  enabled = false;
 | 
					 | 
				
			||||||
  COPY(z_offset, xzo);
 | 
					  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() {
 | 
					void XATC::print_points() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -189,8 +189,7 @@ void xatc_wizard_homing_done() {
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (ui.use_click()) {
 | 
					  if (ui.use_click()) {
 | 
				
			||||||
    xatc.spacing = (probe.max_x() - probe.min_x()) / (XATC_MAX_POINTS - 1);
 | 
					    xatc.reset();
 | 
				
			||||||
    xatc.start = probe.min_x();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SET_SOFT_ENDSTOP_LOOSE(true); // Disable soft endstops for free Z movement
 | 
					    SET_SOFT_ENDSTOP_LOOSE(true); // Disable soft endstops for free Z movement
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user