#############################################################################################################
### CONFIGURATION GENERATED BY THE RATOS CONFIGURATOR
### Everything below [include RatOS.cfg] will override default RatOS behavior
#############################################################################################################
[include RatOS.cfg]

#############################################################################################################
### MACRO CONFIGURATION
### Configure the behavior of RatOS macros
### See: https://os.ratrig.com/docs/configuration/macros
#############################################################################################################
[gcode_macro RatOS]
variable_relative_extrusion: False
variable_preheat_extruder: True
variable_calibrate_bed_mesh: True
variable_nozzle_priming: "primeblob"
variable_start_print_park_in: "back"
variable_start_print_park_z_height: 50
variable_end_print_park_in: "back"
variable_pause_print_park_in: "back"

#############################################################################################################
### USER OVERRIDES & CUSTOM CONFIGURATION
### Anything custom you want to add, or RatOS configuration you want to override, do it here.
### This section is pre-populated with the most common settings you may want to change.
### See: https://os.ratrig.com/docs/configuration/includes-and-overrides
###
### It is recommended that you follow these steps to properly calibrate your printer:
### 0) Sanity check and PID Tuning: https://www.klipper3d.org/Config_checks.html
### 1) Z-offset calibration: run BEACON_RATOS_CALIBRATE to automatically calibrate your beacon for scan and contact.
###    IMPORTANT: Ensure the beacon is properly mounted and the nozzle and meltzone is clean by unloading
###    the filament (if it's loaded) and make sure there's no ooze or gunk on the nozzle when the hotend is at printing temperature.
### 2) Pressure Advance: https://www.klipper3d.org/Pressure_Advance.html
### 3) Skew Correction: https://www.klipper3d.org/Skew_Correction.html
### 4) Resonance Compensation: https://www.klipper3d.org/Resonance_Compensation.html
### RatOS has dedicated macro's to generate shaper graphs for deeper analysis (requires accelerometer).
### Use MEASURE_COREXY_BELT_TENSION to compare tension between belts, and use
### GENERATE_SHAPER_GRAPHS to generate the resonance graphs for analysing and manually entering input shaper
### configuration.
### You can run SHAPER_CALIBRATE to automatically calibrate your input shaper configuration, if you just want
### to get started.
### Additionally, you can use the Realtime Analysis Tool to analyze your printer's performance in real-time.
### Read more about klipper here: https://www.klipper3d.org/Overview.html
#############################################################################################################

#---------------------------------------------------- X -----------------------------------------------------
# The A motor in the CoreXY system, located at the rear left of the printer
#------------------------------------------------------------------------------------------------------------
[stepper_x]
dir_pin: x_dir_pin                 # Add ! in front of pin name to reverse the direction of stepper_x
rotation_distance: 40              # 40 for 20 tooth 2GT pulleys, 32 for 16 tooth 2GT pulleys
homing_speed: 50
position_min: 0
position_max: 300
position_endstop: 0

#---------------------------------------------------- Y -----------------------------------------------------
# The B motor in the CoreXY system, located at the rear right of the printer
#------------------------------------------------------------------------------------------------------------
[stepper_y]
dir_pin: y_dir_pin                 # Add ! in front of pin name to reverse the direction of stepper_y
rotation_distance: 40              # 40 for 20 tooth 2GT pulleys, 32 for 16 tooth 2GT pulleys
homing_speed: 50
position_min: 0
position_max: 300
position_endstop: 300

#---------------------------------------------------- Z -----------------------------------------------------
# The left Z motor for the kinematic bed
#------------------------------------------------------------------------------------------------------------
[stepper_z]
dir_pin: !z0_dir_pin               # Remove ! in front of pin name to reverse the direction of stepper_z
rotation_distance: 4               # 4 for TR8*4 lead screws
homing_speed: 10
position_min: -5
position_max: 300

#---------------------------------------------------- Z1 ----------------------------------------------------
# The rear Z motor for the kinematic bed
#------------------------------------------------------------------------------------------------------------
[stepper_z1]
dir_pin: !z1_dir_pin               # Remove ! in front of pin name to reverse the direction of stepper_z1
rotation_distance: 4               # 4 for TR8*4 lead screws

#---------------------------------------------------- Z2 ----------------------------------------------------
# The right Z motor for the kinematic bed
#------------------------------------------------------------------------------------------------------------
[stepper_z2]
dir_pin: !z2_dir_pin               # Remove ! in front of pin name to reverse the direction of stepper_z2
rotation_distance: 4               # 4 for TR8*4 lead screws

#------------------------------------------------- EXTRUDER -------------------------------------------------
# The extruder motor used for pushing filament through the toolhead
#------------------------------------------------------------------------------------------------------------
[extruder]
dir_pin: !toolboard_t0:e_dir_pin   # Remove ! in front of pin name to reverse the direction of extruder
rotation_distance: 4.63            # Orbiter 2 default
#pressure_advance: 0.05            # Check https://www.klipper3d.org/Pressure_Advance.html for pressure advance tuning.
control: pid
pid_kp: 28.413
pid_ki: 1.334
pid_kd: 151.300


[heater_bed]
control: pid
pid_Kp: 22.2
pid_Ki: 1.08
pid_Kd: 114



# REMEMBER TO CALIBRATE YOUR BEACON!
# Run BEACON_RATOS_CALIBRATE for automatic calibration.