From 0b9d545c6f7510806dfdbb5c7da65ba2ed72f548 Mon Sep 17 00:00:00 2001 From: Christian Kvasny Date: Sat, 18 Dec 2021 15:38:33 +0100 Subject: [PATCH] add speed as parameter to UN/LOAD_FILAMENT macro (#359) * Configurable xy position for z-calibrate added * fix coding style * Z probe calibrate option added * add speed as parameter for UN/LOAD_FILAMENT macro * add macros.md to docs * update description * change macros-md fix format Co-authored-by: jordanruthe <31575189+jordanruthe@users.noreply.github.com> --- docs/index.md | 2 ++ docs/macros.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ panels/extrude.py | 4 ++-- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 docs/macros.md diff --git a/docs/index.md b/docs/index.md index 56fd02b9..cd910489 100644 --- a/docs/index.md +++ b/docs/index.md @@ -19,6 +19,8 @@ Job Status ![Job Status](img/job_status.png) [More](panels.md) +### Supported Macros +[More](macros.md) ### Inspiration KlipperScreen was inspired by [OctoScreen](https://github.com/Z-Bolt/OctoScreen/) and the need for a touchscreen GUI that diff --git a/docs/macros.md b/docs/macros.md new file mode 100644 index 00000000..bb892f64 --- /dev/null +++ b/docs/macros.md @@ -0,0 +1,44 @@ +# Supported Macros +Klipperscreen supports gcode_macros in various panels. + +## Extrude Panel + +### LOAD_FILAMENT / UNLOAD_FILAMENT +Load and Unload Filament macro is used in the Extrude-Panel if it is available. +The selected speed is transferred to this macro. +The following example macros show how this can be used in the macro. + +``` +[gcode_macro LOAD_FILAMENT] +gcode: + {% set speed = params.SPEED|default(500) %} + G91 + G1 E50 F{speed} + G1 E50 F{speed} + G92 +``` +``` +[gcode_macro UNLOAD_FILAMENT] +gcode: + {% set speed = params.SPEED|default(500) %} + G91 + G1 E-50 F{speed} + G1 E-50 F{speed} + G92 +``` + +this could be interesting to tweak the purge speed, this would be one Example Macro from alfrix: + +``` +[gcode_macro LOAD_FILAMENT] +gcode: + {% set speed = params.SPEED|default(300) %} + {% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity %} + M300 # beep + G91 + G92 E0 + G1 E350 F{max_velocity} + G1 E25 F{speed} #purge + M300 + M300 +``` diff --git a/panels/extrude.py b/panels/extrude.py index e5c06472..3e77aee4 100644 --- a/panels/extrude.py +++ b/panels/extrude.py @@ -178,12 +178,12 @@ class ExtrudePanel(ScreenPanel): if not found: self._screen.show_popup_message("Macro UNLOAD_FILAMENT not found") else: - self._screen._ws.klippy.gcode_script("UNLOAD_FILAMENT") + self._screen._ws.klippy.gcode_script("UNLOAD_FILAMENT SPEED=" + str(int(self.speed) * 60)) if dir == "+": if not found: self._screen.show_popup_message("Macro LOAD_FILAMENT not found") else: - self._screen._ws.klippy.gcode_script("LOAD_FILAMENT") + self._screen._ws.klippy.gcode_script("LOAD_FILAMENT SPEED=" + str(int(self.speed) * 60)) def find_gcode_macros(self): macros = self._screen.printer.get_gcode_macros()