-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdancing_bed_printer.cfg
125 lines (100 loc) · 4.73 KB
/
dancing_bed_printer.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
123
124
125
#Temporarily replace printer.cfg with this .cfg to enable bed dancing
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f072xb_2E004A001057464E35393120-if00
[printer]
kinematics: none
max_velocity: 10
max_acceL: 1000
[respond]
[gcode_macro DANCE_BED]
description: Dance bed around by moving z motors independently
gcode:
## User defineable parameters
{% set displacement = params.MAX_DISPLACEMENT|default(15)|int %}
{% set velocity = params.VELOCITY|default(30)|int %}
{% set acceleration = params.ACCELERATION|default(120)|int %}
## Determine time it takes to complete a cycle on one motor
{% set cycleTime = 0 %}
{% if velocity * velocity / acceleration <= displacement %}
{% set cycleTime = 2 * (displacement/velocity + velocity/acceleration) %}
{% else %}
RESPOND TYPE=error MSG="Acceleration is too low for requested displacement"
{% endif %}
{% if cycleTime != 0 %}
SET_VIRTUAL_HOME
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE=3.3 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE=6.6 SYNC=1
G4 P2000
## Start motors moving
MANUAL_STEPPER STEPPER=stepper_z SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z SPEED={velocity} ACCEL={acceleration} MOVE={displacement} SYNC=0
MANUAL_STEPPER STEPPER=stepper_z SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z1 SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
MANUAL_STEPPER STEPPER=stepper_z2 SPEED={velocity} ACCEL={acceleration} MOVE=0 SYNC=0
{% endif %}
[gcode_macro SET_VIRTUAL_HOME]
gcode:
MANUAL_STEPPER STEPPER=stepper_z SET_POSITION=0
MANUAL_STEPPER STEPPER=stepper_z1 SET_POSITION=0
MANUAL_STEPPER STEPPER=stepper_z2 SET_POSITION=0
[manual_stepper stepper_z]
step_pin: PA15
dir_pin: !PA14
enable_pin: !PA13
microsteps: 64
rotation_distance: 32
full_steps_per_rotation: 200
velocity: 10
accel: 1000
[tmc2209 manual_stepper stepper_z]
uart_pin: PC10
interpolate: False
run_current: 0.3
stealthchop_threshold: 999999
[manual_stepper stepper_z1]
step_pin: PC14
dir_pin: !PC13
enable_pin: !PC15
microsteps: 64
rotation_distance: 32
full_steps_per_rotation: 200
velocity: 10
accel: 1000
[tmc2209 manual_stepper stepper_z1]
uart_pin: PB7
interpolate: False
run_current: 0.3
stealthchop_threshold: 999999
[manual_stepper stepper_z2]
step_pin: PC12
dir_pin: PB5
enable_pin: !PC11
microsteps: 64
rotation_distance: 32
full_steps_per_rotation: 200
velocity: 10
accel: 1000
[tmc2209 manual_stepper stepper_z2]
uart_pin: PB6
interpolate: False
run_current: 0.3
stealthchop_threshold: 999999