forked from zellneralex/klipper_config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_macro.cfg
100 lines (96 loc) · 3.97 KB
/
debug_macro.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#####################################################################
# Macros to debug the printer variable
#####################################################################
## Use:
## - DUMP_PARAMETERS
## - DUMP_PARAMETERS S='gcode_macro _TEST'
[gcode_macro DUMP_PARAMETERS]
description: Debug: Print all entries of the printer object
gcode:
{% set parameters = [] %}
{% for name1 in printer|sort %}
{% if 'S' in params %}
{% if name1 is in [params.S] %}
{% for name2 in printer[name1]|sort %}
{% set parameters = parameters.append("printer['%s'].%s = %s" % (name1, name2, printer[name1][name2])) %}
{% endfor %}
{% endif %}
{% else %}
{% if name1 is not in ['configfile'] %}
{% for name2 in printer[name1]|sort %}
{% set parameters = parameters.append("printer['%s'].%s = %s" % (name1, name2, printer[name1][name2])) %}
{% endfor %}
{% endif %}
{% endif %}
{% endfor %}
{% if parameters|length > 0 %}
{action_respond_info(parameters|join("\n"))}
{% else %}
{action_respond_info("Nothing found for \"%s\"" % params.S)}
{% endif %}
## Use:
## - DUMP_CONFIG S='printer'
[gcode_macro DUMP_CONFIG]
description: Debug: Print the selected entrie of the printer config object
gcode:
{% if 'S' in params %}
{% set parameters = [] %}
{% for name1 in printer.configfile.config %}
{% if name1 is in [params.S] %}
{% for name2 in printer.configfile.config[name1]|sort %}
{% set parameters = parameters.append("printer.configfile.config['%s'].%s = %s" % (name1, name2, printer.configfile.config[name1][name2])) %}
{% endfor %}
{% endif %}
{% endfor %}
{% if parameters|length > 0 %}
{action_respond_info(parameters|join("\n"))}
{% else %}
{action_respond_info("Nothing found for \"%s\"" % params.S)}
{% endif %}
{% else %}
{action_respond_info("WARNING: parameter S needed call e.g. DUMP_CONFIG S='printer'")}
{% endif %}
## Use:
## - DUMP_SETTINGS S='printer'
[gcode_macro DUMP_SETTINGS]
description: Debug: Print the selected entrie of the printer settings object
gcode:
{% if 'S' in params %}
{% set parameters = [] %}
{% for name1 in printer.configfile.settings %}
{% if name1 is in [params.S] %}
{% for name2 in printer.configfile.settings[name1]|sort %}
{% set parameters = parameters.append("printer.configfile.settings['%s'].%s = %s" % (name1, name2, printer.configfile.settings[name1][name2])) %}
{% endfor %}
{% endif %}
{% endfor %}
{% if parameters|length > 0 %}
{action_respond_info(parameters|join("\n"))}
{% else %}
{action_respond_info("Nothing found for \"%s\"" % params.S)}
{% endif %}
{% else %}
{action_respond_info("WARNING: parameter S needed call e.g. DUMP_SETTINGS S='printer'")}
{% endif %}
[gcode_macro DUMP_SETTINGS_ALL]
description: Debug: Print the selected entrie of the printer settings object
gcode:
{% set parameters = [] %}
{% for name1 in printer.configfile.settings %}
{% for name2 in printer.configfile.settings[name1]|sort %}
{% set parameters = parameters.append("printer.configfile.settings['%s'].%s = %s" % (name1, name2, printer.configfile.settings[name1][name2])) %}
{% endfor %}
{% endfor %}
{action_respond_info(parameters|join("\n"))}
#####################################################################
# Macros needed for several debug activities
#####################################################################
[gcode_macro DIRECT_MOVE]
gcode:
{% set out_param = ["G0"] %}
{% set _dummy = out_param.append("X%s" % params.X) if 'X' in params|upper %}
{% set _dummy = out_param.append("Y%s" % params.Y) if 'Y' in params|upper %}
{% set _dummy = out_param.append("Z%s" % params.Z) if 'Z' in params|upper %}
{% set _dummy = out_param.append("E%s" % params.E) if 'E' in params|upper %}
{% set _dummy = out_param.append("F%s" % params.F) if 'F' in params|upper %}
{out_param|join(" ")}