-
Notifications
You must be signed in to change notification settings - Fork 101
/
debug_macro.cfg
67 lines (63 loc) · 3.18 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
# Use:
# - DUMP_PARAMETER print all parameter expect configfile
# - DUMP_PARAMETER P='gcode_macro _TEST' print the defined parameter group
# - DUMP_PARAMETER C='printer' print the defined config values
# - DUMP_PARAMETER S='printer' print the defined settings values
[gcode_macro DUMP_PARAMETER]
description: Debug: Print entries of the printer object
gcode:
{% set config = True if params.C or params.S else False %}
{% set path = 'config' if params.C
else 'settings' if params.S %}
{% set search = params.C if params.C
else params.S if params.S
else params.P if params.P %}
{% set out = [] %}
{% for name1 in printer|sort %}
{% if config %} ; print the searched printer.configfile[path] parameter
{% if name1 is in ['configfile'] %}
{% for name2 in printer[name1][path]|sort %}
{% if name2 is in [search] %}
{% for name3, value in printer[name1][path][name2].items()|sort %}
{% set _dummy = out.append("printer.configfile.%s['%s'].%s = %s" %
(path, name2, name3, value)) %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{% for name2, value in printer[name1].items()|sort %} ; search for anything expext printer.configfile
{% if search is not defined and name1 is not in ['configfile'] %} ; print all printer. parameter
{% set _dummy = out.append("printer['%s'].%s = %s" % (name1, name2, value)) %}
{% elif search is defined and name1 is in [search] %} ; print the searched printer. parameter
{% set _dummy = out.append("printer['%s'].%s = %s" % (name1, name2, value)) %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% if out|length > 0 %}
{action_respond_info(out|join("\n"))}
{% else %}
{action_respond_info("Nothing found for \"DUMP_PARAMETER %s\"" % rawparams)}
{% endif %}
[gcode_macro DUMP_PRINT_AREA_LIMITS]
description: Debug: Print information about print volume and probeable area
gcode:
{% set min = printer.toolhead.axis_minimum %}
{% set max = printer.toolhead.axis_maximum %}
{% set probe_offset = {'x' : printer.configfile.settings.probe.x_offset,
'y' : printer.configfile.settings.probe.y_offset} %}
{% set probe_area = {'min' : {'x' : [min.x,(min.x-probe_offset.x)]|max,
'y' : [min.y,(min.y-probe_offset.y)]|max},
'max' : {'x' : [max.x,(max.x-probe_offset.x)]|min,
'y' : [max.y,(max.y-probe_offset.y)]|min}} %}
{action_respond_info("Print Volume Limits:
Min X:%7.1f, Y:%7.1f, Z:%7.1f
Max X:%7.1f, Y:%7.1f, Z:%7.1f
Probe Area Limits:
Min X:%7.1f, Y:%7.1f
Max X:%7.1f, Y:%7.1f" %
(min.x,min.y,min.z,max.x,max.y,max.z,probe_area.min.x,probe_area.min.y, probe_area.max.x,probe_area.max.y))}
#####################################################################
# Macros needed for several debug activities
#####################################################################