nixos-config/2configs/home/3dprint/printer-artillery-sidewinder-x2-2022.cfg
2024-05-31 11:11:34 +02:00

561 lines
14 KiB
INI

# This file contains pin mappings for the Artillery Sidewinder X2 (2022)
# with a Artillery_Ruby-v1.2 board. To use this config, during "make menuconfig"
# select the STM32F401 with "No bootloader" and USB (on PA11/PA12)
# communication.
# To flash this firmware, set the physical bridge between +3.3V and Boot0 PIN
# on Artillery_Ruby mainboard. Then run the command:
# make flash FLASH_DEVICE=/dev/serial/by-id/usb-Klipper_stm32f401xc_*-if00
# See docs/Config_Reference.md for a description of parameters.
#
# also do https://3dprintbeginner.com/fix-octoprint-always-on-printer-display/
[stepper_x]
step_pin: !PB14
dir_pin: PB13
enable_pin: !PB15
microsteps: 16
rotation_distance: 40
endstop_pin: !PA2
position_endstop: 0
position_max: 300
homing_speed: 50
second_homing_speed: 10
[stepper_y]
step_pin: PB10
dir_pin: PB2
enable_pin: !PB12
microsteps: 16
rotation_distance: 40
endstop_pin: !PA1
position_endstop: 0
position_max: 300
homing_speed: 50
second_homing_speed: 10
[stepper_z]
step_pin: PB0
dir_pin: !PC5
enable_pin: !PB1
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_max: 410
homing_speed: 10
second_homing_speed: 2
[extruder]
step_pin: PA7
dir_pin: PA6
enable_pin: !PC4
microsteps: 16
rotation_distance: 20.925
gear_ratio: 66:22
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PC9
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC0
control: pid
pid_kp: 20.860
pid_ki: 1.131
pid_kd: 96.218
min_temp: 0
max_temp: 280
# 2024-01-23 with test print as stated in https://www.klipper3d.org/Pressure_Advance.html
# Geeetech PEGT green
pressure_advance: 0.075
max_extrude_only_distance: 150
[heater_bed]
heater_pin: PA8
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC1
control: pid
pid_kp: 42.365
pid_ki: 0.545
pid_kd: 822.940
min_temp: 0
max_temp: 130
[fan]
pin: PC8
off_below: 0.1
[heater_fan extruder]
pin: PC7
off_below: 0.2
[controller_fan case]
pin: PC6
off_below: 0.3
idle_speed: 0.0
[temperature_sensor mainboard]
sensor_type: temperature_mcu
min_temp: 10
max_temp: 60
[bltouch]
sensor_pin: PC2
control_pin: PC3
x_offset:27.25
y_offset:-12.8
z_offset: 0.679
samples: 3
samples_tolerance: 0.050
samples_tolerance_retries: 3
[safe_z_home]
home_xy_position: 150,150
z_hop: 15
[bed_mesh]
speed: 100
mesh_min: 27.25, 12.8
mesh_max: 272.75, 287.2
algorithm: bicubic
probe_count: 5,5
mesh_pps: 3
fade_end: 10
[bed_screws]
screw1: 50,50
screw1_name: front left
screw2: 250,50
screw2_name: front right
screw3: 250,250
screw3_name: back right
screw4: 50,250
screw4_name: back left
speed: 100.0
[screws_tilt_adjust]
screw1: 23,63
screw1_name: front left
screw2: 223,63
screw2_name: front right
screw3: 223,263
screw3_name: back right
screw4: 23,263
screw4_name: back left
speed: 100.0
screw_thread: CW-M5
[mcu]
serial: /dev/ttyACM0
[neopixel extruder_led]
pin: PB7
initial_RED: 1.0
initial_GREEN: 1.0
initial_BLUE: 1.0
[printer]
kinematics: cartesian
max_velocity: 250
max_accel: 1500
max_z_velocity: 50
max_z_accel: 400
square_corner_velocity: 5.0
# for fluidd
[display_status]
[pause_resume]
[virtual_sdcard]
path: /var/lib/moonraker/gcodes
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
# change this if you need more or less extrusion
variable_extrude: 1.0
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% if act_z < (max_z - 2.0) %}
{% set z_safe = 2.0 %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe} F900
G90
G1 X{x_park} Y{y_park} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
#### 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' %}
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
[gcode_macro UNLOAD_FILAMENT]
gcode:
M83
G92 E0.0
G1 E-100 F500
G92 E0.0
M82
[gcode_macro LOAD_FILAMENT]
gcode:
M83
G92 E0.0
G1 E125 F150
G1 E-35 F2400
G92 E0.0
M82
[gcode_macro PID_EXTRUDER]
gcode:
M106 S255
{% set TARGET_TEMP = params.TARGET_TEMP|default(210)|float %}
PID_CALIBRATE HEATER=extruder TARGET={TARGET_TEMP}
[gcode_macro PID_BED]
gcode:
{%set TARGET_TEMP = params.TARGET_TEMP|default(70)|float %}
PID_CALIBRATE HEATER=heater_bed TARGET={TARGET_TEMP}
[gcode_macro MATERIAL_PA]
gcode:
{% set MATERIAL = params.MATERIAL|default("PLA")|string %}
{% set TEXT ="Setting PA for " + MATERIAL %}
{% if MATERIAL == "PLA" %}
SET_PRESSURE_ADVANCE ADVANCE=0.068
{% elif MATERIAL == "PETG" %}
# default: SET_PRESSURE_ADVANCE ADVANCE=0.075
# 2024-01-23 PETG Green
# SET_PRESSURE_ADVANCE ADVANCE=0.089
# 2024-01-23 PETG Black
SET_PRESSURE_ADVANCE ADVANCE=0.075
{% elif MATERIAL == "TPU" %}
SET_PRESSURE_ADVANCE ADVANCE=0.0460
{% else %}
{% set TEXT ="No PA value for " + MATERIAL %}
{% endif %}
# _DISPLAYTEXT TEXT="{TEXT}">
[gcode_macro LOCK_Z_STEPPERS]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=1
[gcode_macro UN_LOCK_Z_STEPPERS]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=0
[gcode_macro MOVE_TO_NEUTRAL_POSITION]
gcode:
g28; home all axis
g90; set to absolute positioning
g1 x150 y150 f9000
g1 z100 f3000
[gcode_macro CALIBRATE_PROBE]
gcode:
g28 ; home all axis
PROBE_CALIBRATE
[gcode_macro CALIBRATE_SCREWS]
gcode:
SCREWS_TILT_CALCULATE
[gcode_macro START_PRINT]
gcode:
#Get Printer built volume dimensions
{% set X_MAX = printer.toolhead.axis_maximum.x|default(100)|float %}
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(100)|float %}
{% set Z_MAX = printer.toolhead.axis_maximum.z|default(100)|float %}
#Get Nozzle diameter and filament width for conditioning
{% set NOZZLE = printer.extruder.nozzle_diameter|default(0.4)|float %}
#Set Start coordinates of priming lines
{% set X_START = 2.0|default(2.0)|float %}
{% set Y_START = 20.0|default(20.0)|float %}
#Get Bed and Extruder temperature from Slicer GCode
{% set BED_TEMP = params.BED_TEMP|default(60)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %}
SET_LED LED=extruder_led RED=1 GREEN=0 BLUE=0
M117 Preheat nozzle and bed
M104 S{EXTRUDER_TEMP}
M140 S{BED_TEMP}
# Reset the G-Code Z offset (adjust Z offset if needed)
SET_GCODE_OFFSET Z=0.0 MOVE=1
G28
# {% if not "x" in printer.toolhead.homed_axes %}
# {% if not "y" in printer.toolhead.homed_axes %}
# {% if not "z" in printer.toolhead.homed_axes %}
# G28
# {% else %}
# G28 X Y
# {% endif %}
# {% else %}
# {% if not "z" in printer.toolhead.homed_axes %}
# G28 X Z
# {% else %}
# G28 X
# {% endif %}
# {% endif %}
# {% else %}
# {% if not "y" in printer.toolhead.homed_axes %}
# {% if not "z" in printer.toolhead.homed_axes %}
# G28 Y Z
# {% else %}
# G28 Y
# {% endif %}
# {% else %}
# {% if not "z" in printer.toolhead.homed_axes %}
# G28 Z
# {% endif %}
# {% endif %}
# {% endif %}
# {% if not "x" in printer.toolhead.homed_axes %} # If X-Axis not homed.
# M117 Homing X-Axis...
# G28 X0
# {% endif %}
# {% if not "y" in printer.toolhead.homed_axes %} # If Y-Axis not homed.
# M117 Homing Y-Axis...
# G28 Y0
# {% endif %}
# {% if not "z" in printer.toolhead.homed_axes %} # If Y-Axis not homed.
# M117 Homing Z-Axis...
# G28 Z0
# {% endif %}
# Use the bed mesh
BED_MESH_PROFILE LOAD=default
#Move up to clean bed
G1 Y{Y_START} Z{Z_MAX/4.0} F6000
SET_LED LED=extruder_led RED=1 GREEN=1 BLUE=0
M117 Heat nozzle and bed
M190 S{BED_TEMP}
M109 S{EXTRUDER_TEMP}
PRIME_LINE
M117 Printing
[gcode_macro PRIME_LINE]
gcode:
#Get Printer built volume dimensions
{% set X_MAX = printer.toolhead.axis_maximum.x|default(100)|float %}
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(100)|float %}
{% set Z_MAX = printer.toolhead.axis_maximum.z|default(100)|float %}
#Get Nozzle diameter and filament width for conditioning
{% set NOZZLE = printer.extruder.nozzle_diameter|default(0.4)|float %}
#Set Start coordinates of priming lines
{% set X_START = 2.0|default(2.0)|float %}
{% set Y_START = 20.0|default(20.0)|float %}
#Calculate Primer line extrusion volume and filament length
{% set NOZZLE75 = 0.75 * NOZZLE %}
SET_LED LED=extruder_led RED=0 GREEN=1 BLUE=0
M117 Print prime Line
#Precondition extruder
G92 E0 ; reset extruder
G1 Z2.0 F3000 ; move z up little to prevent scratching of surface
G1 X{X_START} Y{Y_START + 20} Z{NOZZLE75} F5000.0 ; move to start-line position
G1 X{X_START} Y{Y_START + 20 + 160.0} Z{NOZZLE75} F1500.0 E15 ; draw 1st line
G1 X{X_START + NOZZLE / 2.0} Y{Y_START + 180.0} Z{NOZZLE} F5000.0 ; move to side a little
G1 X{X_START + NOZZLE / 2.0} Y{Y_START} Z{NOZZLE} F1500.0 E30 ; draw 2nd line
G92 E0 ; reset extruder
G1 Z2.0 F3000 ; move z up little to prevent scratching of surface
SET_LED LED=extruder_led RED=1 GREEN=1 BLUE=1
[gcode_macro END_PRINT]
gcode:
#Get Printer built volume dimensions
{% set Y_START = 2.0|default(2.0)|float %}
{% set X_MAX = printer.toolhead.axis_maximum.x|default(100)|float %}
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(100)|float %}
{% set Z_MAX = printer.toolhead.axis_maximum.z|default(100)|float %}
SET_LED LED=extruder_led RED=1 GREEN=0 BLUE=0
M117 Fix-up extruder
G91
G1 E-2 F2700
G1 E-1.5 Z0.2 F2400
G1 X5 Y5 F6000
G1 Z10
G90
M117 Present print
{% if printer.toolhead.position.z + 10 > Z_MAX/4.0 %}
G1 X{X_MAX / 2} Y{Y_MAX * 0.8} Z{printer.toolhead.position.z + 10} F6000
{% else %}
G1 X{X_MAX / 2} Y{Y_MAX * 0.8} Z{Z_MAX/4.0} F6000
{% endif %}
M117 Poweroff
M106 S0
M104 S0
M140 S0
M84 #Disable Steppers
SET_LED LED=extruder_led RED=0 GREEN=0 BLUE=0
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
SET_LED LED=extruder_led RED=0 GREEN=0 BLUE=1
PAUSE_BASE
_TOOLHEAD_PARK_PAUSE_CANCEL
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
SET_LED LED=extruder_led RED=0 GREEN=1 BLUE=0
##### 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}
SET_LED LED=extruder_led RED=1 GREEN=1 BLUE=1
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
variable_park: True
gcode:
## 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
CANCEL_PRINT_BASE
SET_LED LED=extruder_led RED=0 GREEN=0 BLUE=0
[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL]
description: Helper: park toolhead used in PAUSE and CANCEL_PRINT
variable_extrude: 1.0
gcode:
SET_LED LED=extruder_led RED=1 GREEN=1 BLUE=0
##### set park positon for x and y #####
# default is your max posion from your printer.cfg
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% set z_park_delta = 2.0 %}
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% 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 %}
G91
G1 Z{z_safe} F900
G90
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 %}
# added via klipper configuration logic
# to generate:
# chmod 777 /etc and then
# calibrate and SAVE_CONFIG
[bed_mesh default]
version = 1
points =
-0.077500, 0.015833, 0.052500, 0.030000, -0.035000
-0.070000, 0.000833, 0.054167, 0.026667, -0.018333
-0.067500, -0.020000, 0.005833, -0.007500, -0.027500
-0.035000, -0.022500, -0.017500, -0.025833, -0.040000
-0.063333, -0.087500, -0.062500, -0.077500, -0.030833
x_count = 5
y_count = 5
mesh_x_pps = 3
mesh_y_pps = 3
algo = bicubic
tension = 0.2
min_x = 27.25
max_x = 272.72
min_y = 12.8
max_y = 287.15999999999997