From 3dc848346a83706ee6b415a0f059449959107c57 Mon Sep 17 00:00:00 2001 From: alextwothousand Date: Mon, 18 Dec 2023 12:39:51 +0000 Subject: [PATCH 01/10] add gitignore --- .gitignore | 1 + moonraker.conf | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .gitignore create mode 100644 moonraker.conf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..18a1152 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +printer.cfg \ No newline at end of file diff --git a/moonraker.conf b/moonraker.conf new file mode 100644 index 0000000..f429422 --- /dev/null +++ b/moonraker.conf @@ -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 \ No newline at end of file From 554e8cb91bb6ae4d097ef01b5a3be6d98dbc9e21 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:21:34 +0000 Subject: [PATCH 02/10] add Dragon HF hotend --- hotends/dragon-high-flow.cfg | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 hotends/dragon-high-flow.cfg diff --git a/hotends/dragon-high-flow.cfg b/hotends/dragon-high-flow.cfg new file mode 100644 index 0000000..275350f --- /dev/null +++ b/hotends/dragon-high-flow.cfg @@ -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 +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 From 08d2ce9f60192de4cebec106c5bd69b606fc5c39 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:22:41 +0000 Subject: [PATCH 03/10] Add exclude_object support So that KAMP can be used --- mk3s/einsy-rambo.cfg | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mk3s/einsy-rambo.cfg b/mk3s/einsy-rambo.cfg index 0ccc8a1..93afbfa 100644 --- a/mk3s/einsy-rambo.cfg +++ b/mk3s/einsy-rambo.cfg @@ -166,3 +166,5 @@ path: ~/printer_data/gcodes [force_move] enable_force_move: True + +[exclude_object] From 739720d82f94e9e10f7a87589cf425daa68b471a Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:27:19 +0000 Subject: [PATCH 04/10] Make all paths relative --- printer.template.cfg | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/printer.template.cfg b/printer.template.cfg index 3e2d218..6adfce8 100644 --- a/printer.template.cfg +++ b/printer.template.cfg @@ -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] [extruder] # To tune Pressure Advance see https://www.klipper3d.org/Pressure_Advance.html @@ -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.cfg] # FIRST RUN: # Execute these sequentially in the console, let PID tuning finish before saving From 8972b97915b7b52b0152cc1bc4cdd4411ef39eea Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:29:08 +0000 Subject: [PATCH 05/10] Move macros into sep folder In anticipation of adxl configs --- macros.cfg => macros/macros.cfg | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename macros.cfg => macros/macros.cfg (100%) diff --git a/macros.cfg b/macros/macros.cfg similarity index 100% rename from macros.cfg rename to macros/macros.cfg From 556b47e3e0df667984ee048b1ebfa5ca3244772f Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:29:59 +0000 Subject: [PATCH 06/10] Add ADXL345 KUSBA Rampon config Rampon fw --- macros/adxl-kusba-rampon.cfg | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 macros/adxl-kusba-rampon.cfg diff --git a/macros/adxl-kusba-rampon.cfg b/macros/adxl-kusba-rampon.cfg new file mode 100644 index 0000000..c9eed19 --- /dev/null +++ b/macros/adxl-kusba-rampon.cfg @@ -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. From 8f938d136dfb5dfca4d38dbbbb1ae3e0f2217f3a Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:30:31 +0000 Subject: [PATCH 07/10] Add TEST_SPEED macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Great for nutso printers like mine 😁 --- macros/TEST_SPEED.cfg | 112 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 macros/TEST_SPEED.cfg diff --git a/macros/TEST_SPEED.cfg b/macros/TEST_SPEED.cfg new file mode 100644 index 0000000..f924835 --- /dev/null +++ b/macros/TEST_SPEED.cfg @@ -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 From 8963164d1205b863027a947c764c774fcbd0eb8d Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:31:11 +0000 Subject: [PATCH 08/10] Add alternative gantry ram macro Made by bassamanator Adapted to tmc2130 --- macros/MECHANICAL_GANTRY_CALIBRATION.cfg | 110 +++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 macros/MECHANICAL_GANTRY_CALIBRATION.cfg diff --git a/macros/MECHANICAL_GANTRY_CALIBRATION.cfg b/macros/MECHANICAL_GANTRY_CALIBRATION.cfg new file mode 100644 index 0000000..43cc669 --- /dev/null +++ b/macros/MECHANICAL_GANTRY_CALIBRATION.cfg @@ -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 %} + {% 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' %} + 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 From 6f0e43b2ef15d93266e6015901fba064032610de Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:32:10 +0000 Subject: [PATCH 09/10] Add ADXL345 direct config --- macros/adxl-direct.cfg | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 macros/adxl-direct.cfg diff --git a/macros/adxl-direct.cfg b/macros/adxl-direct.cfg new file mode 100644 index 0000000..33c1e22 --- /dev/null +++ b/macros/adxl-direct.cfg @@ -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. From 49adfc3e47c3bf005472f16007e96a04efe0d249 Mon Sep 17 00:00:00 2001 From: alex <38814044+alextwothousand@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:36:48 +0000 Subject: [PATCH 10/10] Change macro path in printer.template.cfg --- printer.template.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/printer.template.cfg b/printer.template.cfg index 6adfce8..592f0fc 100644 --- a/printer.template.cfg +++ b/printer.template.cfg @@ -85,7 +85,7 @@ pid_Kd: 139.595 [include ./extruders/linear-correction/linear-correction-0.cfg] # Default Prusa linear correction optimized for LDO motors ### MACROS -[include ./macros.cfg] +[include ./macros/macros.cfg] # FIRST RUN: # Execute these sequentially in the console, let PID tuning finish before saving