-
Notifications
You must be signed in to change notification settings - Fork 0
/
luxuri_macros.cfg
122 lines (106 loc) · 3.74 KB
/
luxuri_macros.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
[gcode_macro SET_RETRACTION]
description:
rename_existing: BASE_SET_RETRACTION
gcode:
BASE_SET_RETRACTION {rawparams}
GET_RETRACTION
[gcode_macro SET_VELOCITY_LIMIT]
description: Auto-report velocity limits when set
rename_existing: BASE_SET_VELOCITY_LIMIT
gcode:
{% if rawparams %}
BASE_SET_VELOCITY_LIMIT {rawparams}
{% endif %}
BASE_SET_VELOCITY_LIMIT ;No params reports velocity limits
[delayed_gcode get_speed_factor]
gcode:
;description: Report speed factor
{% set sf = (printer.gcode_move.speed_factor*100)|int %}
RESPOND TYPE=command MSG="speed_factor: {sf}"
[gcode_macro M503]
description: Output current settings
gcode:
{% set bed_center = "155,155" %}
{% set screws = (printer.configfile.config.bed_screws) %}
{ action_respond_info('screw1: %s\nscrew2: %s\nscrew3: %s\nscrew4: %s\nbed_center: %s' % (screws.screw1,screws.screw2,screws.screw3,screws.screw4,bed_center)) }
[gcode_macro M220]
description: Auto-report speed factor when set
rename_existing: M220.1
gcode:
{% if params.S %}
M220.1 {rawparams}
{% endif %}
{% set sf = (printer.gcode_move.speed_factor*100)|int %}
UPDATE_DELAYED_GCODE ID=get_speed_factor DURATION=.1
[delayed_gcode get_extrude_factor]
gcode:
{% set ef = (printer.gcode_move.extrude_factor*100)|int %}
RESPOND TYPE=command MSG="extrude_factor: {ef}"
[gcode_macro M221]
rename_existing: M221.1
gcode:
{% if params.S %}
{% set s = params.S|int %}
M221.1 { rawparams }
{% endif %}
UPDATE_DELAYED_GCODE ID=get_extrude_factor DURATION=.1
[gcode_macro M117]
rename_existing: M117.1
gcode:
{% if rawparams %}
{% set escaped_msg = rawparams.split(';', 1)[0].split('\x23', 1)[0]|replace('"', '\\"') %}
SET_DISPLAY_TEXT MSG="{escaped_msg}"
RESPOND TYPE=command MSG="M117: {escaped_msg}"
{% else %}
SET_DISPLAY_TEXT
{% endif %}
[gcode_macro M27]
rename_existing: M27.1
gcode:
{% if printer.pause_resume.is_paused %}
{ action_respond_info('Print Paused') }
{% else %}
M27.1
{% endif %}
[gcode_macro M31]
gcode:
{% set elapsed = printer.print_stats.total_duration %}
{% if elapsed %}
{% set hours = (elapsed // 3600) %}
{% set minutes = ((elapsed % 3600) // 60) %}
{% set seconds = (elapsed % 60) %}
{ action_respond_info("Print Time: %dh %dm %ds" % ( hours, minutes, seconds)) }
{% else %}
{ action_respond_info("No active print") }
{% endif %}
[gcode_macro SEARCH_VARS]
gcode:
{% set search = params.S|lower %}
{% set ns = namespace() %}
{% for item in printer %}
{% if ' ' in item %}
{% set ns.path = ['printer', "['%s']" % (item), ''] %}
{% else %}
{% set ns.path = ['printer.', item, ''] %}
{% endif %}
{% if search in ns.path|lower %}
{ action_respond_info(ns.path|join) }
{% endif %}
{% if printer[item].items() %}
{% for childkey, child in printer[item].items() recursive %}
{% set ns.path = ns.path[:loop.depth|int + 1] %}
{% if ' ' in childkey %}
{% set null = ns.path.append("['%s']" % (childkey)) %}
{% else %}
{% set null = ns.path.append(".%s" % (childkey)) %}
{% endif %}
{% if child is mapping %}
{ loop(child.items()) }
{% else %}
{% if search in ns.path|lower %}
{ action_respond_info("%s : %s" % (ns.path|join, child)) }
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}