Documentation for last_position, pause_position, cancel_position

This commit is contained in:
Gina Häußge 2016-11-23 17:41:58 +01:00
parent ccf77a5dae
commit daeb3dbc91

View file

@ -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 <sec-features-gcode_scripts-predefined>` are also called with the following additional
template variables: