From b959cf5b4fe1fad47bf3b1b2f07db841c12cc742 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Tue, 16 Nov 2021 23:05:02 -0300 Subject: [PATCH] Move panel: Add Z-tilt/Quad-gantry-level/HomeXY button (#326) --- ks_includes/KlippyGcodes.py | 3 +++ ks_includes/screen_panel.py | 9 +++++++++ panels/move.py | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/ks_includes/KlippyGcodes.py b/ks_includes/KlippyGcodes.py index e43f6229..88c5e24d 100644 --- a/ks_includes/KlippyGcodes.py +++ b/ks_includes/KlippyGcodes.py @@ -4,6 +4,9 @@ class KlippyGcodes: HOME_X = "G28 X" HOME_Y = "G28 Y" HOME_Z = "G28 Z" + HOME_XY = "G28 X Y" + Z_TILT = "Z_TILT_ADJUST" + QUAD_GANTRY_LEVEL = "QUAD_GANTRY_LEVEL" MOVE = "G1" MOVE_ABSOLUTE = "G90" diff --git a/ks_includes/screen_panel.py b/ks_includes/screen_panel.py index d9f68ff6..112072ca 100644 --- a/ks_includes/screen_panel.py +++ b/ks_includes/screen_panel.py @@ -59,6 +59,15 @@ class ScreenPanel: def home(self, widget): self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME) + def homexy(self, widget): + self._screen._ws.klippy.gcode_script(KlippyGcodes.HOME_XY) + + def z_tilt(self, widget): + self._screen._ws.klippy.gcode_script(KlippyGcodes.Z_TILT) + + def quad_gantry_level(self, widget): + self._screen._ws.klippy.gcode_script(KlippyGcodes.QUAD_GANTRY_LEVEL) + def menu_item_clicked(self, widget, panel, item): print("### Creating panel " + item['panel'] + " : %s %s" % (panel, item)) if "items" in item: diff --git a/panels/move.py b/panels/move.py index ac7f1399..70687ab2 100644 --- a/panels/move.py +++ b/panels/move.py @@ -39,6 +39,15 @@ class MovePanel(ScreenPanel): self.labels['home'] = self._gtk.ButtonImage("home", _("Home All"), "color4") self.labels['home'].connect("clicked", self.home) + self.labels['home-xy'] = self._gtk.ButtonImage("home", _("Home XY"), "color4") + self.labels['home-xy'].connect("clicked", self.homexy) + + self.labels['z_tilt'] = self._gtk.ButtonImage("z-tilt", _("Z Tilt"), "color4") + self.labels['z_tilt'].connect("clicked", self.z_tilt) + + self.labels['quad_gantry_level'] = self._gtk.ButtonImage("z-tilt", _("Quad Gantry Level"), "color4") + self.labels['quad_gantry_level'].connect("clicked", self.quad_gantry_level) + if self._screen.lang_ltr: grid.attach(self.labels['x+'], 2, 1, 1, 1) grid.attach(self.labels['x-'], 0, 1, 1, 1) @@ -52,6 +61,13 @@ class MovePanel(ScreenPanel): grid.attach(self.labels['home'], 0, 0, 1, 1) + if self._printer.config_section_exists("z_tilt"): + grid.attach(self.labels['z_tilt'], 2, 0, 1, 1) + elif self._printer.config_section_exists("quad_gantry_level"): + grid.attach(self.labels['quad_gantry_level'], 2, 0, 1, 1) + else: + grid.attach(self.labels['home-xy'], 2, 0, 1, 1) + distgrid = Gtk.Grid() j = 0 for i in self.distances: