Skip to content

Instantly share code, notes, and snippets.

@tehmaze
Created February 28, 2022 11:08
Show Gist options
  • Save tehmaze/108c9b5827e5f3975ce73bc23faa4ad1 to your computer and use it in GitHub Desktop.
Save tehmaze/108c9b5827e5f3975ce73bc23faa4ad1 to your computer and use it in GitHub Desktop.
FLSUN SR Klipper config
# This file contains common pin mappings for the BIGTREETECH SKR V1.3 board used
# in the FLSUN SuperRacer. To use this config, the firmware should be compiled
# for the LPC1768.
[mcu]
# SKR 1.3 for stepper E+sensors+heaters
serial:
[mcu:abc]
# Supernova for steppers A,B,C
serial:
[printer]
kinematics: delta
#delta_radius: 132
print_radius: 132
minimum_z_position: -15
max_velocity: 1000
max_z_velocity: 25000
max_accel: 25000
max_accel_to_decel: 25000
square_corner_velocity: 15.0
#[include steppers_skr1.3.cfg]
[include steppers_supernova.cfg]
[extruder]
step_pin: E0_STEP
dir_pin: !E0_DIR
enable_pin: !E0_EN
microsteps: 16
full_steps_per_rotation: 200
rotation_distance: 5.50 # LGX Lite
nozzle_diameter: 0.4
filament_diameter: 1.750
heater_pin: HE0
sensor_type: PT1000
sensor_pin: TH0
pullup_resistor: 4700
#control: pid
#pid_Kp: 22.2
#pid_Ki: 1.08
#pid_Kd: 114
min_temp: 0
max_temp: 320
max_extrude_only_distance: 750
max_extrude_cross_section: 50 # 8 * 0.4^2
pressure_advance: 0.065
pressure_advance_smooth_time: 0.040
[tmc2209 extruder]
uart_pin: E0_RX
run_current: 0.600
hold_current: 0.30
[input_shaper]
shaper_freq_x: 41.67 # 100 * 4 / 9.61
shaper_freq_y: 39.84 # 100 * 5 / 12,55
shaper_type: ei
[heater_bed]
heater_pin: BED
sensor_type: ATC Semitec 104GT-2
sensor_pin: TB
min_temp: 0
max_temp: 130
#control: pid
[fan]
pin: FAN
[heater_fan extruder]
pin: HE1 # Using heater MOSFET for FAN PWM
heater: extruder
heater_temp: 55
fan_speed: 1.0
[heater_fan rebreather]
pin: P2.0
heater: heater_bed
heater_temp: 40
fan_speed: 1.0
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: -100
max_temp: 100
[temperature_sensor chamber]
sensor_type: ATC Semitec 104GT-2
sensor_pin: TH1
min_temp: 0
max_temp: 150
gcode_id: C
[filament_switch_sensor filament]
pause_on_runout: True
runout_gcode: PAUSE
switch_pin: ^X_MIN
#insert_gcode:
[probe]
pin: !Z_MIN
samples: 3
speed: 5
samples_result: median
samples_tolerance: 0.050
samples_tolerance_retries: 20
#z_offset: 25
#z_offset: 13.37
[endstop_phase]
[delta_calibrate]
radius: 125
speed: 20
horizontal_move_z: 25
[bed_mesh]
speed: 100
mesh_radius: 110
mesh_origin: 0,0
horizontal_move_z: 25
round_probe_count: 5
#algorithm: bicubic
######################
# Pins for the SKR 1.3
######################
[board_pins]
aliases:
# EXP1 header
EXP1_1=P1.30, EXP1_3=P1.18, EXP1_5=P1.20, EXP1_7=P1.22, EXP1_9=<GND>,
EXP1_2=P0.28, EXP1_4=P1.19, EXP1_6=P1.21, EXP1_8=P1.23, EXP1_10=<5V>,
# EXP2 header
EXP2_1=P0.17, EXP2_3=P3.26, EXP2_5=P3.25, EXP2_7=P1.31, EXP2_9=<GND>,
EXP2_2=P0.15, EXP2_4=P0.16, EXP2_6=P0.18, EXP2_8=<RST>, EXP2_10=<NC>,
# Limit switches
X_MAX=P1.28,
X_MIN=P1.29,
Y_MAX=P1.26,
Z_MIN=P1.25,
Z_MAX=P1.24,
# Motors
X_EN=P2.1, X_STEP=P2.2, X_DIR=P2.6, X_CS=P1.17, X_TX=P4.29, X_RX=P1.17,
Y_EN=P2.8, Y_STEP=P0.19, Y_DIR=P0.20, Y_CS=P1.15, Y_TX=P1.16, Y_RX=P1.15,
Z_EN=P0.21, Z_STEP=P0.22, Z_DIR=P2.11, Z_CS=P1.10, Z_TX=P1.14, Z_RX=P1.10,
E0_EN=P2.12, E0_STEP=P2.13, E0_DIR=P0.11, E0_CS=P1.8, E0_TX=P1.9, E0_RX=P1.8,
E1_EN=P0.10, E1_STEP=P0.1, E1_DIR=P0.0, E1_CS=P1.1, E1_TX=P1.4, E1_RX=P1.1,
# Heaters, fans and thermistors
BED=P2.5, HE0=P2.7, HE1=P2.4, FAN=P2.3,
TB=P0.23, TH0=P0.24, TH1=P0.25
# See the sample-lcd.cfg file for definitions of common LCD displays.
[virtual_sdcard]
path: ~/gcode
[save_variables]
filename: ~/klipper_config/variables.cfg
[display_status]
[respond]
default_type: command
[pause_resume]
[gcode_arcs]
#resolution: 1.0
# An arc will be split into segments. Each segment's length will
# equal the resolution in mm set above. Lower values will produce a
# finer arc, but also more work for your machine. Arcs smaller than
# the configured value will become straight lines. The default is
# 1mm.
# Pause print macro
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
{% set X = params.X|default(-75)|int %}
{% set Y = params.Y|default(-75)|int %}
{% set Z = params.Z|default(100)|int %}
{% set E = params.E|default(2.5)|float %}
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
{% if printer.toolhead.position.z|float > 300 %}
G1 Z300 F6000
{% endif %}
{% if printer.toolhead.position.z|float < Z %}
G1 Z{Z} F6000
{% endif %}
G91
G1 E-{E} F2100
G90
G1 X{X} Y{Y} F6000
# Resume print macro
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
{% set E = params.E|default(2.5)|float %}
G91
G1 E{E} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
# Cancel print macro
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
# This macro should be called at the 'start g-code' part
# of your slicer and you would put all the start g-code here
# instead so that you don't have to re-slice everytime you
# have to edit the commands
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(90)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(250)|float %}
{% set CHAMBER_TEMP = params.CHAMBER_TEMP|default(0)|float %}
{% set OFFSET = params.OFFSET|default(0)|float %}
{% set FLOWRATE = params.FLOWRATE|default(100)|float %}
M117 Initializing
G90
M83
G28
M200 D0
M220 S100
UPDATE_DELAYED_GCODE ID=LOAD_GCODE_OFFSETS DURATION=0.1
M117 Nozzle preheat
M104 S{EXTRUDER_TEMP} ; set extruder temp
M140 S{BED_TEMP} ; set bed temp
{% if printer['temperature_sensor chamber'].temperature|float < CHAMBER_TEMP %}
HEAT_SOAK BED={BED_TEMP} CHAMBER={CHAMBER_TEMP}
{% endif %}
M117 Final warmup
M104 S{EXTRUDER_TEMP} ; set extruder final temp
M190 S{BED_TEMP} ; wait for bed final temp
M109 S{EXTRUDER_TEMP} ; wait for extruder final temp
M300 S440 P200 ; 1st beep for printer ready and allow some time to clean nozzle
M300 S0 P250 ; wait between dual beep
M300 S440 P200 ; 2nd beep for printer ready
G4 S10 ; wait to clean the nozzle
M300 S440 P200 ; 3rd beep for ready to start printing
; Nozzle offset
G28
G1 Z325 F3000
;SET_GCODE_OFFSET Z=0.01 MOVE=1
;SET_GCODE_OFFSET Z={OFFSET} MOVE=1
G28
G92 E0.0; reset extrusion distance
M117 Preparing to print
M221 S{FLOWRATE}
M117 Priming
PRIME_LINE
M117 Printing
G90 ; Absolute move positioning
M82 ; Absolute extruder positioning
G92 E0 ; Reset extruder
[gcode_macro HEAT_SOAK]
gcode:
{% set SOAK_MINS = params.SOAK_MINS|default(30)|float %}
{% set BED = params.BED|default(90)|float %}
{% set CHAMBER = params.CHAMBER|default(25)|float %}
{% set HEATER = params.HEATER|default("heater_bed") %}
{% if CHAMBER|float >= 1 %}
M117 Heat soak
G28
G0 Z25 F6000
SET_HEATER_TEMPERATURE HEATER={HEATER} TARGET={BED}
{% for timer in range(SOAK_MINS|int,0,-1) %}
{% for second in range(60) %}
{% if second == 0 %}
RESPOND TYPE=command MSG="Heat soak {printer['temperature_sensor chamber'].temperature|float|round}C/{CHAMBER|float|round}C, max {timer} minutes left"
{% endif %}
{% if printer['temperature_sensor chamber'].temperature|float < CHAMBER|float %}
M117 Heat soak {printer['temperature_sensor chamber'].temperature|float}->{CHAMBER|float} ({timer}/{SOAK_MINS|int-1}.{60-second} min left)
M105
G4 P1000
{% endif %}
{% endfor %}
{% endfor %}
{% endif %}
M117 Heat soak ready
G28
# This macro should be called at the 'end g-code' part
# of your slicer and like the macro above, you would
# also put all of your end g-code here for the same reason as above
[gcode_macro END_PRINT]
gcode:
; printing object ENDGCODE
G92 E0.0 ; prepare to retract
G1 E-6 F3000; retract to avoid stringing
; Anti-stringing end wiggle
G1 X85 Y85 Z295 F3000 ; present print
; Reset print setting overrides
G92 E0
M200 D0 ; disable volumetric e
M220 S100 ; reset speed factor to 100%
M221 S100 ; reset extruder factor to 100%
;M900 K0 ; reset linear acceleration(Marlin)
; Shut down printer
M104 S0 ; turn off temperature
M140 S0 ; turn off heatbed
M107 ; turn off fan
G28 ; home
;M18 S180 ;disable motors after 180s
M300 S40 P10 ; Bip
M117 Print finish.
;SET_GCODE_OFFSET Z_ADJUST=0 # resets the z-offset (otherwise, )
# Stubs to satisfy PrusaSlicer & friends
[gcode_macro M200]
gcode:
[gcode_macro M201]
gcode:
[gcode_macro M202]
gcode:
[gcode_macro M203]
gcode:
[gcode_macro M205]
gcode:
[gcode_macro M300]
gcode:
[gcode_macro M486]
gcode:
# Convert Marlin linear advance (M900) commands to Klipper (SET_PRESSURE_ADVANCE) commands.
# For use with Marlin's linear advance calibration: https://marlinfw.org/tools/lin_advance/k-factor.html
[gcode_macro M900]
gcode:
# Parameters
{% set pa = params.K|float %}
SET_PRESSURE_ADVANCE ADVANCE={pa}
[include macros.cfg]
[gcode_macro SET_GCODE_OFFSET]
rename_existing: _SET_GCODE_OFFSET
gcode:
{% if printer.save_variables.variables.gcode_offsets %}
{% set offsets = printer.save_variables.variables.gcode_offsets %}
{% else %}
{% set offsets = {'x': None,'y': None,'z': None} %}
{% endif %}
{% set ns = namespace(offsets={'x': offsets.x,'y': offsets.y,'z': offsets.z}) %}
_SET_GCODE_OFFSET {% for p in params %}{'%s=%s '% (p, params[p])}{% endfor %}
{%if 'X' in params %}{% set null = ns.offsets.update({'x': params.X}) %}{% endif %}
{%if 'Y' in params %}{% set null = ns.offsets.update({'y': params.Y}) %}{% endif %}
{%if 'Z' in params %}{% set null = ns.offsets.update({'z': params.Z}) %}{% endif %}
SAVE_VARIABLE VARIABLE=gcode_offsets VALUE="{ns.offsets}"
[gcode_macro LOAD_OFFSETS]
gcode:
UPDATE_DELAYED_GCODE ID=LOAD_GCODE_OFFSETS DURATION=0.1
[delayed_gcode LOAD_GCODE_OFFSETS]
initial_duration: 2
gcode:
{% if printer.save_variables.variables.gcode_offsets %}
{% set offsets = printer.save_variables.variables.gcode_offsets %}
{ action_respond_info("Loading gcode offsets from saved variables [%s]" % (offsets)) }
_SET_GCODE_OFFSET {% for axis, offset in offsets.items() if offsets[axis] %}{ "%s=%s " % (axis, offset) }{% endfor %}
{% endif %}|
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 19.845
#*# pid_ki = 0.925
#*# pid_kd = 106.419
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 72.849
#*# pid_ki = 1.753
#*# pid_kd = 756.720
#*#
#*# [printer]
#*# delta_radius = 154.541571
#*#
#*# [stepper_a]
#*# angle = 210.705177
#*# arm_length = 317.703010
#*# position_endstop = 338.775534
#*#
#*# [stepper_b]
#*# angle = 330.275423
#*# arm_length = 312.775461
#*# position_endstop = 340.351917
#*#
#*# [stepper_c]
#*# angle = 90.000000
#*# arm_length = 314.271819
#*# position_endstop = 339.594359
#*#
#*# [probe]
#*# z_offset = 17.750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment