diff options
author | theophile <chmeredith@gmail.com> | 2022-12-17 10:39:25 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-17 11:39:25 -0500 |
commit | 2a25733cd8d32bf7c02c896da0ce7964d7474ba6 (patch) | |
tree | 358cb345787754b78ad8f054560dbbcf9ae46571 /klippy | |
parent | 3c1ed3bb2731b49249d6aaacf01248783e4c8bf6 (diff) | |
download | kutter-2a25733cd8d32bf7c02c896da0ce7964d7474ba6.tar.gz kutter-2a25733cd8d32bf7c02c896da0ce7964d7474ba6.tar.xz kutter-2a25733cd8d32bf7c02c896da0ce7964d7474ba6.zip |
screws_tilt_adjust: Add get_status() method (#5921)
Signed-off-by: Christopher Meredith <chmeredith@gmail.com>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/extras/screws_tilt_adjust.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/klippy/extras/screws_tilt_adjust.py b/klippy/extras/screws_tilt_adjust.py index 1bb599ed..82d12bc1 100644 --- a/klippy/extras/screws_tilt_adjust.py +++ b/klippy/extras/screws_tilt_adjust.py @@ -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,) @@ -57,7 +59,13 @@ class ScrewsTiltAdjust: self.direction = direction self.probe_helper.start_probe(gcmd) + def get_status(self, eventtime): + return {'error': self.max_diff_error, + 'results': self.results} + def probe_finalize(self, offsets, positions): + self.results = [] + self.max_diff_error = False # 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} is_clockwise_thread = (self.thread & 1) == 0 @@ -84,6 +92,8 @@ class ScrewsTiltAdjust: self.gcode.respond_info( "%s : x=%.1f, y=%.1f, z=%.5f" % (name + ' (base)', coord[0], coord[1], z)) + self.results.append({'name': name + ' (base)', 'x': coord[0], + 'y': coord[1], 'z': z, 'sign': 'CW', 'adjust':'00:00'}) else: # Calculate how knob must be adjusted for other positions diff = z_base - z @@ -104,7 +114,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.append({'name': name, 'x': coord[0], 'y': coord[1], + 'z': z, 'sign': sign, + 'adjust':"%02d:%02d" % (full_turns, minutes)}) 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)) |