Skip to content

Instantly share code, notes, and snippets.

@StL-Jim
Created February 17, 2025 19:31
Show Gist options
  • Save StL-Jim/7a60beec8cfbb65c46e4573acab63994 to your computer and use it in GitHub Desktop.
Save StL-Jim/7a60beec8cfbb65c46e4573acab63994 to your computer and use it in GitHub Desktop.
# Configuration for Eddy USB probe. Adapted for SV08 mainline from
# https://github.com/bigtreetech/Eddy/blob/master/sample-bigtreetech-eddy-zoffbeta.cfg
# (i.e., using Eddy for both bed mesh and probing AND using the beta z-offset support).
# Follow the guide at https://github.com/bigtreetech/Eddy, but skipping everything
# about configuration except setting the serial path below. (In other words, do only
# mounting, firmware compilation and calibration.) You can find a mount that allows you
# to fit the Eddy under the regular SV08 shroud (instead of the old probe, in the same place)
# at https://www.printables.com/model/968900-sovol-sv08-btt-eddy-mount.
# If you are connecting the probe in some other way, adjust x_offset and y_offset below
# (see the BTT guide for information).
#
# Please make sure you add 'METHOD=rapid_scan' to your BED_MESH_CALIBRATE (e.g. in the START_PRINT macro)
#
# TODO: It would be nice to use the physical probe to automate the setup completely,
# but that probably requires a fair bit of scripting.
[mcu eddy]
serial: /dev/serial/by-id/usb-Klipper_rp2040_504434031036441C-if00 # This is the serial address of your eddy probe. This can be found by using the terminal of your klipper instance (typically through SSH) and using the command ```ls /dev/serial/by-id```
restart_method: command
[temperature_sensor btt_eddy_mcu]
sensor_type: temperature_mcu
sensor_mcu: eddy
min_temp: 10 # Sets the minimum tempereature for eddys tempereature sensor to operate
max_temp: 100 # Sets the maximum tempereature for eddys tempereature sensor to operate
[probe_eddy_current btt_eddy]
sensor_type: ldc1612
z_offset: 2.5 # Set to a non-zero value, this does not work exactly the same as the z_offset for other probes, read: https://www.klipper3d.org/Config_Reference.html#probe_eddy_current
i2c_mcu: eddy
i2c_bus: i2c0f
x_offset: -16 # These offsets are for the above linked Eddy mount on the stock toolhead.
y_offset: 11.5
[temperature_probe btt_eddy]
sensor_type: Generic 3950
sensor_pin: eddy:gpio26
horizontal_move_z: 2
# calibration_position: 319,176,5 ; This sets the position for temperature drift calibration over the center right heatbed screw, for a more accurate reading during calibration.
[bed_mesh]
speed: 200 # Good speed for rapid scanning
horizontal_move_z: 3 # Safe probe height
mesh_min: 15,18 # Keeping your current probe bounds
mesh_max: 335,335
probe_count: 7,7 # 15,15 # Good density for the Eddy
algorithm: bicubic
# method: rapid # Enable rapid scanning
move_check_distance: 3 # Help maintain accuracy during rapid scan
split_delta_z: 0.025 # Fine-tune mesh accuracy
# relative_reference_index: 112 # Center point of 15x15 mesh (for better reference)
fade_start: 1 # Gradually apply mesh correction
fade_end: 10 # Complete mesh correction by this height
fade_target: 0 # Target z-adjustment when fade complete
mesh_pps: 2,2 # 15Feb25 Claude said add this
#scan_overshoot: 5 #uncomment this section if you still have room left over on the X axis for some scan overshoot to product smoother movements and more accurate scanning. Uncommenting this should be fine if you are using a standard voron mount.
# This is un-commented in the eddy-zoffbeta.cfg file
# COMMENTED FOR REFERENCE, WE NOW USE HOMING OVERRIDE BELOW
#[safe_z_home]
#home_xy_position: 172, 172
#z_hop: 10
#z_hop_speed: 25
#speed: 200
# THIS HOMING OVERRIDE ALWAYS GOES BACK TO CENTER FIRST BEFORE HOMING THE OTHER AXIS
# THIS ALREADY INCLUDES THE EDDY HOMING OVERRIDES/CHANGES
#
# Feb01 -- I've had issues here with G28. All instances of G28 were updated to G28.1 which does voodoo.
# None of this is in the sample eddy-zoffbeta.cfg
#
[homing_override]
gcode:
# Move 5 up, just in case (this is our safety zhop, this needs 'set_position_z: 0' below)
G91 ; set relative positioning
G0 Z5 F1000 ; 5 up zhop
{% if not rawparams or 'Y' in rawparams %}
{action_respond_info('Homing Y')}
G28.1 Y
G90 ; set absolute positioning
G0 Y177.5 F6000 ; return to center
M400 ; Wait for move to finish
{% endif %}
{% if not rawparams or 'X' in rawparams %}
{action_respond_info('Homing X')}
G28.1 X
G90 ; set absolute positioning
G0 X177.5 F6000 ; return to center
M400 ; Wait for move to finish
{% endif %}
{% if not rawparams or 'Z' in rawparams %}
{action_respond_info('Homing Z')}
G90 ; set absolute positioning
G0 X177.5 Y177.5 F6000 ; return to center, please add your offsets manually if you want to
G28.1 Z
G91 ; set relative positioning
G0 Z10 F1000 ; 10mm zhop before probe
PROBE # Eddy needs a manual PROBE before calling the 'SET_Z_FROM_PROBE'
SET_Z_FROM_PROBE
G0 Z5 F1000 ; 5mm up
M400 ; Wait for move to finish
{% endif %}
G90 ; set absolute positioning
axes: xyz
set_position_z: 0 # This forces the z position to be at 0 when we start homing, so we can move the Z up before homing.
###############################Macros and related################################
# These macro's include the so called beta z-offset control from BTT so you can change/babystep the z-offset (from e.g. the mainsail interface).
# The z-offset changes are saved in your 'saved_variables.cfg' as 'nvm_offset'.
# Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
[delayed_gcode RESTORE_PROBE_OFFSET]
initial_duration: 1.
gcode:
{% set svv = printer.save_variables.variables %}
{% if not printer["gcode_macro SET_GCODE_OFFSET"].restored %}
SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE={ svv.nvm_offset|default(0) }
SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=restored VALUE=True
{% endif %}
# # Uncomment this if you are using Eddy as the probe AND the homing endstop
[gcode_macro SET_Z_FROM_PROBE]
gcode:
{% set cf = printer.configfile.settings %}
SET_GCODE_OFFSET_ORIG Z={printer.probe.last_z_result - cf['probe_eddy_current btt_eddy'].z_offset + printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset}
# Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
[gcode_macro Z_OFFSET_APPLY_PROBE]
rename_existing: Z_OFFSET_APPLY_PROBE_ORIG
gcode:
SAVE_VARIABLE VARIABLE=nvm_offset VALUE={ printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset }
# Uncomment the lines in this macro if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
[gcode_macro SET_GCODE_OFFSET]
rename_existing: SET_GCODE_OFFSET_ORIG
variable_restored: False # Mark whether the var has been restored from NVM
variable_runtime_offset: 0
gcode:
{% if params.Z_ADJUST %}
SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE={ printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset + params.Z_ADJUST|float }
{% endif %}
{% if params.Z %}
{% set paramList = rawparams.split() %}
{% for i in range(paramList|length) %}
{% if paramList[i]=="Z=0" %}
{% set temp=paramList.pop(i) %}
{% set temp="Z_ADJUST=" + (-printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset)|string %}
{% if paramList.append(temp) %}{% endif %}
{% endif %}
{% endfor %}
{% set rawparams=paramList|join(' ') %}
SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE=0
{% endif %}
SET_GCODE_OFFSET_ORIG { rawparams }
# This macro automates a lot of the frequency mapping process and simplifies the steps significantly.
[gcode_macro PROBE_EDDY_CURRENT_CALIBRATE_AUTO]
gcode:
BED_MESH_CLEAR
G28.1 X Y
G90 # Abs positioning
G1 X{ printer.toolhead.axis_maximum.x/2 } Y{ printer.toolhead.axis_maximum.y/2 } F6000
{% if 'z' not in printer.toolhead.homed_axes %}
SET_KINEMATIC_POSITION Z={ printer.toolhead.axis_maximum.z-1 } # Allows the user to work it down until it touches.
{% endif %}
PROBE_EDDY_CURRENT_CALIBRATE {rawparams}
# This moves the nozzle above the center right heatbed screw so we have a fixed place for our temperature drift calibration (and I don't have to remember the coordinates)
[gcode_macro PROBE_EDDY_MOVE_TO_SCREW]
gcode:
BED_MESH_CLEAR
{% if printer.toolhead.homed_axes != "xyz" %}
G28.1
{% endif %}
G90
G1 X319 Y176 Z5 F6000
## Client klipper macro definitions
##
## Copyright (C) 2022 Alex Zellner <[email protected]>
##
## This file may be distributed under the terms of the GNU GPLv3 license
##
## !!! This file is read-only. Maybe the used editor indicates that. !!!
##
## Customization:
## 1) copy the gcode_macro _CLIENT_VARIABLE (see below) to your printer.cfg
## 2) remove the comment mark (#) from all lines
## 3) change any value in there to your needs
##
## Use the PAUSE macro direct in your M600:
## e.g. with a different park position front left and a minimal height of 50
## [gcode_macro M600]
## description: Filament change
## gcode: PAUSE X=10 Y=10 Z_MIN=50
## Z_MIN will park the toolhead at a minimum of 50 mm above to bed to make it easier for you to swap filament.
##
## Client variable macro for your printer.cfg
#[gcode_macro _CLIENT_VARIABLE]
#variable_use_custom_pos : False ; use custom park coordinates for x,y [True/False]
#variable_custom_park_x : 0.0 ; custom x position; value must be within your defined min and max of X
#variable_custom_park_y : 0.0 ; custom y position; value must be within your defined min and max of Y
#variable_custom_park_dz : 2.0 ; custom dz value; the value in mm to lift the nozzle when move to park position
#variable_retract : 1.0 ; the value to retract while PAUSE
#variable_cancel_retract : 5.0 ; the value to retract while CANCEL_PRINT
#variable_speed_retract : 35.0 ; retract speed in mm/s
#variable_unretract : 1.0 ; the value to unretract while RESUME
#variable_speed_unretract : 35.0 ; unretract speed in mm/s
#variable_speed_hop : 15.0 ; z move speed in mm/s
#variable_speed_move : 100.0 ; move speed in mm/s
#variable_park_at_cancel : False ; allow to move the toolhead to park while execute CANCEL_PRINT [True/False]
#variable_park_at_cancel_x : None ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True
#variable_park_at_cancel_y : None ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True
## !!! Caution [firmware_retraction] must be defined in the printer.cfg if you set use_fw_retract: True !!!
#variable_use_fw_retract : False ; use fw_retraction instead of the manual version [True/False]
#variable_idle_timeout : 0 ; time in sec until idle_timeout kicks in. Value 0 means that no value will be set or restored
#variable_runout_sensor : "" ; If a sensor is defined, it will be used to cancel the execution of RESUME in case no filament is detected.
## Specify the config name of the runout sensor e.g "filament_switch_sensor runout". Hint use the same as in your printer.cfg
## !!! Custom macros, please use with care and review the section of the corresponding macro.
## These macros are for simple operations like setting a status LED. Please make sure your macro does not interfere with the basic macro functions.
## Only single line commands are supported, please create a macro if you need more than one command.
#variable_user_pause_macro : "" ; Everything inside the "" will be executed after the klipper base pause (PAUSE_BASE) function
#variable_user_resume_macro: "" ; Everything inside the "" will be executed before the klipper base resume (RESUME_BASE) function
#variable_user_cancel_macro: "" ; Everything inside the "" will be executed before the klipper base cancel (CANCEL_PRINT_BASE) function
#gcode:
[virtual_sdcard]
path: ~/printer_data/gcodes
on_error_gcode: CANCEL_PRINT
[pause_resume]
#recover_velocity: 50.
# When capture/restore is enabled, the speed at which to return to
# the captured position (in mm/s). Default is 50.0 mm/s.
[display_status]
[respond]
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
##### get user parameters or use default #####
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
{% set allow_park = client.park_at_cancel|default(false)|lower == 'true' %}
{% set retract = client.cancel_retract|default(5.0)|abs %}
##### define park position #####
{% set park_x = "" if (client.park_at_cancel_x|default(none) is none)
else "X=" ~ client.park_at_cancel_x %}
{% set park_y = "" if (client.park_at_cancel_y|default(none) is none)
else "Y=" ~ client.park_at_cancel_y %}
{% set custom_park = park_x|length > 0 or park_y|length > 0 %}
##### end of definitions #####
# restore idle_timeout time if needed
{% if printer['gcode_macro RESUME'].restore_idle_timeout > 0 %}
SET_IDLE_TIMEOUT TIMEOUT={printer['gcode_macro RESUME'].restore_idle_timeout}
{% endif %}
{% if (custom_park or not printer.pause_resume.is_paused) and allow_park %} _TOOLHEAD_PARK_PAUSE_CANCEL {park_x} {park_y} {% endif %}
_CLIENT_RETRACT LENGTH={retract}
TURN_OFF_HEATERS
M106 S0
{client.user_cancel_macro|default("")}
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=False
# clear pause_next_layer and pause_at_layer as preparation for next print
SET_PAUSE_NEXT_LAYER ENABLE=0
SET_PAUSE_AT_LAYER ENABLE=0 LAYER=0
CANCEL_PRINT_BASE
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
##### get user parameters or use default #####
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
{% set idle_timeout = client.idle_timeout|default(0) %}
{% set temp = printer[printer.toolhead.extruder].target if printer.toolhead.extruder != '' else 0 %}
{% set restore = False if printer.toolhead.extruder == ''
else True if params.RESTORE|default(1)|int == 1 else False %}
##### end of definitions #####
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=last_extruder_temp VALUE="{{'restore': restore, 'temp': temp}}"
# set a new idle_timeout value
{% if idle_timeout > 0 %}
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=restore_idle_timeout VALUE={printer.configfile.settings.idle_timeout.timeout}
SET_IDLE_TIMEOUT TIMEOUT={idle_timeout}
{% endif %}
PAUSE_BASE
{client.user_pause_macro|default("")}
_TOOLHEAD_PARK_PAUSE_CANCEL {rawparams}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
variable_last_extruder_temp: {'restore': False, 'temp': 0}
variable_restore_idle_timeout: 0
variable_idle_state: False
gcode:
##### get user parameters or use default #####
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
{% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
{% set sp_move = client.speed_move|default(velocity) %}
{% set runout_resume = True if client.runout_sensor|default("") == "" # no runout
else True if not printer[client.runout_sensor].enabled # sensor is disabled
else printer[client.runout_sensor].filament_detected %} # sensor status
{% set can_extrude = True if printer.toolhead.extruder == '' # no extruder defined in config
else printer[printer.toolhead.extruder].can_extrude %} # status of active extruder
{% set do_resume = False %}
{% set prompt_txt = [] %}
##### end of definitions #####
#### Printer comming from timeout idle state ####
{% if printer.idle_timeout.state|upper == "IDLE" or idle_state %}
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=idle_state VALUE=False
{% if last_extruder_temp.restore %}
# we need to use the unicode (\u00B0) for the ° as py2 env's would throw an error otherwise
RESPOND TYPE=echo MSG='{"Restoring \"%s\" temperature to %3.1f\u00B0C, this may take some time" % (printer.toolhead.extruder, last_extruder_temp.temp) }'
M109 S{last_extruder_temp.temp}
{% set do_resume = True %}
{% elif can_extrude %}
{% set do_resume = True %}
{% else %}
RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder}'
{% set _d = prompt_txt.append("\"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder) %}
{% endif %}
#### Printer comming out of regular PAUSE state ####
{% elif can_extrude %}
{% set do_resume = True %}
{% else %}
RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder}'
{% set _d = prompt_txt.append("\"%s\" not hot enough, please heat up again and press RESUME" % printer.toolhead.extruder) %}
{% endif %}
{% if runout_resume %}
{% if do_resume %}
{% if restore_idle_timeout > 0 %} SET_IDLE_TIMEOUT TIMEOUT={restore_idle_timeout} {% endif %} # restore idle_timeout time
{client.user_resume_macro|default("")}
_CLIENT_EXTRUDE
RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)}
{% endif %}
{% else %}
RESPOND TYPE=error MSG='{"Resume aborted !!! \"%s\" detects no filament, please load filament and press RESUME" % (client.runout_sensor.split(" "))[1]}'
{% set _d = prompt_txt.append("\"%s\" detects no filament, please load filament and press RESUME" % (client.runout_sensor.split(" "))[1]) %}
{% endif %}
##### Generate User Information box in case of abort #####
{% if not (runout_resume and do_resume) %}
RESPOND TYPE=command MSG="action:prompt_begin RESUME aborted !!!"
{% for element in prompt_txt %}
RESPOND TYPE=command MSG='{"action:prompt_text %s" % element}'
{% endfor %}
RESPOND TYPE=command MSG="action:prompt_footer_button Ok|RESPOND TYPE=command MSG=action:prompt_end|info"
RESPOND TYPE=command MSG="action:prompt_show"
{% endif %}
# Usage: SET_PAUSE_NEXT_LAYER [ENABLE=[0|1]] [MACRO=<name>]
[gcode_macro SET_PAUSE_NEXT_LAYER]
description: Enable a pause if the next layer is reached
gcode:
{% set pause_next_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_next_layer %}
{% set ENABLE = params.ENABLE|default(1)|int != 0 %}
{% set MACRO = params.MACRO|default(pause_next_layer.call, True) %}
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{ 'enable': ENABLE, 'call': MACRO }}"
# Usage: SET_PAUSE_AT_LAYER [ENABLE=[0|1]] [LAYER=<number>] [MACRO=<name>]
[gcode_macro SET_PAUSE_AT_LAYER]
description: Enable/disable a pause if a given layer number is reached
gcode:
{% set pause_at_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_at_layer %}
{% set ENABLE = params.ENABLE|int != 0 if params.ENABLE is defined
else params.LAYER is defined %}
{% set LAYER = params.LAYER|default(pause_at_layer.layer)|int %}
{% set MACRO = params.MACRO|default(pause_at_layer.call, True) %}
SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{ 'enable': ENABLE, 'layer': LAYER, 'call': MACRO }}"
# Usage: SET_PRINT_STATS_INFO [TOTAL_LAYER=<total_layer_count>] [CURRENT_LAYER= <current_layer>]
[gcode_macro SET_PRINT_STATS_INFO]
rename_existing: SET_PRINT_STATS_INFO_BASE
description: Overwrite, to get pause_next_layer and pause_at_layer feature
variable_pause_next_layer: { 'enable': False, 'call': "PAUSE" }
variable_pause_at_layer : { 'enable': False, 'layer': 0, 'call': "PAUSE" }
gcode:
{% if pause_next_layer.enable %}
RESPOND TYPE=echo MSG='{"%s, forced by pause_next_layer" % pause_next_layer.call}'
{pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
SET_PAUSE_NEXT_LAYER ENABLE=0
{% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %}
RESPOND TYPE=echo MSG='{"%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer)}'
{pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE
SET_PAUSE_AT_LAYER ENABLE=0
{% endif %}
SET_PRINT_STATS_INFO_BASE {rawparams}
##### internal use #####
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
gcode:
##### get user parameters or use default #####
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
{% set velocity = printer.configfile.settings.pause_resume.recover_velocity %}
{% set use_custom = client.use_custom_pos|default(false)|lower == 'true' %}
{% set custom_park_x = client.custom_park_x|default(0.0) %}
{% set custom_park_y = client.custom_park_y|default(0.0) %}
{% set park_dz = client.custom_park_dz|default(2.0)|abs %}
{% set sp_hop = client.speed_hop|default(15) * 60 %}
{% set sp_move = client.speed_move|default(velocity) * 60 %}
##### get config and toolhead values #####
{% set origin = printer.gcode_move.homing_origin %}
{% set act = printer.gcode_move.gcode_position %}
{% set max = printer.toolhead.axis_maximum %}
{% set cone = printer.toolhead.cone_start_z|default(max.z) %} ; height as long the toolhead can reach max and min of an delta
{% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch']
else False %}
##### define park position #####
{% set z_min = params.Z_MIN|default(0)|float %}
{% set z_park = [[(act.z + park_dz), z_min]|max, (max.z - origin.z)]|min %}
{% set x_park = params.X if params.X is defined
else custom_park_x if use_custom
else 0.0 if round_bed
else (max.x - 5.0) %}
{% set y_park = params.Y if params.Y is defined
else custom_park_y if use_custom
else (max.y - 5.0) if round_bed and z_park < cone
else 0.0 if round_bed
else (max.y - 5.0) %}
##### end of definitions #####
_CLIENT_RETRACT
{% if "xyz" in printer.toolhead.homed_axes %}
G90
G1 Z{z_park} F{sp_hop}
G1 X{x_park} Y{y_park} F{sp_move}
{% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %}
{% else %}
RESPOND TYPE=echo MSG='Printer not homed'
{% endif %}
[gcode_macro _CLIENT_EXTRUDE]
description: Extrudes, if the extruder is hot enough
gcode:
##### get user parameters or use default #####
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
{% set use_fw_retract = (client.use_fw_retract|default(false)|lower == 'true') and (printer.firmware_retraction is defined) %}
{% set length = params.LENGTH|default(client.unretract)|default(1.0)|float %}
{% set speed = params.SPEED|default(client.speed_unretract)|default(35) %}
{% set absolute_extrude = printer.gcode_move.absolute_extrude %}
##### end of definitions #####
{% if printer.toolhead.extruder != '' %}
{% if printer[printer.toolhead.extruder].can_extrude %}
{% if use_fw_retract %}
{% if length < 0 %}
G10
{% else %}
G11
{% endif %}
{% else %}
M83
G1 E{length} F{(speed|float|abs) * 60}
{% if absolute_extrude %}
M82
{% endif %}
{% endif %}
{% else %}
RESPOND TYPE=echo MSG='{"\"%s\" not hot enough" % printer.toolhead.extruder}'
{% endif %}
{% endif %}
[gcode_macro _CLIENT_RETRACT]
description: Retracts, if the extruder is hot enough
gcode:
{% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %}
{% set length = params.LENGTH|default(client.retract)|default(1.0)|float %}
{% set speed = params.SPEED|default(client.speed_retract)|default(35) %}
_CLIENT_EXTRUDE LENGTH=-{length|float|abs} SPEED={speed|float|abs}
[gcode_macro _CLIENT_LINEAR_MOVE]
description: Linear move with save and restore of the gcode state
gcode:
{% set x_move = "X" ~ params.X if params.X is defined else "" %}
{% set y_move = "Y" ~ params.Y if params.Y is defined else "" %}
{% set z_move = "Z" ~ params.Z if params.Z is defined else "" %}
{% set e_move = "E" ~ params.E if params.E is defined else "" %}
{% set rate = "F" ~ params.F if params.F is defined else "" %}
{% set ABSOLUTE = params.ABSOLUTE | default(0) | int != 0 %}
{% set ABSOLUTE_E = params.ABSOLUTE_E | default(0) | int != 0 %}
SAVE_GCODE_STATE NAME=_client_movement
{% if x_move or y_move or z_move %}
G9{ 0 if ABSOLUTE else 1 }
{% endif %}
{% if e_move %}
M8{ 2 if ABSOLUTE_E else 3 }
{% endif %}
G1 { x_move } { y_move } { z_move } { e_move } { rate }
RESTORE_GCODE_STATE NAME=_client_movement
printer.cfg
------------
[include mainsail.cfg]
[include sovol-macros.cfg]
[include timelapse.cfg] # DONT FORGET TO INSTALL THE TIMELAPSE PLUGIN
# [include fluidd.cfg]
# [include get_ip.cfg]
# [include Macro.cfg]
# [include moonraker_obico_macros.cfg]
# PLEASE UNCOMMENT THE FILE THAT BEST FITS YOUR CONFIGURATION
# IF YOU ARE USING THE SCREEN THAT COMES WITH THE SV08
[include options/lcd/*.cfg]
# If you are using the stock probe, keep the following lines as-is.
# If you have an Eddy probe, comment the first and uncomment the second,
# then go read options/probe/eddy.cfg.
# Also, when using eddy, comment out/remove the [probe] section here in the printer.cfg
# [include options/probe/stock.cfg]
[include options/probe/eddy.cfg]
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_32FFD5054747393921691657-if00
# previously serial: /dev/ttyACM1
restart_method: command
[mcu extra_mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f103xe_33FF72064746373221300457-if00
# previously serial: /dev/ttyACM0
restart_method: command
[virtual_sdcard]
path: ~/printer_data/gcodes
on_error_gcode: CANCEL_PRINT
[printer]
kinematics: corexy
max_velocity: 700
max_accel: 40000
#max_accel_to_decel: 10000 # deprecated
minimum_cruise_ratio: 0.5
max_z_velocity: 20
max_z_accel: 500
square_corner_velocity: 5.0
[stepper_x]
step_pin: PE2
dir_pin: !PE0
enable_pin: !PE3
rotation_distance: 40
microsteps: 16
full_steps_per_rotation:200
endstop_pin: tmc2209_stepper_x: virtual_endstop
position_min: 0
position_endstop: 355
position_max: 355
homing_speed: 30
homing_retract_dist: 0
homing_positive_dir: True
#--------------------------------------------------------------------
[tmc2209 stepper_x]
uart_pin: PE1
interpolate: True
run_current: 1.1 # previously 1.5
#hold_current: 1.2 # previously 1.5
sense_resistor: 0.150
stealthchop_threshold: 0
uart_address:3
driver_sgthrs: 70 # previously 65
diag_pin: PE15
[stepper_y]
step_pin: PB8
dir_pin: !PB6
enable_pin: !PB9
rotation_distance: 40
microsteps: 16
full_steps_per_rotation:200
endstop_pin: tmc2209_stepper_y: virtual_endstop
position_min: 0
position_endstop: 364
position_max: 364
homing_speed: 30
homing_retract_dist: 0 # previously 2
homing_positive_dir: true
#--------------------------------------------------------------------
[tmc2209 stepper_y]
uart_pin: PB7
interpolate: True
run_current: 1.1 # previously 1.5
#hold_current: 1.2 # previously 1.5
sense_resistor: 0.150
stealthchop_threshold: 0
uart_address:3
driver_sgthrs: 70 # previously 65
diag_pin: PE13
[stepper_z] #motherboard:Z3
step_pin:PC0
dir_pin:PE5
enable_pin:!PC1
rotation_distance: 40
gear_ratio: 80:12
microsteps: 16
endstop_pin: probe:z_virtual_endstop
position_max: 347
position_min: -5
#position_endstop: 0
homing_speed: 15.0 # was set to 30 and may be too fast
homing_retract_dist: 5.0
homing_retract_speed: 15.0
second_homing_speed: 10.0
[tmc2209 stepper_z]
uart_pin: PE6
interpolate: true
run_current: 0.55 # previously 0.58
#hold_current: 0.58
sense_resistor: 0.150
stealthchop_threshold: 999999
uart_address:3
[stepper_z1] ##motherboard:Z1
step_pin:PD3
dir_pin:!PD1
enable_pin:!PD4
rotation_distance: 40
gear_ratio: 80:12
microsteps: 16
[tmc2209 stepper_z1]
uart_pin:PD2
interpolate: true
run_current: 0.55 # previously 0.58
#hold_current: 0.58
sense_resistor: 0.150
stealthchop_threshold: 999999
uart_address:3
[stepper_z2] ##motherboard:Z2
step_pin:PD7
dir_pin:PD5
enable_pin:!PB5
rotation_distance: 40
gear_ratio: 80:12
microsteps: 16
[tmc2209 stepper_z2]
uart_pin:PD6
interpolate: true
run_current: 0.55 # previously 0.58
#hold_current: 0.58
sense_resistor: 0.150
stealthchop_threshold: 999999
uart_address:3
[stepper_z3] ##motherboard:Z4
step_pin:PD11
dir_pin:!PD9
enable_pin:!PD12
rotation_distance: 40
gear_ratio: 80:12
microsteps: 16
[tmc2209 stepper_z3]
uart_pin:PD10
interpolate: true
run_current: 0.55 # previously 0.58
#hold_current: 0.58
sense_resistor: 0.150
uart_address:3
stealthchop_threshold: 999999
# Feb01 Start Eddy changes
# also defined in options/probe/eddy.cfg
# # Adding eddy/Eddy probe info
# # The MCU section only applies to the Eddy USB. For Eddy Coil you will use the MCU name of the toolboard that you connected the Eddy Coil to.
# [mcu eddy]
# serial: /dev/serial/by-id/usb-Klipper_rp2040_504434031036441C-if00 # This is the serial address of your eddy probe. This can be found by using the terminal of your klipper instance (typically through SSH) and using the command ```ls /dev/serial/by-id```
# restart_method: command
# Did you read all of the comments before the macros? Make sure that you do and then uncomment the ones that you need. Remove this line when you are done.
# also defined in options/probe/eddy.cfg
# [temperature_sensor btt_eddy_mcu]
# sensor_type: temperature_mcu # Sets the type of sensor for Klipper to read
# sensor_mcu: eddy # Sets the MCU of the eddy probe tempereature sensor
# min_temp: 10 # Sets the minimum tempereature for eddys tempereature sensor to operate
# max_temp: 100 # Sets the maximum tempereature for eddys tempereature sensor to operate
# This is also defined in options/probe/eddy.cfg
# [probe_eddy_current btt_eddy]
# sensor_type: ldc1612
# z_offset: 2.5
# #i2c_address:
# i2c_mcu: eddy # This value is good for the Eddy USB but would need to be adjusted for the Eddy Coil according to the MCU you have used.
# i2c_bus: i2c0f # This value is good for the Eddy USB but would need to be adjusted for the Eddy Coil according to the I2C bus you have used.
# # Measure the offsets below using the method described here: https://www.klipper3d.org/Probe_Calibrate.html#calibrating-probe-x-and-y-offsets
# # For a standard Voron stealthburner X carriage mount there should be no need to change the defaults below.
# x_offset: 0
# y_offset: 21.42
# This section is only relevant for Eddy USB. Comment it out for Eddy Coil.
# This is also defined in options/probe/eddy.cfg
# [temperature_probe btt_eddy]
# sensor_type: Generic 3950
# sensor_pin: eddy:gpio26
# horizontal_move_z: 2
# This is also defined in options/probe/eddy.cfg
# Uncomment this if you are using Eddy as the probe AND the homing endstop
# [safe_z_home]
# home_xy_position: 150, 150 # Choose an X,Y position that is in the center of your bed. For a 300x300 machine that will be 150, 150. Use the same principle to calculate your bed center.
# z_hop: 10
# z_hop_speed: 25
# speed: 200
###############################Macros and related################################
#This secton contains macros and related config sections. Some should be used, others are optional. Read the comment above each one to find out whether or not to uncomment it for your installation.
# # Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
# [save_variables]
# filename: ~/printer_data/config/variables.cfg
# # Uncomment this if you are using Eddy as the probe AND the homing endstop
# [force_move]
# enable_force_move: True # Allows a user to move the z axis down if they have no other means of homing Z and need to calibrate the Eddy.
# # Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
# [delayed_gcode RESTORE_PROBE_OFFSET]
# initial_duration: 1.
# gcode:
# {% set svv = printer.save_variables.variables %}
# {% if not printer["gcode_macro SET_GCODE_OFFSET"].restored %}
# SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE={ svv.nvm_offset|default(0) }
# SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=restored VALUE=True
# {% endif %}
# # Uncomment this if you are using Eddy as the probe AND the homing endstop
# # Take note of the lines that should only be used if you have a KNOMI installed.
[gcode_macro G28]
rename_existing: G28.1
gcode:
#SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=True # Uncomment this if using a KNOMI and then remove the G28 macro from the KNOMI.cfg
G28.1 {rawparams}
{% if not rawparams or (rawparams and 'Z' in rawparams) %}
PROBE
SET_Z_FROM_PROBE
{% endif %}
#SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=False # Uncomment this if using a KNOMI and then remove the G28 macro from the KNOMI.cfg
# # Uncomment this if you are using Eddy as the probe AND the homing endstop
# [gcode_macro SET_Z_FROM_PROBE]
# gcode:
# {% set cf = printer.configfile.settings %}
# SET_GCODE_OFFSET_ORIG Z={printer.probe.last_z_result - cf['probe_eddy_current btt_eddy'].z_offset + printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset}
# G90
# G1 Z{cf.safe_z_home.z_hop}
# # Uncomment this if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
# [gcode_macro Z_OFFSET_APPLY_PROBE]
# rename_existing: Z_OFFSET_APPLY_PROBE_ORIG
# gcode:
# SAVE_VARIABLE VARIABLE=nvm_offset VALUE={ printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset }
# # Uncomment the lines in this macro if you are using Eddy as the probe AND the homing endstop AND would like to use the beta z-offset control
# [gcode_macro SET_GCODE_OFFSET]
# rename_existing: SET_GCODE_OFFSET_ORIG
# variable_restored: False # Mark whether the var has been restored from NVM
# variable_runtime_offset: 0
# gcode:
# {% if params.Z_ADJUST %}
# SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE={ printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset + params.Z_ADJUST|float }
# {% endif %}
# {% if params.Z %}
# {% set paramList = rawparams.split() %}
# {% for i in range(paramList|length) %}
# {% if paramList[i]=="Z=0" %}
# {% set temp=paramList.pop(i) %}
# {% set temp="Z_ADJUST=" + (-printer["gcode_macro SET_GCODE_OFFSET"].runtime_offset)|string %}
# {% if paramList.append(temp) %}{% endif %}
# {% endif %}
# {% endfor %}
# {% set rawparams=paramList|join(' ') %}
# SET_GCODE_VARIABLE MACRO=SET_GCODE_OFFSET VARIABLE=runtime_offset VALUE=0
# {% endif %}
# SET_GCODE_OFFSET_ORIG { rawparams }
# # This macro automates a lot of the frequency mapping process and simplifies the steps significantly.
# [gcode_macro PROBE_EDDY_CURRENT_CALIBRATE_AUTO]
# gcode:
# BED_MESH_CLEAR
# G28 X Y
# G90 # Abs positioning
# G1 X{ printer.toolhead.axis_maximum.x/2 } Y{ printer.toolhead.axis_maximum.y/2 } F6000
# {% if 'z' not in printer.toolhead.homed_axes %}
# SET_KINEMATIC_POSITION Z={ printer.toolhead.axis_maximum.z-1 } # Allows the user to work it down until it touches.
# {% endif %}
# PROBE_EDDY_CURRENT_CALIBRATE {rawparams}
# #This macro is optional but useful if you want to run a rapid scan before each print. Simply uncomment it and add BED_MESH_SCAN to your print start code.
# #[gcode_macro BED_MESH_CALIBRATE]
# #rename_existing: BTT_BED_MESH_CALIBRATE
# #gcode:
# # SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=probing VALUE=True #Only uncomment this line if using a KNOMI and then remove the BED_MESH_CALIBRATE macro from KNOMI.cfg
# # BTT_BED_MESH_CALIBRATE METHOD=rapid_scan
# # SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=probing VALUE=False #Only uncomment this line if using a KNOMI and then remove the BED_MESH_CALIBRATE macro from KNOMI.cfg
# Feb01 End eddy/Eddy changes
[thermistor my_thermistor_e]
temperature1:25
resistance1:110000
temperature2:100
resistance2:7008
temperature3:220
resistance3:435
[extruder]
step_pin: extra_mcu:PA8
dir_pin: extra_mcu:PB8
enable_pin:!extra_mcu: PB11
rotation_distance: 6.5
microsteps: 16
full_steps_per_rotation: 200
nozzle_diameter: 0.400
filament_diameter: 1.75
max_extrude_only_distance: 150
heater_pin:extra_mcu:PB9
sensor_type:my_thermistor_e
pullup_resistor: 11500
sensor_pin: extra_mcu:PA5
min_temp: 5
max_temp: 305
max_power: 1.0
min_extrude_temp: 150 # 5
control : pid
pid_kp : 33.838
pid_ki : 5.223
pid_kd : 47.752
pressure_advance: 0.025
pressure_advance_smooth_time: 0.035
[tmc2209 extruder]
uart_pin: extra_mcu:PB10
interpolate: True
run_current: 0.8
#hold_current: 0.75
uart_address:3
sense_resistor: 0.150
[verify_heater extruder]
max_error: 120
check_gain_time:30
hysteresis: 5
heating_gain: 2
[filament_switch_sensor filament_sensor]
pause_on_runout: True
event_delay: 3.0
pause_delay: 0.5
switch_pin: PE9
[thermistor my_thermistor]
temperature1:25
resistance1:100000
temperature2:50
resistance2:18085.4
temperature3:100
resistance3:5362.6
[heater_bed]
heater_pin:PA0
sensor_type: my_thermistor
sensor_pin: PC5
max_power: 1.0
min_temp: 5
max_temp: 105
control : pid
pid_kp : 73.571
pid_ki : 1.820
pid_kd : 783.849
[verify_heater heater_bed]
max_error: 120
check_gain_time:40
hysteresis: 5
heating_gain: 2
# [probe_pressure]
# pin: ^!PE12
# x_offset: 0
# y_offset: 0
# z_offset : 0
# speed: 1.0
[quad_gantry_level]
gantry_corners:
-60,-10
410,420
points:
36,10
36,320
346,320
346,10
speed: 400
horizontal_move_z: 10
retry_tolerance: 0.05
retries: 5
max_adjust: 30
[multi_pin print_cooling_fan_pins]
pins: extra_mcu:PA7, extra_mcu:PB1
# print/part cooling fan
[fan]
pin: multi_pin:print_cooling_fan_pins
max_power: 1.0
[fan_generic exhaust_fan] # exhaust fan
pin: PA2
max_power: 1.0
# MCU fan, aka noisy boi, is now only enabled when using steppers, extruder, heatbed; 5min timeout
[controller_fan MCU_fan]
pin: PA1
max_power: 1
kick_start_time: 0.5
fan_speed: 1
idle_timeout: 300
heater: extruder, heater_bed
stepper: stepper_x, stepper_y
# Want your fan (host) temperature controlled? Uncomment the next section and comment out the above section, derived from: https://www.reddit.com/r/Sovol/comments/1cqntzu/first_mod_on_my_sv08_noctua_fan_for_the/
# WARNING: Do you have a Noctua 24V 4010 fan (eg. NF-A4x10 24V PWM)? Then this will not work and results in a non-spinning fan.
# In that case you can either use the above 'controller_fan' section or use 'control: watermark' and leave the pid entries commented out.
#[temperature_fan MCU_fan]
#pin: PA1
#kick_start_time: 0.5
#max_power: 1.0
#min_temp: 0
#max_temp: 90
#hardware_pwm: true
#target_temp: 50
#sensor_type: temperature_host # please comment out or remove the [temperature_sensor Host_temp] section if you don't want the temperature shown twice in the interface.
#max_speed: 1.0
#min_speed: 0.1
#control: pid
#pid_Kp: 2.0 ;40
#pid_Ki: 5.0 ;0.2
#pid_Kd: 0.5 ;0.1
#pid_deriv_time: 2.0
#control: watermark # use this control if pid control does not work for your fan
[heater_fan hotend_fan]
pin: extra_mcu:PA6
max_power: 1.0
kick_start_time: 0.5
heater: extruder
heater_temp: 50
tachometer_pin:extra_mcu:PA1
tachometer_ppr: 1
tachometer_poll_interval: 0.0013
[gcode_arcs]
resolution: 1.0
# Defined as an LED for ease of control
[led main_led]
white_pin:PA3
cycle_time: 0.010
hardware_pwm: False
initial_WHITE: 1.0
[idle_timeout]
gcode: _IDLE_TIMEOUT
timeout: 600
[temperature_sensor mcu_temp]
sensor_type: temperature_mcu
min_temp:0
max_temp:100
[temperature_sensor Host_temp]
sensor_type: temperature_host
min_temp: 0
max_temp: 110
[temperature_sensor Toolhead_Temp]
sensor_type: temperature_mcu
sensor_mcu: extra_mcu
[pause_resume]
[exclude_object]
[adxl345]
cs_pin:extra_mcu:PB12
[resonance_tester]
accel_chip: adxl345
probe_points:
175, 175, 30 # an example175 Y175 Z30
accel_per_hz:50
min_freq:1
max_freq:100
max_smoothing:0.2
hz_per_sec:0.5
[input_shaper]
damping_ratio_x: 0.001
damping_ratio_y: 0.001
shaper_type_x = mzv
shaper_freq_x = 35
shaper_type_y = mzv
shaper_freq_y = 35
[save_variables]
filename = ~/printer_data/config/saved_variables.cfg
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [probe_eddy_current btt_eddy]
#*# reg_drive_current = 15
#*# calibrate =
#*# 0.050625:3188985.825,0.090000:3188688.093,0.129375:3188410.293,
#*# 0.170625:3188128.225,0.210000:3187828.534,0.249375:3187528.449,
#*# 0.290625:3187246.186,0.330000:3186943.289,0.369375:3186668.649,
#*# 0.410625:3186314.905,0.450000:3185955.881,0.489375:3185592.540,
#*# 0.530625:3185181.477,0.570000:3184817.183,0.609375:3184446.132,
#*# 0.650625:3184082.778,0.690000:3183731.001,0.729375:3183386.661,
#*# 0.770625:3183039.987,0.810000:3182717.981,0.849375:3182394.785,
#*# 0.890625:3182057.284,0.930000:3181759.892,0.969375:3181435.138,
#*# 1.010625:3181127.683,1.050000:3180817.387,1.089375:3180519.653,
#*# 1.130625:3180211.809,1.170000:3179947.840,1.209375:3179639.708,
#*# 1.250625:3179359.507,1.290000:3179105.867,1.329375:3178793.965,
#*# 1.370625:3178538.607,1.410000:3178279.622,1.449375:3178027.807,
#*# 1.490625:3177784.231,1.530000:3177538.887,1.569375:3177282.995,
#*# 1.610625:3177036.214,1.650000:3176818.218,1.689375:3176562.074,
#*# 1.730625:3176342.306,1.770000:3176125.540,1.809375:3175885.513,
#*# 1.850625:3175656.186,1.890000:3175452.870,1.929375:3175237.292,
#*# 1.970625:3175042.545,2.010000:3174821.649,2.049375:3174626.709,
#*# 2.090625:3174422.279,2.130000:3174229.966,2.169375:3174043.751,
#*# 2.210625:3173838.293,2.250000:3173653.961,2.289375:3173479.572,
#*# 2.330625:3173281.905,2.370000:3173111.441,2.409375:3172943.813,
#*# 2.450625:3172759.584,2.490000:3172587.723,2.529375:3172463.895,
#*# 2.570625:3172273.453,2.610000:3172113.446,2.649375:3171947.526,
#*# 2.690625:3171809.556,2.730000:3171636.971,2.769375:3171501.530,
#*# 2.810625:3171345.515,2.850000:3171188.846,2.889375:3171042.704,
#*# 2.930625:3170911.481,2.970000:3170778.464,3.009375:3170629.672,
#*# 3.050625:3170472.067,3.090000:3170375.608,3.129375:3170227.675,
#*# 3.170625:3170089.199,3.210000:3169962.083,3.249375:3169828.452,
#*# 3.290625:3169708.342,3.330000:3169569.650,3.369375:3169471.513,
#*# 3.410625:3169327.886,3.450000:3169218.846,3.489375:3169100.872,
#*# 3.530625:3168947.991,3.570000:3168859.323,3.609375:3168764.178,
#*# 3.650625:3168629.392,3.690000:3168531.051,3.729375:3168466.281,
#*# 3.770625:3168325.360,3.810000:3168205.463,3.849375:3168110.504,
#*# 3.890625:3167996.252,3.930000:3167910.479,3.969375:3167816.956,
#*# 4.010625:3167696.920,4.050000:3167610.613
#*#
#*# [temperature_probe btt_eddy]
#*# calibration_temp = 29.226499
#*#
[gcode_macro mainled_on]
gcode:
SET_LED LED=main_led WHITE=1
[gcode_macro mainled_off]
gcode:
SET_LED LED=main_led WHITE=0
#--------------------------------------------------------------------#
#--------------------------------------------------------------------#
[force_move]
enable_force_move: True
[gcode_macro _global_var]
variable_pause_park:{'x': 0, 'y': 0, 'z': 10, 'e': 1}
variable_cancel_park:{'x': 0, 'y': 350, 'z': 10, 'e': 1}
variable_z_maximum_lifting_distance: 345
variable_pause_resume_travel_speed: 150
variable_bed_mesh_calibrate_target_temp: 60
variable_load_filament_extruder_temp: 230
variable_heat_soak_time: 0 # in minutes
gcode:
[gcode_macro START_PRINT]
description:
variable_state: 'Prepare'
variable_record_extruder_temp:0
variable_max_record_extruder_temp:0
gcode:
{% set bedtemp = params.BED_TEMP|default(60)|int %}
{% set hotendtemp = params.EXTRUDER_TEMP|default(230)|int %}
{% set heatsoak = params.HEATSOAK|default(True)|int %}
{% set heatsoak_time = printer['gcode_macro _global_var'].heat_soak_time|default(0)|int %} # takes heatsoak time from global variables
{% set mesh_name = "default" %}
{% set extruder_target_temp = 125 %}
{% set bed_target_temp = bedtemp|int %}
M400
CLEAR_PAUSE
G90
{% if state == 'Prepare' %}
{action_respond_info("Prepare!")}
{% if printer['filament_switch_sensor filament_sensor'].enable == True and
printer['filament_switch_sensor filament_sensor'].filament_detected != True
%}
M117 No filament!
{action_respond_info("Please Insert filament in Sensor!")}
CANCEL_PRINT
{% endif %}
{% if printer.extruder.temperature < extruder_target_temp %}
M117 Nozzle pre-heating...
{action_respond_info("Nozzle pre-heating...")}
M109 S{extruder_target_temp}
{% endif %}
{% if printer.toolhead.homed_axes|lower != "xyz" %}
G28
{% endif %}
#Start exhaust fan
#SET_FAN_SPEED FAN=exhaust_fan SPEED=1
{action_respond_info("Check Heating!")}
{% if printer.heater_bed.temperature < bed_target_temp %}
M117 Bed heating...
{action_respond_info("Bed heating...")}
M190 S{bed_target_temp}
{% endif %}
M140 S{bed_target_temp}
M104 S{extruder_target_temp}
{% if heatsoak == True %}
M117 Short Heat Soak
G4 P{heatsoak_time * 60000} # pause for x number of minute(s) (see variable_heat_soak_time)
{% endif %}
{% if printer.quad_gantry_level.applied|lower != 'true' %}
M117 QGL
QUAD_GANTRY_LEVEL_BASE # We use the _BASE variant here as not to remove the stock Sovol override (but we also don't want to use the Sovol override here)
M117 Home Z after QGL
G28 Z # And once again after QGL, important..
# M117 Auto Z Offset
# Z_OFFSET_CALIBRATION
{% endif %}
# We use the _BASE variant here as not to remove the stock Sovol override (but we also don't want to use the Sovol override here)
# Remove the comment to add 'METHOD=rapid_scan' when using the Eddy probe
M117 Bed Mesh
BED_MESH_CALIBRATE_BASE ADAPTIVE=1 #METHOD=rapid_scan
# Set final temperatures before printing instead of relying on the OrcaSlicer start gcode..
M117 Final Heating...
{action_respond_info("Final heating...")}
M140 S{bedtemp} ;set bed temp
M104 S{hotendtemp} ;set extruder temp
M190 S{bedtemp} ;wait for bed temp
M109 S{hotendtemp};wait for extruder temp
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=state VALUE='"Start"'
UPDATE_DELAYED_GCODE ID=_print_start_wait DURATION=0.5
{% elif state == 'Start' %}
M117 Printing
{action_respond_info("Start!")}
{% endif %}
[gcode_macro END_PRINT]
description:
variable_state: 'normal'
gcode:
{% set z_max = printer['gcode_macro _global_var'].z_maximum_lifting_distance|int %}
{% set e_mintemp = printer.configfile.settings['extruder'].min_extrude_temp %}
M400
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=state VALUE='"Prepare"'
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=record_extruder_temp VALUE=0
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=max_record_extruder_temp VALUE=0
M117 Done
G91
{% if printer['filament_switch_sensor filament_sensor'].enable == True and
printer['filament_switch_sensor filament_sensor'].filament_detected == True
%}
{% if (printer.extruder.target != 0 and printer.extruder.temperature >= printer.extruder.target) or
printer.extruder.temperature >= e_mintemp
%}
G1 E-2 F2700
G1 E-2 Z0.2 F2400
{% endif %}
{% endif %}
{% if (printer.gcode_move.position.z + 25) < z_max %}
G1 Z+25 F3000
{% else %}
G1 Z+{(z_max - printer.gcode_move.position.z)} F3000
{% endif %}
G90
G1 X0 Y360 F9000
_ALL_FAN_OFF
TURN_OFF_HEATERS
M84 X Y Z E
M220 S100
M221 S100
CLEAR_PAUSE
{action_respond_info("Finish Print!")}
[gcode_macro _IDLE_TIMEOUT]
gcode:
{% if printer.print_stats.state == "paused" %}
RESPOND TYPE=echo MSG="No operations in 10min!"
{% else %}
M84
TURN_OFF_HEATERS
{% endif %}
[delayed_gcode exhaust_fan_off]
gcode:
SET_FAN_SPEED FAN=exhaust_fan SPEED=0
[gcode_macro _ALL_FAN_OFF]
gcode:
M106 S0
# Run the exhaust fan for another 2min after the other fans and then turn it off
# UPDATE_DELAYED_GCODE ID=exhaust_fan_off DURATION=120
M107
[gcode_macro CLEAN_NOZZLE]
gcode:
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
G90
G1 X348 Y0 Z0.3 F9000
M117 Nozzle heating...
M109 S200
G91
G1 Z10 F300
G90
M106 S255
M104 S130
M117 Clean nozzle
G1 X315 Y360 F9000
G1 Z0.2 F300
G1 X352 F4500
G1 Y360 X324
G1 Y360 X345
G1 Y360 X324
G1 Y360 X345
G1 Y360 X324
G1 Y360 X345
G1 Y360 X324
G1 Y360 X345
G1 Y360 X324
G1 Y360 X325
G1 Y356 X324 Z5
G1 Z0.2
G1 Y360 X324
G1 Y357 X326
G1 Y360 X326
G1 Y357 X328
G1 Y360 X330
G1 Y357 X332
G1 Y360 X334
G1 Y357 X336
G1 Y360 X338
G1 Y357 X340
G1 Y360 X324
G1 Y357 X326
G1 Y360 X326
G1 Y357 X328
G1 Y360 X330
G1 Y357 X332
G1 Y360 X334
G1 Y357 X336
G1 Y360 X338
G1 Y357 X340
G1 Y360 X324
G1 Y357 X326
G1 Y360 X326
G1 Y357 X328
G1 Y360 X330
G1 Y357 X332
G1 Y360 X334
G1 Y357 X336
G1 Y360 X338
M400
M117 Finished cleaning
M109 S130
M107
G91
G1 Z10 F300
G90
G28 Z0
# Bring the nozzle to the center of the bed
[gcode_macro CENTER]
gcode:
G0 X175 Y175 F5000
[gcode_macro _CALIBRATION_ZOFFSET]
gcode:
M117 Calibrate Offset
QUAD_GANTRY_LEVEL
M140 S65
G4 P500
CLEAN_NOZZLE
G4 P500
M117 Z-offset calibration
Z_OFFSET_CALIBRATION
Z_OFFSET_APPLY_PROBE
M400
G4 P3000
SAVE_CONFIG
[delayed_gcode _auto_zoffset]
gcode:
SAVE_VARIABLE VARIABLE=offsetadjust VALUE={'%05.2f' % (0)}
_CALIBRATION_ZOFFSET
[gcode_macro _Delay_Calibrate]
gcode:
UPDATE_DELAYED_GCODE ID=_auto_zoffset DURATION=1.0
[delayed_gcode TEST_BELT]
initial_duration: 0.3
gcode:
{% set x_freq = printer.save_variables.variables.x_freq|float %}
{% set y_freq = printer.save_variables.variables.y_freq|float %}
{% set show_freq = printer.save_variables.variables.show_freq %}
{% if show_freq == 1 %}
M117 x {x_freq}, y {y_freq}
SAVE_VARIABLE VARIABLE=show_freq VALUE=0
{% endif %}
[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing:QUAD_GANTRY_LEVEL_BASE
gcode:
{% set mesh_name = "default" %}
{% set mesh_calibrate_temp = printer['gcode_macro _global_var'].bed_mesh_calibrate_target_temp|int %}
{% set current_target_temp = printer.heater_bed.target|int %}
{action_respond_info("Check Heating!")}
{% if printer.heater_bed.temperature != mesh_calibrate_temp %}
{action_respond_info("The bed target temperature was not reached!")}
{action_respond_info("Bed heating...")}
{% if current_target_temp <= mesh_calibrate_temp %}
M190 S{mesh_calibrate_temp}
{% else %}
M190 S{current_target_temp}
{% endif %}
{% endif %}
{% if printer.toolhead.homed_axes|lower != "xyz" %}
G28
{% endif %}
QUAD_GANTRY_LEVEL_BASE
{% if current_target_temp == 0 %}
M140 S0
{% endif %}
[gcode_macro PROBE_CALIBRATE]
rename_existing:PROBE_CALIBRATE_BASE
gcode:
{% set current_target_temp = printer.heater_bed.target|int %}
{% set z_offset_calibrate_temp = printer['gcode_macro _global_var'].bed_mesh_calibrate_target_temp|int %}
{action_respond_info("z_offset_calibrate")}
{% if printer.heater_bed.temperature != z_offset_calibrate_temp %}
M140 S{z_offset_calibrate_temp}
{action_respond_info("The bed target temperature was not reached!")}
{action_respond_info("Bed heating...")}
M190 S{z_offset_calibrate_temp}
{% endif %}
G28
PROBE_CALIBRATE_BASE
TESTZ z=-4
[gcode_macro BED_MESH_CALIBRATE]
rename_existing: BED_MESH_CALIBRATE_BASE
gcode:
{% set mesh_name = "default" %}
{% set mesh_calibrate_temp = printer['gcode_macro _global_var'].bed_mesh_calibrate_target_temp|int %}
{% set current_target_temp = printer.heater_bed.target|int %}
{action_respond_info("Check Heating!")}
{% if printer.heater_bed.temperature != mesh_calibrate_temp %}
{action_respond_info("The bed target temperature was not reached!")}
{action_respond_info("Bed heating...")}
{% if current_target_temp <= mesh_calibrate_temp %}
M190 S{mesh_calibrate_temp}
{% else %}
M190 S{current_target_temp}
{% endif %}
{% endif %}
{% if printer.toolhead.homed_axes|lower != "xyz" %}
G28
{% endif %}
BED_MESH_CLEAR
BED_MESH_CALIBRATE_BASE ADAPTIVE=1 #METHOD=rapid_scan
{% if current_target_temp == 0 %}
M140 S0
{% endif %}
[gcode_macro G34]
gcode:
BED_MESH_CLEAR
{% if printer.toolhead.homed_axes|lower != "xyz" %}
G28
{% else %}
G28 Z
{% endif %}
QUAD_GANTRY_LEVEL
G28 Z
G0 X175 Y175 Z30 F3600
[delayed_gcode bed_mesh_init]
initial_duration: .01
gcode:
BED_MESH_PROFILE LOAD=default
[delayed_gcode _print_start_wait]
gcode:
{% if printer['gcode_macro START_PRINT'].state == 'Heating'%}
{action_respond_info("Prepare->Heating!")}
{% elif printer['gcode_macro START_PRINT'].state == 'Start' %}
{action_respond_info("Heating->Start!")}
{% endif %}
{% if printer['gcode_macro START_PRINT'].execute|lower != 'false' %}
START_PRINT
{% endif %}
[gcode_macro CANCEL_PRINT]
description:
rename_existing: CANCEL_PRINT_BASE
gcode:
{% set x_park = printer['gcode_macro _global_var'].cancel_park.x|float %}
{% set y_park = printer['gcode_macro _global_var'].cancel_park.y|float %}
{% set z_park = printer['gcode_macro _global_var'].cancel_park.z|float %}
{% set z_lift_max = printer['gcode_macro _global_var'].z_maximum_lifting_distance %}
{% set e_restract = printer['gcode_macro _global_var'].cancel_park.e|float %}
{% set e_mintemp = printer.configfile.settings['extruder'].min_extrude_temp %}
CANCEL_PRINT_BASE
M117 Print canceled!
G91
{% if printer['filament_switch_sensor filament_sensor'].enabled == True and
printer['filament_switch_sensor filament_sensor'].filament_detected == True
%}
{% if (printer.extruder.target != 0 and printer.extruder.temperature >= printer.extruder.target) or
printer.extruder.temperature >= e_mintemp
%}
G1 E-{e_restract} F500
{% else %}
{action_respond_info("Nozzle not hot enough")}
{% endif %}
{% endif %}
{%if (printer.gcode_move.position.z + 10) < z_lift_max %}
G1 Z+10 F3000
{% else %}
G1 Z+{(z_lift_max - printer.gcode_move.position.z)} F3000
{% endif %}
G90
G1 X{x_park} Y{y_park} F9000
TURN_OFF_HEATERS
_ALL_FAN_OFF
CLEAR_PAUSE
M84 X Y Z E
M117 Ready
{action_respond_info("Cancel Print Success!")}
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=state VALUE='"Prepare"'
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=record_extruder_temp VALUE=0
SET_GCODE_VARIABLE MACRO=START_PRINT VARIABLE=max_record_extruder_temp VALUE=0
[gcode_macro PAUSE]
rename_existing: PAUSE_BASE
variable_state: 'normal'
gcode:
{% if printer.pause_resume.is_paused == False %}
{% set x_park = printer['gcode_macro _global_var'].pause_park.x|float %}
{% set y_park = printer['gcode_macro _global_var'].pause_park.y|float %}
{% set e_restract = printer['gcode_macro _global_var'].pause_park.e|float %}
{% set z_lift_max = printer['gcode_macro _global_var'].z_maximum_lifting_distance %}
{% set state = params.STATE if 'filament_change' in params.STATE else 'normal' %}
{action_respond_info("Pause Print!")}
PAUSE_BASE
M117 Pause Print!!!
G91
{% if (printer.gcode_move.position.z + 5) < z_lift_max %}
G1 Z+5 F3000
{% else %}
G1 Z+{(z_lift_max - printer.gcode_move.position.z)} F3000
{% endif %}
G90
{% if printer.gcode_move.position.x != x_park and
printer.gcode_move.position.y != y_park
%}
G1 X{x_park} Y{y_park} F{printer["gcode_macro _global_var"].pause_resume_travel_speed * 60}
{% endif %}
M104 S{printer.extruder.target}
{% if state == 'normal' %}
{% if (printer.extruder.temperature + 5 >= printer.extruder.target) and (printer.extruder.temperature >= printer.configfile.settings['extruder'].min_extrude_temp) %}
{% if printer['filament_switch_sensor filament_sensor'].enabled == True and
printer['filament_switch_sensor filament_sensor'].filament_detected == True
%}
G91
G1 E-{e_restract} F300
G90
{% elif printer['filament_switch_sensor filament_sensor'].enabled == True and
printer['filament_switch_sensor filament_sensor'].filament_detected != True %}
G91
G1 E+95 F300
G1 E-10 F1500
G1 E-20 F600
M400
G4 P3000
G1 E-50 F300
G90
{% endif %}
{% endif %}
{% elif state == 'filament_change' %}
{% if (printer.extruder.temperature + 5 >= printer.extruder.target) and (printer.extruder.temperature >= printer.configfile.settings['extruder'].min_extrude_temp) %}
G91
G1 E+25 F300
G1 E-10 F1500
G1 E-20 F600
M400
G4 P3000
G1 E-50 F300
G90
{% endif %}
{% endif %}
{% endif %}
[delayed_gcode _resume_wait]
gcode:
{% if printer['gcode_macro RESUME'].execute|lower != 'false' %}
RESUME
{% endif %}
[gcode_macro RESUME]
description: Pause the actual running print
rename_existing: RESUME_BASE
variable_state: 'normal'
gcode:
{% set e_restract = printer['gcode_macro _global_var'].pause_park.e|float %}
{% set extruder_target_temp = printer.extruder.target|int %}
{% set state = params.STATE if 'filament_change' in params.STATE else 'normal' %}
{% if state == 'filament_change' %}
{% if printer["filament_switch_sensor filament_sensor"].enable == True and
printer["filament_switch_sensor filament_sensor"].filament_detected != True
%}
{action_respond_info("Please Insert filament in Sensor!")}
{% else %}
{% if printer.extruder.temperature + 5 >= printer.extruder.target %}
G91
G1 E30 F300
G1 E10 F150
G90
{% else %}
M104 S{extruder_target_temp}
{action_respond_info("Nozzle not hot enough!")}
{action_respond_info("Nozzle heating...")}
M109 S{extruder_target_temp}
G91
G1 E30 F300
G1 E10 F150
G90
{% endif %}
{action_respond_info("Print resumming!")}
RESUME_BASE
{% endif %}
{% elif state == 'normal' %}
{% if printer['filament_switch_sensor filament_sensor'].enable != True and
printer['filament_switch_sensor filament_sensor'].filament_detected != True
%}
{action_respond_info("Please Insert filament in Sensor!")}
{% else %}
{action_respond_info("Print resumming!")}
G91
G1 E{e_restract} F300
G90
M117 Printing now!!!
RESUME_BASE
{% endif %}
{% endif %}
[gcode_macro LOAD_FILAMENT]
gcode:
{% set extruder_temp = printer['gcode_macro _global_var'].load_filament_extruder_temp|int %}
{% set current_target_temp = printer.extruder.target|int %}
{% if printer.print_stats.state != "printing" %}
{% if printer.print_stats.state != "paused" %}
M104 S{extruder_temp}
M117 Nozzle heating...
{action_respond_info("Nozzle not hot enough!")}
{action_respond_info("Nozzle heating...")}
M109 S{extruder_temp}
{% else %}
{% if printer.extruder.target == 0 %}
M104 S{extruder_temp}
M117 Nozzle heating...
{action_respond_info("Nozzle not hot enough!")}
{action_respond_info("Nozzle heating...")}
M109 S{extruder_temp}
{% else %}
M104 S{printer.extruder.target}
M117 Nozzle heating...
{action_respond_info("Nozzle not hot enough!")}
{action_respond_info("Nozzle heating...")}
M109 S{printer.extruder.target}
{% endif %}
{% endif %}
M117 Extruding...
G91
G1 E75 F300
G1 E30 F150
G1 E-2 F300
G90
M400
M117 Filament loaded.
M400
{% if current_target_temp == 0 or printer.print_stats.state != "paused"%}
M104 S0
{% endif %}
{% else %}
{action_respond_info("Don't load filament during printing!!!")}
{% endif %}
[gcode_macro UNLOAD_FILAMENT]
gcode:
{% set extruder_temp = printer['gcode_macro _global_var'].load_filament_extruder_temp|int %}
{% set current_target_temp = printer.extruder.target|int %}
{% if printer.print_stats.state != "printing" %}
{% if printer.print_stats.state != "paused" %}
M104 S{extruder_temp}
M117 Nozzle heating...
{action_respond_info("Nozzle not hot enough!")}
{action_respond_info("Nozzle heating...")}
M109 S{extruder_temp}
{% else %}
{% if printer.extruder.target == 0 %}
M104 S{extruder_temp}
M117 Nozzle heating...
{action_respond_info("Nozzle not hot enough!")}
{action_respond_info("Nozzle heating...")}
M109 S{extruder_temp}
{% else %}
M104 S{printer.extruder.target}
M117 Nozzle heating...
{action_respond_info("Nozzle not hot enough!")}
{action_respond_info("Nozzle heating...")}
M109 S{printer.extruder.target}
{% endif %}
{% endif %}
M117 Retracting...
G91
G1 E+25 F300
G1 E-10 F1500
G1 E-20 F600
M400
G4 P3000
G1 E-50 F300
G90
M400
M117 Filament ejected.
M400
{% if current_target_temp == 0 or printer.print_stats.state != "paused"%}
M104 S0
{% endif %}
{% else %}
{action_respond_info("Don't unload filament during printing!!!")}
{% endif %}
[gcode_macro M109]
rename_existing: M99109
gcode:
{% set s = params.S|float %}
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
{% if s != 0 %}
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s-1} MAXIMUM={s+1}
{% endif %}
[gcode_macro M190]
rename_existing: M99190
gcode:
{% set s = params.S|float %}
M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %}
{% if s != 0 %}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s-1} MAXIMUM={s+1}
{% endif %}
[gcode_macro M600]
gcode:
PAUSE STATE=filament_change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment