# This file is an example configuration for the Voron 2 CoreXY printer
# running on two RAMPS boards. This file was created by "Maglin".
# X/Y/E steppers/endstops/thermisters/heaters are on one MCU/RAMPS
# board while Z steppers/mechanical switch/endstop_pin are on the
# second MCU/RAMPS labeled z.

# This file is only an example - be sure to review and update it
# according to the specifics of your printer. See the example.cfg and
# example-extras.cfg files for a description of available parameters.

[mcu]
# mcu for X/Y/E steppers main MCU
serial: /dev/serial/by-path/platform-3f980000.usb-usb-0:1.3:1.0-port0
pin_map: arduino

[mcu z]
# mcu for the Z steppers
serial: /dev/serial/by-path/platform-3f980000.usb-usb-0:1.2:1.0-port0
pin_map: arduino

[stepper_x]
# use preceding ! to invert logic and ^ to activate internal 5V pullup
# this is for all pin definitions.  Not all pins have interal pullups
step_pin: ar54
dir_pin: ar55
enable_pin: !ar38
step_distance: 0.0125
endstop_pin: ^ar2
position_min: 0
position_endstop: 248
position_max: 248
homing_speed: 50

[stepper_y]
step_pin: ar60
dir_pin: ar61
enable_pin: !ar56
step_distance: 0.0125
endstop_pin: ^ar15
position_min: -5
position_endstop: 245
position_max: 245
homing_speed: 50

[stepper_z]
# X stepper pins on MCU Z
step_pin: z:ar54
dir_pin: z:ar55
enable_pin: !z:ar38
step_distance: 0.00625
# probe:z_virtual_endstop is a virtual pin definition only available if
# a probe section is defined
#endstop_pin: probe:z_virtual_endstop
# mechanical switch on mcu Z X min endstop pin
endstop_pin: ^z:ar3
position_endstop: -0.376
position_min: -5
position_max: 245
homing_speed: 12

[stepper_z1]
# Y stepper pins on MCU Z
step_pin: z:ar60
dir_pin: !z:ar61
enable_pin: !z:ar56
step_distance: 0.00625

[stepper_z2]
# Z stepper pins on MCU Z
step_pin: z:ar46
dir_pin: z:ar48
enable_pin: !z:ar62
step_distance: 0.00625

[stepper_z3]
# E0 stepper pins on MCU Z
step_pin: z:ar26
dir_pin: !z:ar28
enable_pin: !z:ar24
step_distance: 0.00625

# extended G-Code command Z_TILT_ADJUST can be used to level gantry
[z_tilt]
# belt locations from origin 0,0
z_positions:
    -56,-17
    -56,322
    311,322
    311,-17
# probing locations for gantry leveling
points:
    50,50
    50,195
    195,195
    195,50
# travel speed between probe points
speed: 150
# Move Z to this position for safe probing
horizontal_move_z: 15

# this is required for gantry leveling and replaces your G28 command
# with the gcode used here.  Used to home X/Y/Z with mechanical switches
[homing_override]
set_position_z: 0
gcode:
    G90
    G0 Z15 F600
    G28 X0 Y0
    G0 X248 Y225 F3000
    G28 Z
    G0 Z15 F6000

# macro to level the gantry.  use G32 in the terminal to call
[gcode_macro g32]
gcode:
    Z_TILT_ADJUST
    Z_TILT_ADJUST
    Z_TILT_ADJUST
    G28
    G0 X125 Y125 Z125 F3600

# Use print_start for you slicer starting script
[gcode_macro print_start]
gcode:
    G1 X0 Y15 Z0.3 F7000
    G92 E0
    G1 E14 F600
    G92 E0
    G1 X60.0 E9.0 F1000.0
    G1 X100.0 E12.5 F1000.0
    G1 E12 F1000.0
    G92 E-0.5

# Use print_end for you slicer ending script
[gcode_macro print_end]
gcode:
    M104 S0
    M140 S0
    M107
    G92 E0
    G91
    G1 Z10 E-10 F3000
    G90
    G0 X125 Y245 F1000

[extruder]
# on E0 stepper pins of main MCU
step_pin: ar26
dir_pin: ar28
enable_pin: !ar24
step_distance: 0.003339
nozzle_diameter: 0.400
filament_diameter: 1.750
max_extrude_only_distance: 100.0
heater_pin: ar10
max_power: 1.0
sensor_type: ATC Semitec 104GT-2
sensor_pin: analog13
control: pid
pid_Kp: 21.759
pid_Ki: 1.107
pid_Kd: 106.889
min_temp: 0
max_temp: 300

# thermally controlled hotend fan
[heater_fan my_nozzle_fan]
# Located on Z MCU on fan D9
pin: z:ar9

[probe]
# Z_Min pins on MCU Z (must be on same MCU as steppers)
pin: ^!z:ar18
z_offset: 1.15
speed: 2.0

[heater_bed]
heater_pin: ar8
# NTC 100K MGB18-104F39050L32 is for Kenovo thermistors
sensor_type: NTC 100K MGB18-104F39050L32
sensor_pin: analog14
# pid gives you better control over bed heat
control: pid
pid_Kp: 63.832
pid_Ki: 3.404
pid_Kd: 299.213
min_temp: 0
max_temp: 130

# print cooling fan
[fan]
# On z MCU on extruder heater pin D10
pin: z:ar10

# "RepRapDiscount 2004 Smart Controller" type displays
#[display]
#lcd_type: hd44780
#rs_pin: ar16
#e_pin: ar17
#d4_pin: ar23
#d5_pin: ar25
#d6_pin: ar27
#d7_pin: ar29

# "RepRapDiscount 128x64 Full Graphic Smart Controller" type displays
[display]
lcd_type: st7920
cs_pin: ar16
sclk_pin: ar23
sid_pin: ar17

[printer]
# settings below are the max and can't be commanded over in gcode
kinematics: corexy
max_velocity: 500
max_accel: 3000
max_z_velocity: 100
max_z_accel: 50

[idle_timeout]
# high motor off time so I don't have to relevel gantry often
timeout: 6000
