mirror of https://github.com/Desuuuu/klipper.git
gcode_macro: Add support "x in printer" to templates
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
1c09a0935f
commit
d065787afc
|
@ -28,6 +28,12 @@ class GetStatusWrapper:
|
||||||
self.eventtime = self.printer.get_reactor().monotonic()
|
self.eventtime = self.printer.get_reactor().monotonic()
|
||||||
self.cache[sval] = res = dict(po.get_status(self.eventtime))
|
self.cache[sval] = res = dict(po.get_status(self.eventtime))
|
||||||
return res
|
return res
|
||||||
|
def __contains__(self, val):
|
||||||
|
try:
|
||||||
|
self.__getitem__(val)
|
||||||
|
except KeyError as e:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
# Wrapper around a Jinja2 template
|
# Wrapper around a Jinja2 template
|
||||||
class TemplateWrapper:
|
class TemplateWrapper:
|
||||||
|
|
|
@ -106,6 +106,12 @@ gcode:
|
||||||
M112
|
M112
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
[gcode_macro TEST_in]
|
||||||
|
gcode:
|
||||||
|
{% if "abc" in printer or "gcode" not in printer %}
|
||||||
|
M112
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Main test start point
|
# Main test start point
|
||||||
[gcode_macro TESTIT]
|
[gcode_macro TESTIT]
|
||||||
gcode:
|
gcode:
|
||||||
|
@ -113,3 +119,4 @@ gcode:
|
||||||
TEST_expression
|
TEST_expression
|
||||||
TEST_variable
|
TEST_variable
|
||||||
TEST_param T=123
|
TEST_param T=123
|
||||||
|
TEST_in
|
||||||
|
|
Loading…
Reference in New Issue