214 lines
3.5 KiB
INI
214 lines
3.5 KiB
INI
# Execute gcode when a button is pressed or released (or when a pin
|
|
# changes state). You can check the state of the button by using
|
|
# QUERY_BUTTON button=my_gcode_button
|
|
#
|
|
# Pinout SRK 1.3 EXP1
|
|
# +5V GND
|
|
# 1.23 1.22
|
|
# 1.21 1.20
|
|
# 1.19 1.18
|
|
# 0.28 1.30
|
|
#
|
|
|
|
|
|
#
|
|
# Button Unload
|
|
#
|
|
|
|
[gcode_button buttonUnload]
|
|
pin: ^P1.22
|
|
press_gcode:
|
|
{ printer.gcode.action_respond_info("Button 'Unload' pressed.") }
|
|
{% if printer[printer.toolhead.extruder].temperature > 190 %}
|
|
UNLOAD_FILAMENT
|
|
{% else %}
|
|
FLASH_NO
|
|
{% endif %}
|
|
release_gcode:
|
|
|
|
[output_pin led_unload]
|
|
pin: !P1.23
|
|
value: 1
|
|
shutdown_value: 1
|
|
|
|
|
|
#
|
|
# Button WarmUp
|
|
#
|
|
|
|
[gcode_button buttonWarmUp]
|
|
pin: ^P1.20
|
|
press_gcode:
|
|
{% if printer.heater_bed.target > 0 %}
|
|
{ printer.gcode.action_respond_info("Button 'WarmUp' pressed and cool down.") }
|
|
M141 S45
|
|
M140 S0
|
|
FLASH_NO
|
|
{% else %}
|
|
{ printer.gcode.action_respond_info("Button 'WarmUp' pressed and warm up.") }
|
|
M141 S50
|
|
M140 S100
|
|
FLASH_YES
|
|
{% endif %}
|
|
release_gcode:
|
|
|
|
[heater_fan led_warmup]
|
|
pin: !P1.21
|
|
heater: heater_bed
|
|
heater_temp: 50.0
|
|
fan_speed: 1.0
|
|
|
|
|
|
#
|
|
# Button Load
|
|
#
|
|
|
|
[gcode_button buttonLoad]
|
|
pin: ^P1.18
|
|
press_gcode:
|
|
{ printer.gcode.action_respond_info("Button 'Load' pressed.") }
|
|
{% if printer[printer.toolhead.extruder].temperature > 190 %}
|
|
{% if printer["gcode_macro LOAD_FILAMENT"].status > 0 %}
|
|
{ printer.gcode.action_respond_info("Purge Filament") }
|
|
M83
|
|
G91
|
|
G1 E20 F300
|
|
G90
|
|
M82
|
|
{% else %}
|
|
{ printer.gcode.action_respond_info("Load Filament") }
|
|
LOAD_FILAMENT
|
|
{% endif %}
|
|
{% else %}
|
|
FLASH_NO
|
|
{% endif %}
|
|
release_gcode:
|
|
|
|
[output_pin led_load]
|
|
pin: !P1.19
|
|
value: 0
|
|
shutdown_value: 1
|
|
|
|
|
|
#
|
|
# Button Light
|
|
#
|
|
|
|
[gcode_button buttonLight]
|
|
pin: ^P1.30
|
|
press_gcode:
|
|
{% if printer["output_pin case_light"].value > 0 %}
|
|
{ printer.gcode.action_respond_info("Button 'Light' pressed and switched light OFF.") }
|
|
LIGHT_OFF
|
|
{% else %}
|
|
{ printer.gcode.action_respond_info("Button 'Light' pressed and switched light ON.") }
|
|
LIGHT_ON
|
|
{% endif %}
|
|
release_gcode:
|
|
|
|
[output_pin led_light]
|
|
pin: !P0.28
|
|
value: 1
|
|
shutdown_value: 1
|
|
|
|
|
|
#
|
|
# Case Light
|
|
#
|
|
|
|
[output_pin case_light]
|
|
pin: z:P2.7
|
|
pwm: true
|
|
shutdown_value: 0
|
|
cycle_time: 0.01
|
|
scale: 255
|
|
|
|
|
|
#
|
|
# Filament Change
|
|
#
|
|
|
|
[gcode_macro UNLOAD_FILAMENT]
|
|
gcode:
|
|
M83
|
|
G91
|
|
G1 E10 F300
|
|
G1 E-320 F2100
|
|
G90
|
|
M82
|
|
SET_GCODE_VARIABLE MACRO=LOAD_FILAMENT VARIABLE=status VALUE=0
|
|
SET_PIN PIN=led_unload VALUE=0
|
|
SET_PIN PIN=led_load VALUE=1
|
|
|
|
[gcode_macro LOAD_FILAMENT]
|
|
variable_status: 1
|
|
gcode:
|
|
M83
|
|
G91
|
|
G1 E280 F2100
|
|
G1 E20 F300
|
|
G1 E20 F300
|
|
G90
|
|
M82
|
|
SET_GCODE_VARIABLE MACRO=LOAD_FILAMENT VARIABLE=status VALUE=1
|
|
SET_PIN PIN=led_unload VALUE=1
|
|
SET_PIN PIN=led_load VALUE=0
|
|
|
|
|
|
#
|
|
# Light Macros
|
|
#
|
|
|
|
[gcode_macro M355]
|
|
variable_light_before: 0
|
|
default_parameter_S: 0
|
|
default_parameter_P: 0
|
|
gcode:
|
|
SET_PIN PIN=case_light VALUE={S|float * P|float}
|
|
|
|
[gcode_macro LIGHT_ON]
|
|
gcode:
|
|
M355 S1 P255
|
|
|
|
[gcode_macro LIGHT_OFF]
|
|
gcode:
|
|
M355 S0 P0
|
|
|
|
[gcode_macro FLASH_YES]
|
|
gcode:
|
|
SET_GCODE_VARIABLE MACRO=M355 VARIABLE=light_before VALUE={printer["output_pin case_light"].value * 255}
|
|
M355 S0 P0
|
|
G4 P250
|
|
M355 S1 P64
|
|
G4 P250
|
|
M355 S0 P0
|
|
G4 P250
|
|
M355 S1 P64
|
|
G4 P250
|
|
M355 S0 P0
|
|
G4 P500
|
|
RESTORE_LIGHT
|
|
|
|
[gcode_macro FLASH_NO]
|
|
gcode:
|
|
SET_GCODE_VARIABLE MACRO=M355 VARIABLE=light_before VALUE={printer["output_pin case_light"].value * 255}
|
|
M355 S0 P0
|
|
G4 P250
|
|
M355 S1 P64
|
|
G4 P250
|
|
M355 S0 P0
|
|
G4 P250
|
|
M355 S1 P64
|
|
G4 P250
|
|
M355 S0 P0
|
|
G4 P250
|
|
M355 S1 P64
|
|
G4 P250
|
|
M355 S0 P0
|
|
G4 P500
|
|
RESTORE_LIGHT
|
|
|
|
[gcode_macro RESTORE_LIGHT]
|
|
gcode:
|
|
M355 S1 P{printer["gcode_macro M355"].light_before}
|