So i’ve got the basics working. Homing and regular movement seems to work fine as well as HOMEALL, TOOL_ON and TOOL_OFF macros.
Not sure how to implement setting workspace origin for cut job start yet or tool changes
Here’s my printer.cfg
# This file contains common pin mappings for the BigTreeTech SKR PRO.
# To use this config, the firmware should be compiled for the
# STM32F407 with a "32KiB bootloader".
# The "make flash" command does not work on the SKR PRO. Instead,
# after running "make", copy the generated "out/klipper.bin" file to a
# file named "firmware.bin" on an SD card and then restart the SKR PRO
# with that SD card.
# See docs/Config_Reference.md for a description of parameters.
[include mainsail1.cfg]
[gcode_macro _CLIENT_VARIABLE]
variable_use_custom_pos : True ; 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 : 900.0 ; custom y position; value must be within your defined min and max of Y
variable_custom_park_dz : 20.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 : True ; 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
gcode:
[mcu]
serial: /dev/serial/by-id/usb-Klipper_stm32f407xx_3F0023000E50345234373420-if00
#serial: /dev/ttyACM0
# serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
[printer]
kinematics: cartesian
max_velocity: 200
max_accel: 250
max_accel_to_decel: 125
max_z_velocity: 5
max_z_accel: 50
square_corner_velocity: 1
[gcode_arcs]
resolution: 0.05
[probe]
pin: ^PG8
# Probe detection pin. If the pin is on a different microcontroller
# than the Z steppers then it enables "multi-mcu homing". This
# parameter must be provided.
#deactivate_on_each_sample: True
# This determines if Klipper should execute deactivation gcode
# between each probe attempt when performing a multiple probe
# sequence. The default is True.
#x_offset: 0.0
# The distance (in mm) between the probe and the nozzle along the
# x-axis. The default is 0.
#y_offset: 0.0
# The distance (in mm) between the probe and the nozzle along the
# y-axis. The default is 0.
z_offset: 0.5
# The distance (in mm) between the bed and the nozzle when the probe
# triggers. This parameter must be provided.
speed: 2.0
# Speed (in mm/s) of the Z axis when probing. The default is 5mm/s.
#samples: 1
# The number of times to probe each point. The probed z-values will
# be averaged. The default is to probe 1 time.
sample_retract_dist: 5.0
# The distance (in mm) to lift the toolhead between each sample (if
# sampling more than once). The default is 2mm.
#lift_speed:
# Speed (in mm/s) of the Z axis when lifting the probe between
# samples. The default is to use the same value as the 'speed'
# parameter.
#samples_result: average
# The calculation method when sampling more than once - either
# "median" or "average". The default is average.
#samples_tolerance: 0.100
# The maximum Z distance (in mm) that a sample may differ from other
# samples. If this tolerance is exceeded then either an error is
# reported or the attempt is restarted (see
# samples_tolerance_retries). The default is 0.100mm.
#samples_tolerance_retries: 0
# The number of times to retry if a sample is found that exceeds
# samples_tolerance. On a retry, all current samples are discarded
# and the probe attempt is restarted. If a valid set of samples are
# not obtained in the given number of retries then an error is
# reported. The default is zero which causes an error to be reported
# on the first sample that exceeds samples_tolerance.
#activate_gcode:
# A list of G-Code commands to execute prior to each probe attempt.
# See docs/Command_Templates.md for G-Code format. This may be
# useful if the probe needs to be activated in some way. Do not
# issue any commands here that move the toolhead (eg, G1). The
# default is to not run any special G-Code commands on activation.
#deactivate_gcode:
# A list of G-Code commands to execute after each probe attempt
# completes. See docs/Command_Templates.md for G-Code format. Do not
# issue any commands here that move the toolhead. The default is to
# not run any special G-Code commands on deactivation.
[stepper_x]
step_pin: PE9
dir_pin: PF1
enable_pin: !PF2
microsteps: 16
rotation_distance: 40
endstop_pin: PB10
position_endstop: 0
position_max: 600
homing_speed: 50
[tmc2209 stepper_x]
uart_pin: PC13
run_current: 0.90
#stealthchop_threshold: 999999
[stepper_y]
step_pin: PE11
dir_pin: !PE8
enable_pin: !PD7
microsteps: 16
rotation_distance: 40
endstop_pin: PE12
position_endstop: 0
position_max: 950
homing_speed: 50
; microsteps: 64
; rotation_distance: 32
; endstop_pin: PD2
; position_endstop: 0
; position_min: -2
; position_max: 2743
; homing_speed: 50
[tmc2209 stepper_y]
uart_pin: PE3
run_current: 0.900
#stealthchop_threshold: 999999
[stepper_y1] # EO On the board is used for y1 (aka y2 on v1e)
step_pin: PE14
dir_pin: PA0
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: PE10 # uses E1 pinout
# position_endstop: 0
# position_max: 950
# homing_speed: 50
# microsteps: 64
# rotation_distance: 32
# endstop_pin: PD2
# position_endstop: 0
# position_min: -2
# position_max: 2743
# homing_speed: 50
[tmc2209 stepper_y1]
uart_pin: PD4
run_current: 0.900
#stealthchop_threshold: 999999
[stepper_z]
step_pin: PE13
dir_pin: PC2
enable_pin: !PC0
microsteps: 64
rotation_distance: 8
endstop_pin: PG5 # uses E2 pinout
position_endstop: 0
position_min: -200
position_max: 200
homing_positive_dir: true
[tmc2209 stepper_z]
uart_pin: PE1
run_current: 0.90
#stealthchop_threshold: 999999
[stepper_z1] # z1 is using E1 on the main board (aka z2 motor on v1e)
step_pin: PD15
dir_pin: !PE7
enable_pin: !PA3
microsteps: 64
rotation_distance: 8
endstop_pin: PE15 # uses E0 pinout
# position_endstop: 0.5
# position_max: 200
[tmc2209 stepper_z1]
uart_pin: PD1
run_current: 0.9
#stealthchop_threshold: 999999
[temperature_sensor tmc2209_stepper_x]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[temperature_sensor tmc2209_stepper_y]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[temperature_sensor tmc2209_stepper_y1]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[temperature_sensor tmc2209_stepper_z]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[temperature_sensor tmc2209_stepper_z1]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[temperature_sensor pi3]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[temperature_sensor printer_temp]
sensor_type: temperature_mcu
min_temp: 0
max_temp: 100
[idle_timeout]
gcode: M5
timeout: 120
# [safe_z_home]
# home_xy_position: 0, 0
# # A X, Y coordinate (e.g. 100, 100) where the Z homing should be
# # performed. This parameter must be provided.
# #speed: 50.0
# # Speed at which the toolhead is moved to the safe Z home
# # coordinate. The default is 50 mm/s
# z_hop: 2
# # Distance (in mm) to lift the Z axis prior to homing. This is
# # applied to any homing command, even if it doesn't home the Z axis.
# # If the Z axis is already homed and the current Z position is less
# # than z_hop, then this will lift the head to a height of z_hop. If
# # the Z axis is not already homed the head is lifted by z_hop.
# # The default is to not implement Z hop.
# z_hop_speed: 15.0
# # Speed (in mm/s) at which the Z axis is lifted prior to homing. The
# # default is 15 mm/s.
# #move_to_previous: False
# # When set to True, the X and Y axes are reset to their previous
# # positions after Z axis homing. The default is False.
# [homing_override]
# set_position_z: 15
# axes: xy
# gcode:
# G90
# G28 Z0
# G28 X0 Y0
[output_pin tool_power]
# tool_power pin is the fan pin on the SKR Pro. If plugged into fan 0 That would be PC8
pin: PC8
value: 0
shutdown_value: 0
pwm: false
# [output_pin tool_power_led]
# # tool_power led pin PC14 is located at fan1 led
# pin: PC14
[pause_resume]
recover_velocity: 50
[skew_correction]
[display_status]
[board_pins]
aliases:
# EXP1 header
EXP1_1=PC5, EXP1_3=PD13, EXP1_5=PE14, EXP1_7=PD11, EXP1_9=<GND>,
EXP1_2=PE13, EXP1_4=PC6, EXP1_6=PE15, EXP1_8=PD10, EXP1_10=<5V>,
# EXP2 header
EXP2_1=PA6, EXP2_3=PE8, EXP2_5=PE11, EXP2_7=PE12, EXP2_9=<GND>,
EXP2_2=PA5, EXP2_4=PE10, EXP2_6=PA7, EXP2_8=<RST>, EXP2_10=<3.3v>
# Pins EXP2_1, EXP2_6, EXP2_2 are also MISO, MOSI, SCK of bus "ssp1"
#--------------------------------
# MACROS
# [gcode_macro SET_TOOLHEAD_OFFSET]
# gcode:
# {% set xo = printer.toolhead.position.x|float %}
# {% set yo = printer.toolhead.position.y|float %}
# {% set zo = printer.toolhead.position.z|float %}
# SET_GCODE_OFFSET x={xo} y={yo} z={zo}
# [gcode_macro CLEAR_TOOLHEAD_OFFSET]
# gcode:
# SET_GCODE_OFFSET x=0 y=0 z=0
[gcode_macro TOOL_ON]
gcode:
SET_PIN PIN=tool_power VALUE=1
#SET_PIN PIN=tool_power_led VALUE=1
[gcode_macro TOOL_OFF]
gcode:
SET_PIN PIN=tool_power VALUE=0
#SET_PIN PIN=tool_power_led VALUE=0
[gcode_macro HOME_ALL]
gcode:
G28 Z
G28 XY
SET_SKEW XY=1701.8,1700.6875,1200
# [gcode_macro PARK_TOOL]
# gcode:
# {action_respond_info("*** REMINDER: switch off spindle manually ***")}
# TOOL_OFF
# #CLEAR_TOOLHEAD_OFFSET
# G0 Z5
# G0 X40 Y50
# G1 Z25
# [gcode_macro PARK_REAR]
# gcode:
# {action_respond_info("*** REMINDER: switch off spindle manually ***")}
# TOOL_OFF
# #CLEAR_TOOLHEAD_OFFSET
# G0 Z0
# G1 X0 Y500
[gcode_macro FW_RESTART]
gcode:
FIRMWARE_RESTART
# [gcode_macro WORKSPACE_1]
# # Configured for 25.4mm stock height, 9mm spoilboard height, 6in stock width
# gcode:
# SET_GCODE_OFFSET x=0 y=0 z=0
# g0 z68
# g0 x322 y315
# g0 z64.4
# SET_GCODE_OFFSET x=322 y=315 z=39
# [gcode_macro TOOLCHANGE]
# gcode:
# g0 z36
# g0 x-40 y-40
also here is my modified mainsail.cfg, mainsail1.cfg
## Client klipper macro definitions
##
## Copyright (C) 2022 Alex Zellner <alexander.zellner@googlemail.com>
##
## 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]
#gcode:
[virtual_sdcard]
path: ~/printer_data/gcodes
on_error_gcode: CANCEL_PRINT
[pause_resume]
[display_status]
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
variable_park: True
gcode:
{action_respond_info("CANCEL_PRINT")}
## Move head and retract only if not already in the pause state and park set to true
{% if printer.pause_resume.is_paused|lower == 'false' and park|lower == 'true'%}
_TOOLHEAD_PARK_PAUSE_CANCEL
{% endif %}
#TURN_OFF_HEATERS
M106 S0
{action_respond_info("Calling cancel print base")}
CANCEL_PRINT_BASE
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read extrude from _TOOLHEAD_PARK_PAUSE_CANCEL macro #####
#{% set extrude = printer['gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL'].extrude %}
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
#{% if printer.extruder.can_extrude|lower == 'true' %}
# M83
# G1 E{extrude} F2100
# {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
#{% else %}
# {action_respond_info("Extruder not hot enough")}
#{% endif %}
RESUME_BASE {get_params}
[gcode_macro END_PRINT]
#rename_existing: END_PRINT_BASE
gcode:
{action_respond_info("END_PRINT")}
_TOOLHEAD_PARK_PAUSE_CANCEL
#Disable Steppers
M84 X Y
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:
{action_respond_info("_TOOLHEAD_PARK_PAUSE_CANCEL")}
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_minimum.x|float + 5.0 %}
{% set y_park = printer.toolhead.axis_minimum.y|float + 5.0 %}
{% set z_park_delta = 2.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set z_safe = max_z - z_park_delta %}
#{% set act_z = printer.toolhead.position.z|float %}
#{% if act_z < (max_z - z_park_delta) %}
# {% set z_safe = z_park_delta %}
#{% else %}
# {% set z_safe = max_z - act_z %}
#{% endif %}
##### end of definitions #####
#{% if printer.extruder.can_extrude|lower == 'true' %}
# M83
# G1 E-{extrude} F2100
# {% if printer.gcode_move.absolute_extrude |lower == 'true' %} M82 {% endif %}
#{% else %}
# {action_respond_info("Extruder not hot enough")}
#{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
{% set x_park = 101.0 %}
{% set y_park = 102.0 %}
{% set z_safe = 66.0 %}
{action_respond_info("Moving axis to safe positions")}
G90
G1 Z{z_safe} F900
G1 X{x_park} Y{y_park} F6000
{% if printer.gcode_move.absolute_coordinates|lower == 'false' %} G91 {% endif %}
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
{action_respond_info("_TOOLHEAD_PARK_PAUSE_CANCEL end")}
I just stumbled across this klipper fork that implements G38.2, naikymen/klipper-for-cnc. Going to research this a little more and see how it works
BTW, implementing stealthchop on the steppers makes them almost completely silent compared to default spreadcycle (using v1e provided steppers). At least during initial test moves, I didn’t see any additional rise in temp, not sure if there’s any downside to using stealthchop here