-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow layer definitions to be processed as templates (#173)
* Allow layer definitions to be processed as templates This commit adds the ability to process the layer definitions as Jinja2 templates just like any other Klipper macro. All of the normal objects available to macros are also available to layers. As an example, the following layer definition: [led_effect test1] autostart: false heater: extruder leds: neopixel:case_lights layers: {% set min_temp = printer.configfile.settings.extruder.min_extrude_temp %} heater {min_temp} 0 add (1,0,0) will result in the following layer being defined: heater 170.0 0 add (1,0,0) Layers are then processed as normal. It is also possible to have layers be re-evaluated when an effect is enabled. This has the benefit of using the current printer state. However, it will use CPU cycles to re-compute the layers. Signed-off-by: Mitko Haralanov <[email protected]> * Allow passing of effect parameters with SET_LED_EFFECT This commit adds the ability to pass parameters to the LED effects through the SET_LED_EFFECT command. If an effect is defined as `dynamic` (which re-evaluates the layers template each time the event is activated), the SET_LED_EFFECT command can now pass parameters to the template just like GCode macros can. This mechanism allow for the effect to be changed dynamically. In fact, it could provide a way for definiting dynamic effects. Signed-off-by: Mitko Haralanov <[email protected]> --------- Signed-off-by: Mitko Haralanov <[email protected]>
- Loading branch information
1 parent
65e5c4a
commit 74a67a4
Showing
3 changed files
with
106 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters