From daeb3dbc910edc3657d8fe5aab540b7f6a609e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 23 Nov 2016 17:41:58 +0100 Subject: [PATCH] Documentation for last_position, pause_position, cancel_position --- docs/features/gcode_scripts.rst | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/features/gcode_scripts.rst b/docs/features/gcode_scripts.rst index 86b7d8c2..579edbdf 100644 --- a/docs/features/gcode_scripts.rst +++ b/docs/features/gcode_scripts.rst @@ -60,9 +60,36 @@ All GCODE scripts have access to the following template variables through the te * ``printer_profile``: The currently selected Printer Profile, including information such as the extruder count, the build volume size, the filament diameter etc. + * ``last_position``: Last position reported by the printer via `M114` (might be unset if no `M114` was sent so far!) * ``script``: An object wrapping the script's type (``gcode``) and name (e.g. ``afterPrintCancelled``) as ``script.type`` and ``script.name`` respectively. +There are a couple of additional template variables available for the following specific scripts: + + * ``afterPrintPaused`` and ``beforePrintResumed`` + * ``pause_position``: Position reported by the printer via ``M114`` immediately before the print was paused. Consists + of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and current tool + ``t`` taken from commands sent through OctoPrint. + * ``afterPrintCancelled`` + * ``cancel_position``: Position reported by the printer via ``M114`` immediately before the print was cancelled. + Consists of ``x``, ``y``, ``z`` and ``e`` coordinates as received by the printer and tracked values for ``f`` and + current tool ``t`` taken from commands sent through OctoPrint. + +.. warning:: + + Note that current firmware implementations only report back one ``E`` value, the current extrusion value for the current + extruder. Retrieving all ``E`` values by cycling through all extruders on pause and cancel is something OctoPrint + currently does NOT do since it would simply take too long. That means that if you want to write a ``beforePrintResumed`` + script that basically resets everything back to the point when the printer was paused *and* you are running with + multiple extruders, you'll have to find some other way to have your ``E`` values set correctly for all your available + extruders - the data available in ``pause_position`` will *not* suffice. Additionally, most firmwares don't report + the currently selected tool in the ``M114`` response, meaning that the only way OctoPrint can keep track of that is + by tracking it itself. Same goes for the current feed rate ``F``. So if you are printing from SD, this data will be + *wrong*. This is also the reason why OctoPrint currently doesn't bundle a more sophisticated pause and resume script + that would actually move the print head out of the way and pause and back to the original position on resume - it + might cause issues for the multitude of users out there with multi-extruder setups or for people printing from the + printer's SD, thanks to the lack of information the firmware provides. + The :ref:`predefined GCODE scripts ` are also called with the following additional template variables: