238 lines
8.1 KiB
INI
238 lines
8.1 KiB
INI
#####################################################################
|
|
# Macros
|
|
#####################################################################
|
|
|
|
[gcode_macro CENTER]
|
|
gcode:
|
|
G0 X175 Y175 Z30 F3600
|
|
|
|
[gcode_macro G32]
|
|
gcode:
|
|
SAVE_GCODE_STATE NAME=STATE_G32
|
|
G90
|
|
G28
|
|
QUAD_GANTRY_LEVEL
|
|
G28
|
|
|
|
## Uncomment for for your size printer:
|
|
#--------------------------------------------------------------------
|
|
## Uncomment for 250mm build
|
|
#G0 X125 Y125 Z30 F3600
|
|
|
|
## Uncomment for 300 build
|
|
#G0 X150 Y150 Z30 F3600
|
|
|
|
## Uncomment for 350mm build
|
|
G0 X175 Y175 Z30 F3600
|
|
#--------------------------------------------------------------------
|
|
RESTORE_GCODE_STATE NAME=STATE_G32
|
|
|
|
|
|
[gcode_macro PRINT_START]
|
|
# Use PRINT_START for the slicer starting script - please customise for your slicer of choice
|
|
gcode:
|
|
start_tones
|
|
BED_MESH_CLEAR
|
|
G32 ; home all axes
|
|
BED_MESH_PROFILE LOAD=default
|
|
G90
|
|
G0 X175 Y175 Z30 F3600 ; move nozzle away from bed
|
|
|
|
[gcode_macro PRINT_END]
|
|
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
|
|
gcode:
|
|
M400 ; wait for buffer to clear
|
|
G92 E0 ; zero the extruder
|
|
G1 E-5 F1800 ; retract filament
|
|
G91 ; relative positioning
|
|
G0 Z1.00 X20.0 Y20.0 F20000 ; move nozzle to remove stringing
|
|
TURN_OFF_HEATERS
|
|
M107 ; turn off fan
|
|
G1 Z2 F3000 ; move nozzle up 2mm
|
|
G90 ; absolute positioning
|
|
G0 X125 Y250 F3600 ; park nozzle at rear
|
|
BED_MESH_CLEAR
|
|
end_tones
|
|
|
|
[delayed_gcode _SET_CASELIGHT_OFF]
|
|
gcode:
|
|
SET_CASELIGHT_OFF
|
|
|
|
[gcode_macro SET_CASELIGHT_ON]
|
|
description: Turn on the caselight LEDs
|
|
gcode:
|
|
SET_PIN PIN=caselight VALUE=1
|
|
|
|
[gcode_macro SET_CASELIGHT_OFF]
|
|
description: Turn off the caselight LEDs
|
|
gcode:
|
|
SET_PIN PIN=caselight VALUE=0
|
|
|
|
[gcode_macro TOGGLE_CASELIGHT]
|
|
description: Switch caselight on/off
|
|
gcode:
|
|
{% set status = printer['output_pin caselight'].value | float %}
|
|
{% if status == 0 %}
|
|
SET_CASELIGHT_ON
|
|
{% else %}
|
|
SET_CASELIGHT_OFF
|
|
{% endif %}
|
|
|
|
[gcode_macro WAKEUP]
|
|
gcode:
|
|
SET_CASELIGHT_ON
|
|
UNDERGLOW_SET RED=255 GREEN=0 BLUE=0
|
|
START_TEMP_MONITOR
|
|
STATUS_READY
|
|
|
|
[gcode_macro SLEEP]
|
|
gcode:
|
|
M84
|
|
M107
|
|
STOP_TEMP_MONITOR
|
|
TURN_OFF_HEATERS
|
|
SET_CASELIGHT_OFF
|
|
UPDATE_DELAYED_GCODE ID=_DISABLE_COOLING DURATION=300
|
|
UPDATE_DELAYED_GCODE ID=_DISABLE_EXHAUST DURATION=300
|
|
SET_FAN_SPEED FAN=chamber_fan SPEED=0
|
|
STATUS_OFF
|
|
|
|
[delayed_gcode _TEMP_MONITOR]
|
|
initial_duration: 60.0
|
|
gcode:
|
|
{% set mcu_target = 40 %}
|
|
{% set host_target = 55 %}
|
|
{% set encl_target = 60 %}
|
|
{% set verbose = False %}
|
|
{% set period = 60 %}
|
|
{% set default_speed = 0.5 %}
|
|
{% set printing_speed = 0.25 %}
|
|
{% set max_speed = 1.0 %}
|
|
{% set min_speed = 0.0 %}
|
|
{% set threshold = 1.1 %}
|
|
|
|
{% set mcu = printer['temperature_sensor Mcu_temp'].temperature | float %}
|
|
# {% set encl = printer['temperature_sensor enclosure_temp'].temperature | float %}
|
|
{% set encl = 0 | float %}
|
|
{% set host = printer['temperature_sensor Host_temp'].temperature | float %}
|
|
|
|
{% if verbose %}
|
|
{ action_respond_info("Entering Temp Montor routine") }
|
|
{ action_respond_info("Printer state %s" % printer.idle_timeout.state) }
|
|
{% endif %}
|
|
|
|
{% if printer.idle_timeout.state == 'Printing' %}
|
|
{% set min_speed = printing_speed %}
|
|
{% endif %}
|
|
|
|
{% if printer.idle_timeout.state != 'Idle' %}
|
|
|
|
{% if mcu > (mcu_target * threshold) or host > (host_target * threshold) %}
|
|
{% if verbose %}
|
|
{ action_respond_info("MCU/Host temp (%.1f/%.1f) exceeds max fan threshold (%.1f/%.1f), setting cooling to %.0f%%" % (mcu, host, mcu_target*threshold,host_target * threshold,max_speed*100)) }
|
|
{% endif %}
|
|
SET_FAN_SPEED FAN=cooling_fan SPEED={max_speed}
|
|
{% elif mcu > mcu_target or host > host_target %}
|
|
{% if verbose %}
|
|
{ action_respond_info("MCU/Host temp (%.1f/%.1f) above target temp (%.1f/%.1f), setting cooling to %.0f%%" % (mcu, host, mcu_target, host_target,default_speed*100)) }
|
|
{% endif %}
|
|
SET_FAN_SPEED FAN=cooling_fan SPEED={default_speed}
|
|
{% else %}
|
|
{% if verbose %}
|
|
{ action_respond_info("MCU/Host (%.1f/%.1f) temp below target temp (%.1f,%.1f) while %s, setting cooling to %.0f%%" % (mcu, host, mcu_target, host_target,printer.idle_timeout.state,min_speed*100)) }
|
|
{% endif %}
|
|
SET_FAN_SPEED FAN=cooling_fan SPEED={min_speed}
|
|
{% endif %}
|
|
|
|
# {% if encl > (encl_target * threshold) %}
|
|
# {% if verbose %}
|
|
# { action_respond_info("Enclosure temp (%.1f) exceeds max fan threshold (%.1f), setting exhaust to %.0f%%" % (encl, encl_target * threshold,max_speed*100)) }
|
|
# {% endif %}
|
|
# SET_FAN_SPEED FAN=exhaust_fan SPEED={max_speed}
|
|
# {% elif encl > encl_target %}
|
|
# {% if verbose %}
|
|
# { action_respond_info("Enclosure temp (%.1f) above target temp (%.1f), setting exhaust to %.0f%%" % (encl, encl_target,default_speed*100)) }
|
|
# {% endif %}
|
|
# SET_FAN_SPEED FAN=exhaust_fan SPEED={default_speed}
|
|
# {% else %}
|
|
# {% if verbose %}
|
|
# { action_respond_info("Enclosure temp (%.1f) below target temp (%.1f), setting exhaust to %.0f%%" % (encl, encl_target,min_speed*100)) }
|
|
# {% endif %}
|
|
# SET_FAN_SPEED FAN=exhaust_fan SPEED={min_speed}
|
|
# {% endif %}
|
|
{% else %}
|
|
{% if verbose %}
|
|
{ action_respond_info("Printer idle, skipping temperature checks. MCU: %.1f, Host: %.1f, Enclosure: %.1f." % (mcu, host, encl )) }
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if verbose %}
|
|
{ action_respond_info("Exiting Temp Montor routine") }
|
|
{% endif %}
|
|
|
|
UPDATE_DELAYED_GCODE ID=_TEMP_MONITOR DURATION={period}
|
|
|
|
[gcode_macro START_TEMP_MONITOR]
|
|
gcode:
|
|
UPDATE_DELAYED_GCODE ID=_TEMP_MONITOR DURATION=1
|
|
|
|
[gcode_macro STOP_TEMP_MONITOR]
|
|
gcode:
|
|
UPDATE_DELAYED_GCODE ID=_TEMP_MONITOR DURATION=0
|
|
|
|
######################################################################
|
|
# Beeper
|
|
######################################################################
|
|
|
|
# M300 : Play tone. Beeper support, as commonly found on usual LCD
|
|
# displays (i.e. RepRapDiscount 2004 Smart Controller, RepRapDiscount
|
|
# 12864 Full Graphic). This defines a custom I/O pin and a custom
|
|
# GCODE macro. Usage:
|
|
# M300 [P<ms>] [S<Hz>]
|
|
# P is the tone duration, S the tone frequency.
|
|
# The frequency won't be pitch perfect.
|
|
|
|
[output_pin BEEPER_pin]
|
|
pin: PC9
|
|
# Beeper pin. This parameter must be provided.
|
|
# ar37 is the default RAMPS/MKS pin.
|
|
pwm: True
|
|
# A piezo beeper needs a PWM signal, a DC buzzer doesn't.
|
|
value: 0
|
|
# Silent at power on, set to 1 if active low.
|
|
shutdown_value: 0
|
|
# Disable at emergency shutdown (no PWM would be available anyway).
|
|
cycle_time: 0.001
|
|
# Default PWM frequency : 0.001 = 1ms will give a tone of 1kHz
|
|
# Although not pitch perfect.
|
|
|
|
[gcode_macro M300]
|
|
gcode:
|
|
# Use a default 1kHz tone if S is omitted.
|
|
{% set S = params.S|default(1000)|int %}
|
|
# Use a 10ms duration is P is omitted.
|
|
{% set P = params.P|default(100)|int %}
|
|
SET_PIN PIN=BEEPER_pin VALUE=0.5 CYCLE_TIME={ 1.0/S if S > 0 else 1 }
|
|
G4 P{P}
|
|
SET_PIN PIN=BEEPER_pin VALUE=0
|
|
|
|
[gcode_macro start_tones]
|
|
gcode:
|
|
M300 S1000 P500 ; chirp to indicate starting to print
|
|
|
|
[gcode_macro end_tones]
|
|
gcode:
|
|
M300 S440 P200 ; Make Print Completed Tones
|
|
M300 S660 P250
|
|
M300 S880 P300
|
|
|
|
[gcode_macro error_tones]
|
|
gcode:
|
|
M300 S700 P1500 ; Make Print Completed Tones
|
|
M300 S700 P500 ; Make Print Completed Tones
|
|
M300 S700 P500 ; Make Print Completed Tones
|
|
M300 S700 P500 ; Make Print Completed Tones
|
|
M300 S700 P500 ; Make Print Completed Tones
|
|
M300 S700 P500 ; Make Print Completed Tones
|
|
M300 S700 P500 ; Make Print Completed Tones
|
|
M300 S700 P500 ; Make Print Completed Tones |