-
Notifications
You must be signed in to change notification settings - Fork 0
/
openpnp_macros.cfg
107 lines (88 loc) · 3.77 KB
/
openpnp_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
# OpenPNP Macros Configuration
[gcode_macro PICKUP_COMPONENT]
gcode:
G1 X{params.X|default(0)} Y{params.Y|default(0)} Z{params.Z|default(0)} F2000 ; Move to pickup location
M106 P0 S255 ; Turn on vacuum (adjust fan index if necessary)
[gcode_macro PLACE_COMPONENT]
gcode:
G1 X{params.X|default(0)} Y{params.Y|default(0)} Z{params.Z|default(0)} F2000 ; Move to placement location
M106 P0 S0 ; Turn off vacuum (adjust fan index if necessary)
[gcode_macro TOGGLE_VACUUM]
gcode:
{% if printer.fans.fan0.value == 0 %}
M106 P0 S255 ; Turn on vacuum (adjust fan index if necessary)
{% else %}
M106 P0 S0 ; Turn off vacuum (adjust fan index if necessary)
{% endif %}
[gcode_macro SET_PICKUP_OFFSET]
gcode:
SET_GCODE_VARIABLE MACRO=set_pickup_offset VARIABLE=X VALUE={params.X|default(0)}
SET_GCODE_VARIABLE MACRO=set_pickup_offset VARIABLE=Y VALUE={params.Y|default(0)}
SET_GCODE_VARIABLE MACRO=set_pickup_offset VARIABLE=Z VALUE={params.Z|default(0)}
[gcode_macro SET_PLACEMENT_OFFSET]
gcode:
SET_GCODE_VARIABLE MACRO=placement_offset VARIABLE=X VALUE={params.X|default(0)}
SET_GCODE_VARIABLE MACRO=placement_offset VARIABLE=Y VALUE={params.Y|default(0)}
SET_GCODE_VARIABLE MACRO=placement_offset VARIABLE=Z VALUE={params.Z|default(0)}
[gcode_macro APPLY_PICKUP_OFFSET]
gcode:
G1 X{printer.gcode_macro.pickup_offset.X} Y{printer.gcode_macro.pickup_offset.Y} Z{printer.gcode_macro.pickup_offset.Z} F2000
[gcode_macro APPLY_PLACEMENT_OFFSET]
gcode:
G1 X{printer.gcode_macro.placement_offset.X} Y{printer.gcode_macro.placement_offset.Y} Z{printer.gcode_macro.placement_offset.Z} F2000
[gcode_macro TOOL_CHANGE]
gcode:
G91 ; Relative positioning
G1 Z10 F300 ; Move Z axis up to avoid collision
G90 ; Absolute positioning
T{params.T} ; Change to the specified tool
G28 X Y ; Home X and Y axes after tool change
G1 Z0 F300 ; Move Z axis back to the work position
[gcode_macro BOTTOM_LED_OFF]
gcode:
SET_LED LED=bot_led RED=0 GREEN=0 BLUE=0
[gcode_macro BOTTOM_LED_ON]
gcode:
SET_LED LED=bot_led RED=1 GREEN=1 BLUE=1
[gcode_macro TOP_LED_OFF]
gcode:
SET_LED LED=top_led RED=0 GREEN=0 BLUE=0
[gcode_macro TOP_LED_ON]
gcode:
SET_LED LED=top_led RED=1 GREEN=1 BLUE=1
[gcode_macro SAFE_POSITION]
gcode:
G1 Z{params.Z|default(31)} F300 ; Move Z axis to a safe height
G1 X{params.X|default(0)} Y{params.Y|default(0)} F2000 ; Move to a safe X, Y position
[gcode_macro CALIBRATE_NOZZLE_HEIGHT]
gcode:
G1 X{params.X|default(0)} Y{params.Y|default(0)} F2000 ; Move to calibration point
G1 Z0 F300 ; Move Z axis to the bed
M114 ; Report current position
[gcode_macro PAUSE_JOB]
gcode:
M25 ; Pause SD card print (if applicable)
M601 ; Pause print
M0 ; Stop all motors
[gcode_macro RESUME_JOB]
gcode:
M24 ; Resume SD card print (if applicable)
M602 ; Resume print
[gcode_macro END_JOB]
gcode:
G91 ; Relative positioning
G1 Z31 F300 ; Move Z axis up to avoid collision
G90 ; Absolute positioning
G28 ; Home all axes
M84 ; Disable motors
[gcode_macro HOME_ALL]
gcode:
G28 Y ; Home Y axes
G28 Z ; Home Z axes
G91 ; Relative positioning
G1 Z31 F2000 ; Move Z axis up 31mm to avoid collision
G90 ; Absolute positioning
G28 X ; Home X
SET_KINEMATIC_POSITION A=0
SET_KINEMATIC_POSITION B=0
TOP_LED_ON