You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Allow the use of custom Python functions in your Klipper macros by defining the functions in a YAML config file
4
+
* By default includes many additional modules and functions. See below for more information.
4
5
* Functions can accept parameters and return values to the macro.
5
6
6
7
### WARNING:
7
8
8
9
**Do not blindly download Python scripts, both for use in your macros and this script itself.** Read the script and ensure you understand what is going on. The scripts can be powerful and useful, but they can also be dangerous. If the script looks questionable, dangerous, or too confusing, it's better to assume that it is malicious.
9
10
10
11
**Installation:**
11
-
1. Clone this repository or download both `extended_macro.py` and `extended_template.py`
12
-
2. Locate where the `klippy-env` directory is on your Klipper instance.
13
-
3. Run the following command, substituting `~/klippy-env/` with the location found above:
12
+
1. Write down the location of the following directories:
13
+
* Klipper Extras: Usually located at `/home/USER/klipper/klippy/extras`.
14
+
* Klippy Virtual Environment `bin` directory: Usually located at `/home/USER/klippy/bin`
15
+
2. Clone this repository or download `extended_macro.py`, `extended_template.py`, and `requirements.txt`
16
+
3. Move `extended_macro.py` and `extended_template.py` to your Klipper Extras folder.
17
+
4. Move `requirements.txt` to your home directory.
18
+
5. Run the following command, substituting `${KLIPPY_ENV}` with the Klippy Virtual Environment bin directory:
1. In your Klipper config, add the following section:
28
+
```
29
+
[extended_template]
30
+
```
31
+
32
+
---
33
+
**Adding your own Python functions**
34
+
35
+
*See the examples folder for more guidance.*
36
+
23
37
1. Create your Python script(s) with the function(s) you intend to use.
24
38
2. Create a function configuration file using `example/function_config.yaml` as reference. YAML is the allowed schema. The extension must be `yml` or `yaml`
25
39
3. In your Klipper config, add the `[extended_template]` section to define the location of your function config file.
@@ -29,4 +43,41 @@ See the examples folder for more guidance.
29
43
30
44
See the examples folder for more guidance.
31
45
32
-
When defining the macro, use `extended_macro` as the config name instead of `gcode_macro`. To use your function, you will wrap the name with curly brackets (`{gcode_function_name_goes_here}`).
46
+
When defining the macro, use `extended_macro` as the config name instead of `gcode_macro`. To use your function, you will wrap the name with curly brackets (`{gcode_function_name_goes_here}`).
47
+
48
+
---
49
+
**Defaults**
50
+
51
+
`extended_macro` comes with many default functions which do not need to be added or declared by the user. These include:
0 commit comments