From b8c936f7b86013677fe3b4b59fcb6d626531a962 Mon Sep 17 00:00:00 2001 From: Timofey Titovets Date: Sun, 15 Mar 2026 22:40:42 +0100 Subject: [PATCH] gcode_button: ignore empty templates A bouncing button can generate a lot of pending G-code Each G-Code command will lock on the G-Code mutex Decrease pressure by ignoring empty G-Code requests Signed-off-by: Timofey Titovets --- klippy/extras/gcode_button.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/klippy/extras/gcode_button.py b/klippy/extras/gcode_button.py index de280c98b..5fe77540b 100644 --- a/klippy/extras/gcode_button.py +++ b/klippy/extras/gcode_button.py @@ -40,7 +40,10 @@ class GCodeButton: if not state: template = self.release_template try: - self.gcode.run_script(template.render()) + commands = template.render() + if not commands.strip(): + return + self.gcode.run_script(commands) except: logging.exception("Script running error")