plus4的klipper版本

This commit is contained in:
whb0514
2024-09-02 13:37:34 +08:00
parent 653d7a8f6e
commit b90736975b
1006 changed files with 1195894 additions and 11114 deletions

View File

@@ -12,7 +12,9 @@ class ScrewsTiltAdjust:
self.config = config
self.printer = config.get_printer()
self.screws = []
self.results = []
self.max_diff = None
self.max_diff_error = False
# Read config
for i in range(99):
prefix = "screw%d" % (i + 1,)
@@ -26,7 +28,7 @@ class ScrewsTiltAdjust:
raise config.error("screws_tilt_adjust: Must have "
"at least three screws")
self.threads = {'CW-M3': 0, 'CCW-M3': 1, 'CW-M4': 2, 'CCW-M4': 3,
'CW-M5': 4, 'CCW-M5': 5}
'CW-M5': 4, 'CCW-M5': 5, 'CW-M6': 6, 'CCW-M6': 7}
self.thread = config.getchoice('screw_thread', self.threads,
default='CW-M3')
# Initialize ProbePointsHelper
@@ -57,9 +59,18 @@ class ScrewsTiltAdjust:
self.direction = direction
self.probe_helper.start_probe(gcmd)
def get_status(self, eventtime):
return {'error': self.max_diff_error,
'max_deviation': self.max_diff,
'results': self.results}
def probe_finalize(self, offsets, positions):
# Factors used for CW-M3, CCW-M3, CW-M4, CCW-M4, CW-M5 and CCW-M5
threads_factor = {0: 0.5, 1: 0.5, 2: 0.7, 3: 0.7, 4: 0.8, 5: 0.8}
self.results = {}
self.max_diff_error = False
# Factors used for CW-M3, CCW-M3, CW-M4, CCW-M4, CW-M5, CCW-M5, CW-M6
#and CCW-M6
threads_factor = {0: 0.5, 1: 0.5, 2: 0.7, 3: 0.7, 4: 0.8, 5: 0.8,
6: 1.0, 7: 1.0}
is_clockwise_thread = (self.thread & 1) == 0
screw_diff = []
# Process the read Z values
@@ -84,6 +95,9 @@ class ScrewsTiltAdjust:
self.gcode.respond_info(
"%s : x=%.1f, y=%.1f, z=%.5f" %
(name + ' (base)', coord[0], coord[1], z))
sign = "CW" if is_clockwise_thread else "CCW"
self.results["screw%d" % (i + 1,)] = {'z': z, 'sign': sign,
'adjust': '00:00', 'is_base': True}
else:
# Calculate how knob must be adjusted for other positions
diff = z_base - z
@@ -104,7 +118,11 @@ class ScrewsTiltAdjust:
self.gcode.respond_info(
"%s : x=%.1f, y=%.1f, z=%.5f : adjust %s %02d:%02d" %
(name, coord[0], coord[1], z, sign, full_turns, minutes))
self.results["screw%d" % (i + 1,)] = {'z': z, 'sign': sign,
'adjust':"%02d:%02d" % (full_turns, minutes),
'is_base': False}
if self.max_diff and any((d > self.max_diff) for d in screw_diff):
self.max_diff_error = True
raise self.gcode.error(
"bed level exceeds configured limits ({}mm)! " \
"Adjust screws and restart print.".format(self.max_diff))