diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-08-16 15:39:30 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-08-20 21:03:22 -0400 |
commit | b2c78d71b05690c68e4e48e6bba0c7bdebf8814d (patch) | |
tree | a7f10f1233727fb260990ad23e3d6122b81620f0 /docs | |
parent | 2caaaea9a4bdd55846cdcf24b0efba60bcdfbd51 (diff) | |
download | kutter-b2c78d71b05690c68e4e48e6bba0c7bdebf8814d.tar.gz kutter-b2c78d71b05690c68e4e48e6bba0c7bdebf8814d.tar.xz kutter-b2c78d71b05690c68e4e48e6bba0c7bdebf8814d.zip |
gcode: Remove "action_" commands from get_status() calls
Rename printer.gcode.action_emergency_stop() to
action_emergency_stop(), printer.gcode.action_respond_info() to
action_respond_info(), and printer.gcode.action_respond_error() to
action_raise_error() in command templates.
This simplifies the get_status() interface, as returning callable
functions from that interface was confusing.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/Command_Templates.md | 42 | ||||
-rw-r--r-- | docs/Config_Changes.md | 6 |
2 files changed, 27 insertions, 21 deletions
diff --git a/docs/Command_Templates.md b/docs/Command_Templates.md index e216a118..6d4c1adb 100644 --- a/docs/Command_Templates.md +++ b/docs/Command_Templates.md @@ -124,25 +124,8 @@ If the config section contains spaces in it, then one can access it via the `[ ]` accessor - for example: `printer["generic_heater my_chamber_heater"].temperature`. -Some printer objects allow one to alter the state of the printer. By -convention, these objects use an `action_` prefix. For example, -`printer.gcode.action_emergency_stop()` would cause the printer to go -into a shutdown state. These actions are taken at the time that the -macro is evaluated, which may be a significant amount of time before -the generated commands are executed. - The following are common printer attributes: - `printer.fan.speed`: The fan speed as a float between 0.0 and 1.0. -- `printer.gcode.action_respond_info(msg)`: Write the given `msg` to - the /tmp/printer pseudo-terminal. Each line of `msg` will be sent - with a "// " prefix. -- `printer.gcode.action_respond_error(msg)`: Write the given `msg` to - the /tmp/printer pseudo-terminal. The first line of `msg` will be - sent with a "!! " prefix and subsequent lines will have a "// " - prefix. -- `printer.gcode.action_emergency_stop(msg)`: Transition the printer - to a shutdown state. The `msg` parameter is optional, it may be - useful to describe the reason for the shutdown. - `printer.gcode.gcode_position`: The current position of the toolhead relative to the current G-Code origin. It is possible to access the x, y, z, and e components of this position (eg, @@ -194,6 +177,26 @@ attributes may be available (via `get_status()` methods defined in the software). However, undocumented attributes may change without notice in future Klipper releases. +### Actions + +There are some commands available that can alter the state of the +printer. For example, `{ action_emergency_stop() }` would cause the +printer to go into a shutdown state. Note that these actions are taken +at the time that the macro is evaluated, which may be a significant +amount of time before the generated g-code commands are executed. + +Available "action" commands: +- `action_respond_info(msg)`: Write the given `msg` to the + /tmp/printer pseudo-terminal. Each line of `msg` will be sent with a + "// " prefix. +- `action_raise_error(msg)`: Abort the current macro (and any calling + macros) and write the given `msg` to the /tmp/printer + pseudo-terminal. The first line of `msg` will be sent with a "!! " + prefix and subsequent lines will have a "// " prefix. +- `action_emergency_stop(msg)`: Transition the printer to a shutdown + state. The `msg` parameter is optional, it may be useful to describe + the reason for the shutdown. + ### Variables The SET_GCODE_VARIABLE command may be useful for saving state between @@ -267,11 +270,8 @@ the gcode option: [delayed_gcode report_temp] initial_duration: 2. gcode: - {printer.gcode.action_respond_info( - "Extruder Temp: %.1f" % - (printer.extruder0.temperature))} + {action_respond_info("Extruder Temp: %.1f" % (printer.extruder0.temperature))} UPDATE_DELAYED_GCODE ID=report_temp DURATION=2 - ``` The above delayed_gcode will send "// Extruder Temp: [ex0_temp]" to diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md index b92cf5a2..e0cc4c03 100644 --- a/docs/Config_Changes.md +++ b/docs/Config_Changes.md @@ -6,6 +6,12 @@ All dates in this document are approximate. # Changes +20200816: The gcode macro "action_" system has changed. Replace any +calls to `printer.gcode.action_emergency_stop()` with +`action_emergency_stop()`, `printer.gcode.action_respond_info()` with +`action_respond_info()`, and `printer.gcode.action_respond_error()` +with `action_raise_error()`. + 20200809: The menu system has been rewritten. If the menu has been customized then it will be necessary to update to the new configuration. See config/example-menu.cfg for configuration details |