-
Notifications
You must be signed in to change notification settings - Fork 5
/
Flap_stepper.cfg
95 lines (89 loc) · 2.67 KB
/
Flap_stepper.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
[manual_stepper flap_stepper]
step_pin: PE4
dir_pin: !PG0
enable_pin: !PG1
microsteps: 16
rotation_distance: 1150
velocity: 4000
accel: 85000
endstop_pin: PD7
[tmc2240 manual_stepper flap_stepper]
cs_pin: PF15
interpolate: false
run_current: 0.8
hold_current: 0.6
spi_software_mosi_pin: PB5
spi_software_miso_pin: PB4
spi_software_sclk_pin: PB3
[fan_generic exhaust_fan]
pin: PA3
[gcode_macro _SET_FLAP_ENABLED]
variable_enabled: 0
gcode:
{% set enabled=params.ENABLED|int %}
{% set flap_enabled=printer["gcode_macro _SET_FLAP_ENABLED"].enabled|int %}
{% if enabled!=flap_enabled %}
SET_GCODE_VARIABLE MACRO=_SET_FLAP_ENABLED VARIABLE=enabled VALUE={enabled}
{% if enabled==1 %}
MANUAL_STEPPER STEPPER=flap_stepper ENABLE=1
MANUAL_STEPPER STEPPER=flap_stepper MOVE=-255 STOP_ON_ENDSTOP=1 SPEED=30
MANUAL_STEPPER STEPPER=flap_stepper SET_POSITION=0
{% else %}
MANUAL_STEPPER STEPPER=flap_stepper MOVE=0
MANUAL_STEPPER STEPPER=flap_stepper ENABLE=0
{% endif %}
{% endif %}
[gcode_macro M106]
rename_existing: M106.1
gcode:
{% if params.P is defined %}
{% if params.P|int == 3 %}
{% if params.S is defined %}
{% if params.S|int == 255 %}
{% set realspeed = 1 %}
{% else %}
{% if params.S|int == 0 %}
{% set realspeed = 0 %}
{% else %}
{% set realspeed = params.S|float/255 %}
{% endif %}
{% endif %}
{% else %}
{% set realspeed = 1 %}
{% endif %}
SET_FAN_SPEED FAN=exhaust_fan SPEED={realspeed}
{% elif params.P|int == 1 %}
_SET_FLAP_ENABLED ENABLED=1
{% if params.S is defined %}
MANUAL_STEPPER STEPPER=flap_stepper MOVE={params.S} SYNC=0
{% else %}
MANUAL_STEPPER STEPPER=flap_stepper MOVE=255 SYNC=0
{% endif %}
{% else %}
M106.1 {rawparams}
{% endif %}
{% else %}
_SET_FLAP_ENABLED ENABLED=1
{% if params.S is defined %}
MANUAL_STEPPER STEPPER=flap_stepper MOVE={params.S} SYNC=0
{% else %}
MANUAL_STEPPER STEPPER=flap_stepper MOVE=255 SYNC=0
{% endif %}
{% endif %}
[gcode_macro M107]
rename_existing: M107.1
gcode:
{% if params.P is defined %}
{% if params.P|int == 3 %}
SET_FAN_SPEED FAN=exhaust_fan SPEED=0
{% elif params.P|int == 2 %}
M107.1 {rawparams}
{% elif params.P|int == 1 %}
MANUAL_STEPPER STEPPER=flap_stepper MOVE=0 SYNC=0
{% endif %}
{% else %}
SET_FAN_SPEED FAN=exhaust_fan SPEED=0
MANUAL_STEPPER STEPPER=flap_stepper MOVE=0 SYNC=0
_SET_FLAP_ENABLED ENABLED=0
M107.1 {rawparams}
{% endif %}