Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IS configs, Dragon HF, etc #48

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
printer.cfg
18 changes: 18 additions & 0 deletions hotends/dragon-high-flow.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# WARNING. DO NOT EDIT THIS FILE.
# To override settings from this file, you can copy and paste the relevant
# sections into your printer.cfg and change it there.


[extruder]
max_extrude_only_distance: 200
agravelot marked this conversation as resolved.
Show resolved Hide resolved
max_temp: 295
min_extrude_temp: 170
min_temp: 0
nozzle_diameter: 0.4
pressure_advance: 0.05
pid_Kp: 21.645
pid_Ki: 1.781
pid_Kd: 65.746

[firmware_retraction]
retract_length: 0.3
110 changes: 110 additions & 0 deletions macros/MECHANICAL_GANTRY_CALIBRATION.cfg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
###############################################################################
# Source https://github.com/strayr/strayr-k-macros/blob/e0807570a66d28735cf05143b105ab4ea6d9798f/mechanical_level_tmc2209.cfg
#
# Mechanical Gantry Calibration
#
# Requires TMC2209 drivers with UART control, some tuning and perhaps
# some printed endstops.
#
# Based on on (depricated) M915 and now alternate G34 from Marlin
# I beleive Prusa use this, certainly there's older videos advising to just
# ram the gantry at full current into the the z-max stops.
#
# It moves the gantry to the top of the travel, drops the current and then
# does a force move to force the steppers to stall against the physical end
# stops, transfering the level of the frame to the gantry.
#
# This is the only way to programatically level a multi-stepper single-driver
# gantry. It may also help with a dual-driver gantry on a bed-slinger design
# or where the plane of the bed is less trustworthy than the frame.
#
# It's particularly risky doing Z_TILT_ADJUST and SCREWS_TILT_CALCULATE
# without a mechanical reference as if one side of the gantry or bed is prone
# to droop, over time both bed and gantry will skew excessively but still read
# as level, so this can help transfer "level" from the frame to the gantry and
# then to the bed.
#
# I don't recommend doing this in a START_PRINT, I call this if a
# SCREWS_TILT_CALCULATE shows some drift, althoughon an Ender 3 type printer
# it's prudent to check the v-slot rollers for correct adjustment if drift is
# observed.
#
# It's probably best to run this and then do SCREWS_TILT_CALCULATE
# until the bed is really level. IF you have dual Z steppers you can then
# use Z_TILT_ADJUST for subsequent leveling of the gantry but make sure you
# use the same points for gantry level as you use in SCREWS_TILT_CALCULATE
#
# It may damage your printer if you do this at too high a current, or don't
# have proper endstops.
#
# HERE BE DRAGONS!
# YOU WERE WARNED!
#
# Here's a video of this in action
# https://www.youtube.com/watch?v=aVdIeIIpUAk
# and the endstops for 2020 v-slot
# https://www.thingiverse.com/thing:4848479

[gcode_macro MECHANICAL_GANTRY_CALIBRATION]
gcode:
### SET THIS DEFAULT CARFULLY - start really low
{% set my_current = params.CURRENT|default(0.20)|float %} ; adjust crash current on the fly :D
###
{% set oldcurrent = printer.configfile.settings["tmc2130 stepper_z"].run_current %}
{% set oldhold = printer.configfile.settings["tmc2130 stepper_z"].hold_current %}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if hold_current is set, imo we should not deal with it anymore.

{% set x_max = printer.toolhead.axis_maximum.x %}
{% set y_max = printer.toolhead.axis_maximum.y %}
{% set z_max = printer.toolhead.axis_maximum.z %}
{% set fast_move_z = printer.configfile.settings["printer"].max_z_velocity %}
{% set fast_move = printer.configfile.settings["printer"].max_velocity %}
M117 {printer.homed_axes}
{% if printer.homed_axes != 'xyz' %}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before doing any move, we need to save & restore states

G28 ; Home All Axes
{% endif %}
G90 ; absolute
G0 X{x_max / 2} Y{y_max / 2} F{fast_move * 30 } ;put toolhead in the center of the gantry

G0 Z{z_max -5} F{fast_move_z * 60 } ; go to the Z-max - 5 at speed max z speed ; CHANGED

SET_TMC_CURRENT STEPPER=stepper_z CURRENT={my_current} ; drop current on Z stepper

{% if printer.configfile.settings["stepper_z1"] %} ; test for dual Z
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={my_current} ; drop current
{% endif %}

CONDITIONAL_BEEP I=1
G4 P200 ; Probably not necessary, it is here just for sure

SET_KINEMATIC_POSITION Z={z_max - 25} ; Trick printer into beleiving the gantry is 25mm lower than it is ; CHANGED

G1 Z{z_max} F{6 * 60} ; based on above figures, there will be 20mm worth of grinding ; CHANGED
CONDITIONAL_BEEP I=2
G4 P10000 ; wait 10 seconds
G1 Z{z_max -6} F{6 * 60} ; move 4mm down
CONDITIONAL_BEEP I=3
G4 P200 ; same as the first one

SET_TMC_CURRENT STEPPER=stepper_z CURRENT={oldcurrent} HOLDCURRENT={oldhold}

{% if printer.configfile.settings["stepper_z1"] %} ; test for dual Z
SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={oldcurrent} HOLDCURRENT={oldhold} ; reset current
{% endif %}

G1 Z{z_max -30} F{6 * 60} ; move to 30mm below z-max to allow homing movement

G4 P200 ; same as the first one
G28 Z ; we MUST home again as the ganty is really in the wrong place.

[gcode_macro G34]
gcode:
MECHANICAL_GANTRY_CALIBRATION

[menu __main __setup __calib __mech_gantry_calibrate]
type: command
enable: {not printer.idle_timeout.state == "Printing"}
name: G34 Gantry Level
gcode:
G34

[force_move]
enable_force_move: true ; enable FORCE_MOVE and SET_KINEMATIC_POSITION
112 changes: 112 additions & 0 deletions macros/TEST_SPEED.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# NOTE Find how to use instructions here: https://ellis3dp.com/Print-Tuning-Guide/articles/determining_max_speeds_accels.html
# Home, get position, throw around toolhead, home again.
# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured.
# We only measure to a full step to accomodate for endstop variance.
# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10

[gcode_macro TEST_SPEED]
gcode:
# Speed
{% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
# Iterations
{% set iterations = params.ITERATIONS|default(5)|int %}
# Acceleration
{% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
# Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
{% set bound = params.BOUND|default(20)|int %}
# Size for small pattern box
{% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %}

# Large pattern
# Max positions, inset by BOUND
{% set x_min = printer.toolhead.axis_minimum.x + bound %}
{% set x_max = printer.toolhead.axis_maximum.x - bound %}
{% set y_min = printer.toolhead.axis_minimum.y + bound %}
{% set y_max = printer.toolhead.axis_maximum.y - bound %}

# Small pattern at center
# Find X/Y center point
{% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %}
{% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %}

# Set small pattern box around center point
{% set x_center_min = x_center - (smallpatternsize/2) %}
{% set x_center_max = x_center + (smallpatternsize/2) %}
{% set y_center_min = y_center - (smallpatternsize/2) %}
{% set y_center_max = y_center + (smallpatternsize/2) %}

# Save current gcode state (absolute/relative, etc)
SAVE_GCODE_STATE NAME=TEST_SPEED

# Output parameters to g-code terminal
{ action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) }

# Home and get position for comparison later:
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28
# QGL if not already QGLd (only if QGL section exists in config)
{% if printer.configfile.settings.quad_gantry_level %}
{% if printer.quad_gantry_level.applied == False %}
QUAD_GANTRY_LEVEL
G28 Z
{% endif %}
{% endif %}
# Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24)
G90
G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60}
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28 X Y
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
G4 P1000
GET_POSITION

# Go to starting position
G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60}

# Set new limits
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2}

{% for i in range(iterations) %}
# Large pattern diagonals
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}

# Large pattern box
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}

# Small pattern diagonals
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}

# Small patternbox
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
{% endfor %}

# Restore max speed/accel/accel_to_decel to their configured values
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}

# Re-home and get position again for comparison:
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12
# Go to XY home positions (in case your homing override leaves it elsewhere)
G90
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
G4 P1000
GET_POSITION

# Restore previous gcode state (absolute/relative, etc)
RESTORE_GCODE_STATE NAME=TEST_SPEED
12 changes: 12 additions & 0 deletions macros/adxl-direct.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Documentation https://www.klipper3d.org/Measuring_Resonances.html?h=adxl#configure-adxl345-with-rpi
# Documentation https://www.klipper3d.org/RPi_microcontroller.html

[mcu rpi]
serial: /tmp/klipper_host_mcu

[adxl345]
cs_pin: rpi:None

[resonance_tester]
accel_chip: adxl345
probe_points: 125, 105, 20 # Bed size set for Prusa Mk52 Bed.
9 changes: 9 additions & 0 deletions macros/adxl-kusba-rampon.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[mcu rampon]
serial: /dev/serial/by-id/usb-Anchor_Rampon-if00

[adxl345]
cs_pin: rampon:CS

[resonance_tester]
accel_chip: adxl345
probe_points: 125, 105, 20 # Bed size set for Prusa Mk52 Bed.
File renamed without changes.
2 changes: 2 additions & 0 deletions mk3s/einsy-rambo.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,5 @@ path: ~/printer_data/gcodes

[force_move]
enable_force_move: True

[exclude_object]
41 changes: 41 additions & 0 deletions moonraker.conf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sceptical on the idea to push a moonraker config

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[server]
host: 0.0.0.0
port: 7125
klippy_uds_address: /home/pi/printer_data/comms/klippy.sock

[authorization]
trusted_clients:
10.0.0.0/16
10.0.0.0/8
127.0.0.0/8
169.254.0.0/16
172.16.0.0/12
192.168.0.0/16
FE80::/10
::1/128
cors_domains:
http://*.lan
http://*.local
https://my.mainsail.xyz
http://my.mainsail.xyz
https://app.fluidd.xyz
http://app.fluidd.xyz

[octoprint_compat]

[history]

[update_manager]
channel: dev
refresh_interval: 168

[update_manager mainsail]
type: web
channel: stable
repo: mainsail-crew/mainsail
path: ~/mainsail

[file_manager]
# NOTE Cancel objects feature is enabled. If you're using a low powered device, set to False.
# Also see [exclude_object] section in printer.cfg.
enable_object_processing: True
23 changes: 12 additions & 11 deletions printer.template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,24 @@ serial: /dev/serial0 # If you are using internal RPI serial port
restart_method: command

### CONTROL BOARD
[include klipper-prusa-mk3s/mk3s/einsy-rambo.cfg]
[include ./mk3s/einsy-rambo.cfg]

### BASE SETUP
[include klipper-prusa-mk3s/mk3s/display.cfg]
[include klipper-prusa-mk3s/mk3s/steppers.cfg]
[include klipper-prusa-mk3s/mk3s/tmc2130.cfg]
[include ./mk3s/display.cfg]
[include ./mk3s/steppers.cfg]
[include ./mk3s/tmc2130.cfg]

### EXTRUSION

# Extruder
[include klipper-prusa-mk3s/extruders/prusa.cfg]
# [include klipper-prusa-mk3s/extruders/bmg.cfg]
[include ./extruders/prusa.cfg]
# [include./extruders/bmg.cfg]

# Hotend
[include klipper-prusa-mk3s/hotends/v6.cfg]
# [include klipper-prusa-mk3s/hotends/dragon-standard-flow.cfg]
# [include klipper-prusa-mk3s/hotends/rapido.cfg]
[include ./hotends/v6.cfg]
# [include ./hotends/dragon-standard-flow.cfg]
# [include ./hotends/dragon-high-flow.cfg]
# [include ./hotends/rapido.cfg]

Comment on lines +27 to 45
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These include paths will probably not work with the current recommended installation instructions.

[extruder]
# To tune Pressure Advance see https://www.klipper3d.org/Pressure_Advance.html
Expand Down Expand Up @@ -81,10 +82,10 @@ pid_Kd: 139.595

# Linear correction
# Check `extruders/linear-correction` for more informations.
[include klipper-prusa-mk3s/extruders/linear-correction/linear-correction-0.cfg] # Default Prusa linear correction optimized for LDO motors
[include ./extruders/linear-correction/linear-correction-0.cfg] # Default Prusa linear correction optimized for LDO motors

### MACROS
[include klipper-prusa-mk3s/macros.cfg]
[include ./macros/macros.cfg]

# FIRST RUN:
# Execute these sequentially in the console, let PID tuning finish before saving
Expand Down