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 <nefelim4ag@gmail.com>
This commit is contained in:
Timofey Titovets authored and KevinOConnor committed 2026-04-09 12:12:10 -04:00
1 parent f3db41c637
commit b8c936f7b8
1 file changed
+4 -1
+4 -1
View File
@@ -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")