-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for output_pin and fan templates #6695
Conversation
@@ -476,6 +476,20 @@ enabled. | |||
`SET_FAN_SPEED FAN=config_name SPEED=<speed>` This command sets the | |||
speed of a fan. "speed" must be between 0.0 and 1.0. | |||
|
|||
`SET_FAN_SPEED PIN=config_name TEMPLATE=<template_name> | |||
[<param_x>=<literal>]`: If `TEMPLATE` is specified then it assigns a | |||
[display_template](Config_Reference.md#display_template) to the given |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps display_template
could get a secondary name of just template
?
It feels very confusing to be connecting an output pin / fan to a 'display_template' when the intent is to not display anything, but to have it all work in the background...
Maybe dynamic_variable
or dynamic_value
or something else might be a good secondary name. Just something that doesn't tie it specifically to a 'display' usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing.
I agree that display_template is a confusing name. Roughly I'd like to introduce something like macro_template
, make render()
always available from Jinja2, and deprecate display_template
. That change seems orthogonal though, so didn't want to complicate this PR with a config rename.
-Kevin
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
d32ea61
to
8f361a1
Compare
This PR adds support for specifying a math formula for output_pin and fan_generic objects. This works similarly to the "led template" support - one can specify a
[display_template my_template]
config section that contains a Jinja2 macro providing a formula, and that formula will then be evaluated periodically to determine the pin/fan setting to apply.The settings from the formula do not pass through the g-code command queue, so the updates are applied even during homing and other long running commands.
This should make it possible to define more flexible pin and fan control schemes.
-Kevin