From 48aa50332e92ff0eadf07a55510dd6c3a0b01116 Mon Sep 17 00:00:00 2001 From: Alfredo Monclus Date: Mon, 25 Nov 2024 10:08:00 -0300 Subject: [PATCH] refactor: add and use available commands for z_tilt and quad_level close #1512 --- config/move_menu.conf | 4 ++-- docs/Configuration.md | 1 + ks_includes/printer.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config/move_menu.conf b/config/move_menu.conf index b34d4bde..e8521d76 100644 --- a/config/move_menu.conf +++ b/config/move_menu.conf @@ -42,7 +42,7 @@ name: {{ gettext('Quad Gantry Level') }} icon: home-z method: printer.gcode.script params: {"script":"QUAD_GANTRY_LEVEL"} -enable: {{ 'quad_gantry_level' in printer.config_sections }} +enable: {{ 'QUAD_GANTRY_LEVEL' in printer.available_commands }} active: {{ printer.quad_gantry_level.applied }} [menu move homing Z-Tilt] @@ -50,5 +50,5 @@ name: {{ gettext('Z Tilt') }} icon: z-tilt method: printer.gcode.script params: {"script":"Z_TILT_ADJUST"} -enable: {{ 'z_tilt' in printer.config_sections }} +enable: {{ 'Z_TILT_ADJUST' in printer.available_commands }} active: {{ printer.z_tilt.applied }} \ No newline at end of file diff --git a/docs/Configuration.md b/docs/Configuration.md index 051ee6ca..554d360d 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -210,6 +210,7 @@ printer.gcode_macros.count # Number of gcode macros printer.gcode_macros.list # List of names of the gcode macros printer.leds.count # Number of leds printer.config_sections # Array of section headers of Klipper config (printer.cfg) +printer.available_commands # List of all the commands that the printer supports ``` diff --git a/ks_includes/printer.py b/ks_includes/printer.py index a5d1ec89..fa46e805 100644 --- a/ks_includes/printer.py +++ b/ks_includes/printer.py @@ -260,6 +260,7 @@ class Printer: "homed_axes": self.get_stat("toolhead", "homed_axes"), "quad_gantry_level": self.get_stat("quad_gantry_level"), "z_tilt": self.get_stat("z_tilt"), + "available_commands": self.available_commands, } }