commit d1519ee5e74d0daefa662595c4a6ba1fbfd31344 Author: miguel Date: Fri Sep 5 21:04:17 2025 +0100 New backup from 05/09/25 - 21:04:17 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e55ca4e --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.env +secrets.conf +*.swp +*.tmp +printer-[0-9]*_[0-9]*.cfg +*.bak +*.bkp +*.csv +*.zip diff --git a/README.md b/README.md new file mode 100644 index 0000000..c975ae8 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Klipper-Backup 💾 +Klipper backup script for manual or automated GitHub backups + +This backup is provided by [Klipper-Backup](https://github.com/Staubgeborener/klipper-backup). diff --git a/printer_data/config/Bed_Mesh.cfg b/printer_data/config/Bed_Mesh.cfg new file mode 100644 index 0000000..5b68480 --- /dev/null +++ b/printer_data/config/Bed_Mesh.cfg @@ -0,0 +1,8 @@ +[bed_mesh] + + +speed: 200 +horizontal_move_z: 10 +mesh_min: 50, 50 +mesh_max: 300, 300 +probe_count: 5, 5 diff --git a/printer_data/config/IS_shaper_calibrate.cfg b/printer_data/config/IS_shaper_calibrate.cfg new file mode 100644 index 0000000..b1886bc --- /dev/null +++ b/printer_data/config/IS_shaper_calibrate.cfg @@ -0,0 +1,77 @@ +################################################ +###### STANDARD INPUT_SHAPER CALIBRATIONS ###### +################################################ +# Written by Frix_x#0161 # +# @version: 1.3 + +# CHANGELOG: +# v1.3: added possibility to override the default parameters +# v1.2: added EXCITATE_AXIS_AT_FREQ to hold a specific excitating frequency on an axis and diagnose mechanical problems +# v1.1: added M400 to validate that the files are correctly saved to disk +# v1.0: first version of the automatic input shaper workflow + +# ------------------------------------------------------------------------------------------------------------------------- +# If you want to use it into your own config, please install it as a standalone macro as described in the +# installation section of this file: docs > features > is_workflow.md +# ------------------------------------------------------------------------------------------------------------------------- + +### What is it ? ### +# This macro helps you to configure the input shaper algorithm of Klipper by running the tests sequencially and calling an automatic script +# that generate the graphs, manage the files and so on. It's basically a fully automatic input shaper calibration workflow. +# Results can be found in your config folder using FLuidd/Maisail file manager. + +# The goal is to make it easy to set, share and use it. + +# Usage: +# 1. Call the AXES_SHAPER_CALIBRATION macro, wait for it to end and compute the graphs. Then look for the results in the results folder. +# 2. Call the BELTS_SHAPER_CALIBRATION macro, wait for it to end and compute the graphs. Then look for the results in the results folder. +# 3. If you find out some strange noise, you can use the EXCITATE_AXIS_AT_FREQ macro to diagnose the origin + + +[gcode_macro AXES_SHAPER_CALIBRATION] +description: Run standard input shaper test for all axes +gcode: + {% set verbose = params.VERBOSE|default(true) %} + {% set min_freq = params.FREQ_START|default(5)|float %} + {% set max_freq = params.FREQ_END|default(133.3)|float %} + {% set hz_per_sec = params.HZ_PER_SEC|default(1)|float %} + + TEST_RESONANCES AXIS=X FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} + M400 + TEST_RESONANCES AXIS=Y FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} + M400 + + {% if verbose %} + RESPOND MSG="Graphs generation... Please wait a minute or two and look in the configured folder." + {% endif %} + RUN_SHELL_COMMAND CMD=plot_graph PARAMS=SHAPER + + +[gcode_macro BELTS_SHAPER_CALIBRATION] +description: Run custom demi-axe test to analyze belts on CoreXY printers +gcode: + {% set verbose = params.VERBOSE|default(true) %} + {% set min_freq = params.FREQ_START|default(5)|float %} + {% set max_freq = params.FREQ_END|default(133.33)|float %} + {% set hz_per_sec = params.HZ_PER_SEC|default(1)|float %} + + TEST_RESONANCES AXIS=1,1 OUTPUT=raw_data NAME=b FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} + M400 + TEST_RESONANCES AXIS=1,-1 OUTPUT=raw_data NAME=a FREQ_START={min_freq} FREQ_END={max_freq} HZ_PER_SEC={hz_per_sec} + M400 + + {% if verbose %} + RESPOND MSG="Graphs generation... Please wait a minute or two and look in the configured folder." + {% endif %} + RUN_SHELL_COMMAND CMD=plot_graph PARAMS=BELTS + + +[gcode_macro EXCITATE_AXIS_AT_FREQ] +description: Maintain a specified input shaper excitating frequency for some time to diagnose vibrations +gcode: + {% set FREQUENCY = params.FREQUENCY|default(25)|int %} + {% set TIME = params.TIME|default(10)|int %} + {% set AXIS = params.AXIS|default("x")|string|lower %} + + TEST_RESONANCES OUTPUT=raw_data AXIS={AXIS} FREQ_START={FREQUENCY-1} FREQ_END={FREQUENCY+1} HZ_PER_SEC={1/(TIME/3)} + M400 \ No newline at end of file diff --git a/printer_data/config/KAMP/Adaptive_Meshing.cfg b/printer_data/config/KAMP/Adaptive_Meshing.cfg new file mode 100644 index 0000000..9fb81a9 --- /dev/null +++ b/printer_data/config/KAMP/Adaptive_Meshing.cfg @@ -0,0 +1,107 @@ +# # # Klipper Adaptive Meshing # # # + +# Heads up! If you have any other BED_MESH_CALIBRATE macros defined elsewhere in your config, you will need to comment out / remove them for this to work. (Klicky/Euclid Probe) +# You will also need to be sure that [exclude_object] is defined in printer.cfg, and your slicer is labeling objects. +# This macro will parse information from objects in your gcode to define a min and max mesh area to probe, creating an adaptive mesh! +# This macro will not increase probe_count values in your [bed_mesh] config. If you want richer meshes, be sure to increase probe_count. We recommend at least 5,5. + +[gcode_macro BED_MESH_CALIBRATE] +rename_existing: _BED_MESH_CALIBRATE +gcode: + + {% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points + {% set bed_mesh_min = printer.configfile.settings.bed_mesh.mesh_min %} # Get bed mesh min from printer.cfg + {% set bed_mesh_max = printer.configfile.settings.bed_mesh.mesh_max %} # Get bed mesh max from printer.cfg + {% set probe_count = printer.configfile.settings.bed_mesh.probe_count %} # Get probe count from printer.cfg + {% set verbose_enable = printer["gcode_macro _KAMP_Settings"].verbose_enable | abs %} # Pull verbose setting from _KAMP_Settings + {% set probe_dock_enable = printer["gcode_macro _KAMP_Settings"].probe_dock_enable | abs %} # Pull probe dockable probe settings from _KAMP_Settings + {% set attach_macro = printer["gcode_macro _KAMP_Settings"].attach_macro | string %} # Pull attach probe command from _KAMP_Settings + {% set detach_macro = printer["gcode_macro _KAMP_Settings"].detach_macro | string %} # Pull detach probe command from _KAMP_Settings + {% set mesh_margin = printer["gcode_macro _KAMP_Settings"].mesh_margin | float %} # Pull mesh margin setting from _KAMP_Settings + {% set fuzz_amount = printer["gcode_macro _KAMP_Settings"].fuzz_amount | float %} # Pull fuzz amount setting from _KAMP_Settings + {% set probe_count = probe_count if probe_count|length > 1 else probe_count * 2 %} # If probe count is only a single number, convert it to 2. E.g. probe_count:7 = 7,7 + {% set max_probe_point_distance_x = ( bed_mesh_max[0] - bed_mesh_min[0] ) / (probe_count[0] - 1) %} # Determine max probe point distance + {% set max_probe_point_distance_y = ( bed_mesh_max[1] - bed_mesh_min[1] ) / (probe_count[1] - 1) %} # Determine max probe point distance + {% set x_min = all_points | map(attribute=0) | min | default(bed_mesh_min[0]) %} # Set x_min from smallest object x point + {% set y_min = all_points | map(attribute=1) | min | default(bed_mesh_min[1]) %} # Set y_min from smallest object y point + {% set x_max = all_points | map(attribute=0) | max | default(bed_mesh_max[0]) %} # Set x_max from largest object x point + {% set y_max = all_points | map(attribute=1) | max | default(bed_mesh_max[1]) %} # Set y_max from largest object y point + + {% set fuzz_range = range((0) | int, (fuzz_amount * 100) | int + 1) %} # Set fuzz_range between 0 and fuzz_amount + {% set adapted_x_min = (bed_mesh_min[0] + fuzz_amount - mesh_margin, x_min) | max - (fuzz_range | random / 100.0) %} # Adapt x_min to margin and fuzz constraints + {% set adapted_y_min = (bed_mesh_min[1] + fuzz_amount - mesh_margin, y_min) | max - (fuzz_range | random / 100.0) %} # Adapt y_min to margin and fuzz constraints + {% set adapted_x_max = (bed_mesh_max[0] - fuzz_amount + mesh_margin, x_max) | min + (fuzz_range | random / 100.0) %} # Adapt x_max to margin and fuzz constraints + {% set adapted_y_max = (bed_mesh_max[1] - fuzz_amount + mesh_margin, y_max) | min + (fuzz_range | random / 100.0) %} # Adapt y_max to margin and fuzz constraints + + {% set points_x = (((adapted_x_max - adapted_x_min) / max_probe_point_distance_x) | round(method='ceil') | int) + 1 %} # Define probe_count's x point count and round up + {% set points_y = (((adapted_y_max - adapted_y_min) / max_probe_point_distance_y) | round(method='ceil') | int) + 1 %} # Define probe_count's y point count and round up + + {% if (([points_x, points_y]|max) > 6) %} # + {% set algorithm = "bicubic" %} # + {% set min_points = 4 %} # + {% else %} # Calculate if algorithm should be bicubic or lagrange + {% set algorithm = "lagrange" %} # + {% set min_points = 3 %} # + {% endif %} # + + {% set points_x = [points_x, min_points]|max %} # Set probe_count's x points to fit the calculated algorithm + {% set points_y = [points_y, min_points]|max %} # Set probe_count's y points to fit the calculated algorithm + {% set points_x = [points_x, probe_count[0]]|min %} + {% set points_y = [points_y, probe_count[1]]|min %} + + {% if verbose_enable == True %} # If verbose is enabled, print information about KAMP's calculations + + { action_respond_info( "Algorithm: {}.".format( + (algorithm), + )) } + + { action_respond_info("Default probe count: {},{}.".format( + (probe_count[0]), + (probe_count[1]), + )) } + + { action_respond_info("Adapted probe count: {},{}.".format( + (points_x), + (points_y), + )) } + + {action_respond_info("Default mesh bounds: {}, {}.".format( + (bed_mesh_min[0],bed_mesh_min[1]), + (bed_mesh_max[0],bed_mesh_max[1]), + )) } + + {% if mesh_margin > 0 %} + {action_respond_info("Mesh margin is {}, mesh bounds extended by {}mm.".format( + (mesh_margin), + (mesh_margin), + )) } + {% else %} + {action_respond_info("Mesh margin is 0, margin not increased.")} + {% endif %} + + {% if fuzz_amount > 0 %} + {action_respond_info("Mesh point fuzzing enabled, points fuzzed up to {}mm.".format( + (fuzz_amount), + )) } + {% else %} + {action_respond_info("Fuzz amount is 0, mesh points not fuzzed.")} + {% endif %} + + { action_respond_info("Adapted mesh bounds: {}, {}.".format( + (adapted_x_min, adapted_y_min), + (adapted_x_max, adapted_y_max), + )) } + + {action_respond_info("KAMP adjustments successful. Happy KAMPing!")} + + {% endif %} + + {% if probe_dock_enable == True %} + {attach_macro} # Attach/deploy a probe if the probe is stored somewhere outside of the print area + {% endif %} + + _BED_MESH_CALIBRATE mesh_min={adapted_x_min},{adapted_y_min} mesh_max={adapted_x_max},{adapted_y_max} ALGORITHM={algorithm} PROBE_COUNT={points_x},{points_y} + + {% if probe_dock_enable == True %} + {detach_macro} # Detach/stow a probe if the probe is stored somewhere outside of the print area + {% endif %} # End of verbose diff --git a/printer_data/config/KAMP/KAMP_Settings.cfg b/printer_data/config/KAMP/KAMP_Settings.cfg new file mode 100644 index 0000000..c96e6fa --- /dev/null +++ b/printer_data/config/KAMP/KAMP_Settings.cfg @@ -0,0 +1,36 @@ +# Below you can include specific configuration files depending on what you want KAMP to do: + +# [include ./KAMP/Adaptive_Meshing.cfg] # Include to enable adaptive meshing configuration. +# [include ./KAMP/Line_Purge.cfg] # Include to enable adaptive line purging configuration. +# [include ./KAMP/Voron_Purge.cfg] # Include to enable adaptive Voron logo purging configuration. +# [include ./KAMP/Smart_Park.cfg] # Include to enable the Smart Park function, which parks the printhead near the print area for final heating. + +[gcode_macro _KAMP_Settings] +description: This macro contains all adjustable settings for KAMP + +# The following variables are settings for KAMP as a whole. +variable_verbose_enable: True # Set to True to enable KAMP information output when running. This is useful for debugging. + +# The following variables are for adjusting adaptive mesh settings for KAMP. +variable_mesh_margin: 0 # Expands the mesh size in millimeters if desired. Leave at 0 to disable. +variable_fuzz_amount: 0 # Slightly randomizes mesh points to spread out wear from nozzle-based probes. Leave at 0 to disable. + +# The following variables are for those with a dockable probe like Klicky, Euclid, etc. # ---------------- Attach Macro | Detach Macro +variable_probe_dock_enable: False # Set to True to enable the usage of a dockable probe. # --------------------------------------------- +variable_attach_macro: 'Attach_Probe' # The macro that is used to attach the probe. # Klicky Probe: 'Attach_Probe' | 'Dock_Probe' +variable_detach_macro: 'Dock_Probe' # The macro that is used to store the probe. # Euclid Probe: 'Deploy_Probe' | 'Stow_Probe' + # Legacy Gcode: 'M401' | 'M402' + +# The following variables are for adjusting adaptive purge settings for KAMP. +variable_purge_height: 0.8 # Z position of nozzle during purge, default is 0.8. +variable_tip_distance: 0 # Distance between tip of filament and nozzle before purge. Should be similar to PRINT_END final retract amount. +variable_purge_margin: 10 # Distance the purge will be in front of the print area, default is 10. +variable_purge_amount: 30 # Amount of filament to be purged prior to printing. +variable_flow_rate: 12 # Flow rate of purge in mm3/s. Default is 12. + +# The following variables are for adjusting the Smart Park feature for KAMP, which will park the printhead near the print area at a specified height. +variable_smart_park_height: 10 # Z position for Smart Park, default is 10. + +gcode: # Gcode section left intentionally blank. Do not disturb. + + {action_respond_info(" Running the KAMP_Settings macro does nothing, it is only used for storing KAMP settings. ")} diff --git a/printer_data/config/KAMP/Line_Purge.cfg b/printer_data/config/KAMP/Line_Purge.cfg new file mode 100644 index 0000000..f6aeb98 --- /dev/null +++ b/printer_data/config/KAMP/Line_Purge.cfg @@ -0,0 +1,113 @@ +[gcode_macro LINE_PURGE] +description: A purge macro that adapts to be near your actual printed objects +gcode: + # Get relevant printer params + {% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %} + {% set cross_section = printer.configfile.settings.extruder.max_extrude_cross_section | float %} + + # Use firmware retraction if it is defined + {% if printer.firmware_retraction is defined %} + {% set RETRACT = G10 | string %} + {% set UNRETRACT = G11 | string %} + {% else %} + {% set RETRACT = 'G1 E-.5 F2100' | string %} + {% set UNRETRACT = 'G1 E.5 F2100' | string %} + {% endif %} + + # Get purge settings from _Kamp_Settings + {% set verbose_enable = printer["gcode_macro _KAMP_Settings"].verbose_enable | abs %} + {% set purge_height = printer["gcode_macro _KAMP_Settings"].purge_height | float %} + {% set tip_distance = printer["gcode_macro _KAMP_Settings"].tip_distance | float %} + {% set purge_margin = printer["gcode_macro _KAMP_Settings"].purge_margin | float %} + {% set purge_amount = printer["gcode_macro _KAMP_Settings"].purge_amount | float %} + {% set flow_rate = printer["gcode_macro _KAMP_Settings"].flow_rate | float %} + + + # Calculate purge origins and centers from objects + {% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Get all object points + {% set purge_x_min = (all_points | map(attribute=0) | min | default(0)) %} # Object x min + {% set purge_x_max = (all_points | map(attribute=0) | max | default(0)) %} # Object x max + {% set purge_y_min = (all_points | map(attribute=1) | min | default(0)) %} # Object y min + {% set purge_y_max = (all_points | map(attribute=1) | max | default(0)) %} # Object y max + + {% set purge_x_center = ([((purge_x_max + purge_x_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on X axis + {% set purge_y_center = ([((purge_y_max + purge_y_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on Y axis + + {% set purge_x_origin = ([purge_x_min - purge_margin, 0] | max) %} # Add margin to x min, compare to 0, and choose the larger + {% set purge_y_origin = ([purge_y_min - purge_margin, 0] | max) %} # Add margin to y min, compare to 0, and choose the larger + + # Calculate purge speed + {% set purge_move_speed = (flow_rate / 5.0) * 60 | float %} + + {% if cross_section < 5 %} + + {action_respond_info("[Extruder] max_extrude_cross_section is insufficient for purge, please set it to 5 or greater. Purge skipped.")} + + {% else %} + + {% if verbose_enable == True %} + + {action_respond_info("Moving filament tip {}mms".format( + (tip_distance), + )) } + {% endif %} + + {% if printer.firmware_retraction is defined %} + {action_respond_info("KAMP purge is using firmware retraction.")} + {% else %} + {action_respond_info("KAMP purge is not using firmware retraction, it is recommended to configure it.")} + {% endif %} + + {% if purge_y_origin > 0 %} + + {action_respond_info("KAMP purge starting at {}, {} and purging {}mm of filament, requested flow rate is {}mm/s3.".format( + (purge_x_center), + (purge_y_origin), + (purge_amount), + (flow_rate), + )) } + + {% else %} + + {action_respond_info("KAMP purge starting at {}, {} and purging {}mm of filament, requested flow rate is {}mm/s3.".format( + (purge_x_origin), + (purge_y_center), + (purge_amount), + (flow_rate), + )) } + + {% endif %} + + {% if purge_y_origin > 0 %} # If there's room on Y, purge along X axis in front of print area + + G92 E0 # Reset extruder + G0 F{travel_speed} # Set travel speed + G90 # Absolute positioning + G0 X{purge_x_center} Y{purge_y_origin} # Move to purge position + G0 Z{purge_height} # Move to purge Z height + M83 # Relative extrusion mode + G1 E{tip_distance} F{purge_move_speed} # Move filament tip + G1 X{purge_x_center + purge_amount} E{purge_amount} F{purge_move_speed} # Purge line + {RETRACT} # Retract + G92 E0 # Reset extruder distance + M82 # Absolute extrusion mode + G0 Z{purge_height * 2} F{travel_speed} # Z hop + + {% else %} # If there's room on X, purge along Y axis to the left of print area + + G92 E0 # Reset extruder + G0 F{travel_speed} # Set travel speed + G90 # Absolute positioning + G0 X{purge_x_origin} Y{purge_y_center} # Move to purge position + G0 Z{purge_height} # Move to purge Z height + M83 # Relative extrusion mode + G1 E{tip_distance} F{purge_move_speed} # Move filament tip + G1 Y{purge_y_center + purge_amount} E{purge_amount} F{purge_move_speed} # Purge line + {RETRACT} # Retract + G92 E0 # Reset extruder distance + M82 # Absolute extrusion mode + G0 Z{purge_height * 2} F{travel_speed} # Z hop + + {% endif %} + + {% endif %} diff --git a/printer_data/config/KAMP/Smart_Park.cfg b/printer_data/config/KAMP/Smart_Park.cfg new file mode 100644 index 0000000..ffd861a --- /dev/null +++ b/printer_data/config/KAMP/Smart_Park.cfg @@ -0,0 +1,14 @@ +[gcode_macro Smart_Park] +description: Parks your printhead near the print area for pre-print hotend heating. +gcode: + + {% set z_height = printer["gcode_macro _KAMP_Settings"].smart_park_height | float %} # Pull park height value from _KAMP_Settings + {% set center_x = printer.toolhead.axis_maximum.x / 2 | float %} # Create center point of x for fallback + {% set center_y = printer.toolhead.axis_maximum.y / 2 | float %} # Create center point of y for fallback + {% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Gather all object points + {% set x_min = all_points | map(attribute=0) | min | default(center_x) %} # Set x_min from smallest object x point + {% set y_min = all_points | map(attribute=1) | min | default(center_y) %} # Set y_min from smallest object y point + {% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %} # Set travel speed from config + + G0 X{x_min} Y{y_min} F{travel_speed} # Move near object area + G0 Z{z_height} # Move Z to park height diff --git a/printer_data/config/KAMP/Voron_Purge.cfg b/printer_data/config/KAMP/Voron_Purge.cfg new file mode 100644 index 0000000..3eba6a5 --- /dev/null +++ b/printer_data/config/KAMP/Voron_Purge.cfg @@ -0,0 +1,86 @@ +[gcode_macro VORON_PURGE] +description: A purge macro that adapts to be near your actual printed objects +gcode: + # Get relevant printer params + {% set travel_speed = (printer.toolhead.max_velocity) * 60 | float %} + {% set cross_section = printer.configfile.settings.extruder.max_extrude_cross_section | float %} + + # Use firmware retraction if it is defined + {% if printer.firmware_retraction is defined %} + {% set RETRACT = G10 | string %} + {% set UNRETRACT = G11 | string %} + {% else %} + {% set RETRACT = 'G1 E-.5 F2100' | string %} + {% set UNRETRACT = 'G1 E.5 F2100' | string %} + {% endif %} + + # Get purge settings from _Kamp_Settings + {% set verbose_enable = printer["gcode_macro _KAMP_Settings"].verbose_enable | abs %} + {% set purge_height = printer["gcode_macro _KAMP_Settings"].purge_height | float %} + {% set tip_distance = printer["gcode_macro _KAMP_Settings"].tip_distance | float %} + {% set purge_margin = printer["gcode_macro _KAMP_Settings"].purge_margin | float %} + {% set purge_amount = printer["gcode_macro _KAMP_Settings"].purge_amount | float %} + {% set flow_rate = printer["gcode_macro _KAMP_Settings"].flow_rate | float %} + {% set size = 10 | float %} + + # Calculate purge origins and centers from objects + {% set all_points = printer.exclude_object.objects | map(attribute='polygon') | sum(start=[]) %} # Get all object points + {% set purge_x_min = (all_points | map(attribute=0) | min | default(0)) %} # Object x min + {% set purge_x_max = (all_points | map(attribute=0) | max | default(0)) %} # Object x max + {% set purge_y_min = (all_points | map(attribute=1) | min | default(0)) %} # Object y min + {% set purge_y_max = (all_points | map(attribute=1) | max | default(0)) %} # Object y max + + {% set purge_x_center = ([((purge_x_max + purge_x_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on X axis + {% set purge_y_center = ([((purge_y_max + purge_y_min) / 2) - (purge_amount / 2), 0] | max) %} # Create center point of purge line relative to print on Y axis + + {% set purge_x_origin = ([purge_x_min - purge_margin, 0] | max) %} # Add margin to x min, compare to 0, and choose the larger + {% set purge_y_origin = ([purge_y_min - purge_margin, 0] | max) %} # Add margin to y min, compare to 0, and choose the larger + + # Calculate purge speed + {% set purge_move_speed = (flow_rate / 5.0) * 60 | float %} + + {% if cross_section < 5 %} + + {action_respond_info("[Extruder] max_extrude_cross_section is insufficient for purge, please set it to 5 or greater. Purge skipped.")} + + {% else %} + + {% if verbose_enable == True %} + + {action_respond_info("Moving filament tip {}mms".format( + (tip_distance), + )) } + {% endif %} + + {% if printer.firmware_retraction is defined %} + {action_respond_info("KAMP purge is using firmware retraction.")} + {% else %} + {action_respond_info("KAMP purge is not using firmware retraction, it is recommended to configure it.")} + {% endif %} + + G92 E0 # Reset extruder + G0 F{travel_speed} # Set travel speed + G90 # Absolute positioning + G0 X{purge_x_origin} Y{purge_y_origin+size/2} # Move to purge position + G0 Z{purge_height} # Move to purge Z height + M83 # Relative extrusion mode + G1 E{tip_distance} F{purge_move_speed} # Move tip of filament to nozzle + G1 X{purge_x_origin+size*0.289} Y{purge_y_origin+size} E{purge_amount/4} F{purge_move_speed}# Purge first line of logo + G1 E-.5 F2100 # Retract + G0 Z{purge_height*2} # Z hop + G0 X{purge_x_origin+size*0.789} Y{purge_y_origin+size} # Move to second purge line origin + G0 Z{purge_height} # Move to purge Z height + G1 E.5 F2100 # Recover + G1 X{purge_x_origin+size*0.211} Y{purge_y_origin} E{purge_amount/2} F{purge_move_speed} # Purge second line of logo + G1 E-.5 F2100 # Retract + G0 Z{purge_height*2} # Z hop + G0 X{purge_x_origin+size*0.711} Y{purge_y_origin} # Move to third purge line origin + G0 Z{purge_height} # Move to purge Z height + G1 E.5 F2100 # Recover + G1 X{purge_x_origin+size} Y{purge_y_origin+size/2} E{purge_amount/4} F{purge_move_speed} # Purge third line of logo + G1 E-.5 F2100 # Retract + G92 E0 # Reset extruder distance + M82 # Absolute extrusion mode + G0 Z{purge_height*2} F{travel_speed} + + {% endif %} diff --git a/printer_data/config/KAMP_Settings.cfg b/printer_data/config/KAMP_Settings.cfg new file mode 100644 index 0000000..ffd88eb --- /dev/null +++ b/printer_data/config/KAMP_Settings.cfg @@ -0,0 +1,36 @@ +# Below you can include specific configuration files depending on what you want KAMP to do: + +[include ./KAMP/Adaptive_Meshing.cfg] # Include to enable adaptive meshing configuration. +[include ./KAMP/Line_Purge.cfg] # Include to enable adaptive line purging configuration. +# [include ./KAMP/Voron_Purge.cfg] # Include to enable adaptive Voron logo purging configuration. +#[include ./KAMP/Smart_Park.cfg] # Include to enable the Smart Park function, which parks the printhead near the print area for final heating. + +[gcode_macro _KAMP_Settings] +description: This macro contains all adjustable settings for KAMP + +# The following variables are settings for KAMP as a whole. +variable_verbose_enable: True # Set to True to enable KAMP information output when running. This is useful for debugging. + +# The following variables are for adjusting adaptive mesh settings for KAMP. +variable_mesh_margin: 0 # Expands the mesh size in millimeters if desired. Leave at 0 to disable. +variable_fuzz_amount: 0.5 # Slightly randomizes mesh points to spread out wear from nozzle-based probes. Leave at 0 to disable. + +# The following variables are for those with a dockable probe like Klicky, Euclid, etc. # ---------------- Attach Macro | Detach Macro +variable_probe_dock_enable: False # Set to True to enable the usage of a dockable probe. # --------------------------------------------- +variable_attach_macro: 'Attach_Probe' # The macro that is used to attach the probe. # Klicky Probe: 'Attach_Probe' | 'Dock_Probe' +variable_detach_macro: 'Dock_Probe' # The macro that is used to store the probe. # Euclid Probe: 'Deploy_Probe' | 'Stow_Probe' + # Legacy Gcode: 'M401' | 'M402' + +# The following variables are for adjusting adaptive purge settings for KAMP. +variable_purge_height: 0.8 # Z position of nozzle during purge, default is 0.8. +variable_tip_distance: 0 # Distance between tip of filament and nozzle before purge. Should be similar to PRINT_END final retract amount. +variable_purge_margin: 20 # Distance the purge will be in front of the print area, default is 10. +variable_purge_amount: 30 # Amount of filament to be purged prior to printing. +variable_flow_rate: 15 # Flow rate of purge in mm3/s. Default is 12. + +# The following variables are for adjusting the Smart Park feature for KAMP, which will park the printhead near the print area at a specified height. +variable_smart_park_height: 10 # Z position for Smart Park, default is 10. + +gcode: # Gcode section left intentionally blank. Do not disturb. + + {action_respond_info(" Running the KAMP_Settings macro does nothing, it is only used for storing KAMP settings. ")} diff --git a/printer_data/config/KlipperScreen.conf b/printer_data/config/KlipperScreen.conf new file mode 100644 index 0000000..2a2160f --- /dev/null +++ b/printer_data/config/KlipperScreen.conf @@ -0,0 +1,7 @@ + +#~# --- Do not edit below this line. This section is auto generated --- #~# +#~# +#~# [main] +#~# 24htime = False +#~# print_sort_dir = date_desc +#~# diff --git a/printer_data/config/case_lights.cfg b/printer_data/config/case_lights.cfg new file mode 100644 index 0000000..e531fb1 --- /dev/null +++ b/printer_data/config/case_lights.cfg @@ -0,0 +1,9 @@ +[neopixel chamber] + +pin: PB6 +chain_count: 56 +color_order: GRB + +initial_RED: 1.0 +initial_GREEN: 1.0 +initial_BLUE: 1.0 \ No newline at end of file diff --git a/printer_data/config/crowsnest.conf b/printer_data/config/crowsnest.conf new file mode 100644 index 0000000..2868cb9 --- /dev/null +++ b/printer_data/config/crowsnest.conf @@ -0,0 +1,85 @@ +#### crowsnest.conf +#### This is a typical default config. +#### Also used as default in mainsail / MainsailOS +#### See: +#### https://github.com/mainsail-crew/crowsnest/blob/master/README.md +#### for details to configure to your needs. + + +##################################################################### +#### ##### +#### Information about ports and according URL's ##### +#### ##### +##################################################################### +#### ##### +#### Port 8080 equals /webcam/?action=[stream/snapshot] ##### +#### Port 8081 equals /webcam2/?action=[stream/snapshot] ##### +#### Port 8082 equals /webcam3/?action=[stream/snapshot] ##### +#### Port 8083 equals /webcam4/?action=[stream/snapshot] ##### +#### ##### +##################################################################### +#### RTSP Stream URL: ( if enabled and supported ) ##### +#### rtsp://:/stream.h264 ##### +##################################################################### + + +[crowsnest] +log_path: ~/printer_data/logs/crowsnest.log +log_level: verbose # Valid Options are quiet/verbose/debug +delete_log: false # Deletes log on every restart, if set to true +no_proxy: false + + +[cam 1] +mode: ustreamer # ustreamer - Provides mjpg and snapshots. (All devices) + # camera-streamer - Provides webrtc, mjpg and snapshots. (rpi + Raspi OS based only) +enable_rtsp: false # If camera-streamer is used, this enables also usage of an rtsp server +rtsp_port: 8554 # Set different ports for each device! +port: 8080 # HTTP/MJPG Stream/Snapshot Port +device: /dev/video0 # See Log for available ... +resolution: 1920x1080 #2592x1944 #1920x1080 # widthxheight format +max_fps: 30 # If Hardware Supports this it will be forced, otherwise ignored/coerced. +#custom_flags: # You can run the Stream Services with custom flags. +# Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of. +v4l2ctl: brightness = -20 , contrast = 40 , saturation = 30 , hue = 0, white_balance_automatic = 1, gamma = 300 , white_balance_temperature = 4600 , sharpness = 70 , backlight_compensation = 0 , auto_exposure = 1 #, exposure_time_absolute = 312, focus_absolute = 0 , focus_automatic_continuous = 1 + + +#[cam 2] +#mode: camera-streamer # ustreamer - Provides mjpg and snapshots. (All devices) + # camera-streamer - Provides webrtc, mjpg and snapshots. (rpi + Raspi OS based only) +#enable_rtsp: false # If camera-streamer is used, this enables also usage of an rtsp server +#rtsp_port: 8554 # Set different ports for each device! +#port: 8081 # HTTP/MJPG Stream/Snapshot Port +#device: /base/soc/i2c0mux/i2c@1/imx708@1a # See Log for available ... +#resolution: 1280x720 #1366x768 1920x1080 # widthxheight format +#max_fps: 30 # If Hardware Supports this it will be forced, otherwise ignored/coerced. +##custom_flags: # You can run the Stream Services with custom flags. +## Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of. +##v4l2ctl: brightness = 20 , contrast = 40 , saturation = 62 , hue = -86, white_balance_automatic = 1, gamma = 160 , gain = 30 , power_line_frequency = 2 , white_balance_temperature = 4600 , sharpness = 6 , backlight_compensation = 0 #, auto_exposure = 1 , exposure_time_absolute = 312, focus_absolute = 0 , focus_automatic_continuous = 1 + + + +#=============================================================================================================== User Controls + +#brightness 0x00980900 (int) : min=-64 max=64 step=1 default=0 value=0 +#contrast 0x00980901 (int) : min=0 max=64 step=1 default=34 value=34 +#saturation 0x00980902 (int) : min=0 max=78 step=1 default=62 value=62 +#hue 0x00980903 (int) : min=-2000 max=2000 step=1 default=-86 value=-86 +#white_balance_automatic 0x0098090c (bool) : default=1 value=1 +#gamma 0x00980910 (int) : min=100 max=300 step=1 default=150 value=150 +#gain 0x00980913 (int) : min=0 max=130 step=1 default=32 value=35 +#power_line_frequency 0x00980918 (menu) : min=0 max=2 default=1 value=2 +#white_balance_temperature 0x0098091a (int) : min=2800 max=6500 step=1 default=4600 value=4600 flags=inactive +#sharpness 0x0098091b (int) : min=1 max=7 step=1 default=4 value=4 +#backlight_compensation 0x0098091c (int) : min=0 max=1 step=1 default=0 value=0 + +#Camera Controls + +#auto_exposure 0x009a0901 (menu) : min=0 max=3 default=3 value=3 +#1: Manual Mode +#3: Aperture Priority Mode +#exposure_time_absolute 0x009a0902 (int) : min=1 max=80000 step=1 default=312 value=2496 flags=inactive +#error 5 getting ext_ctrl Exposure, Dynamic Framerate +#focus_absolute 0x009a090a (int) : min=0 max=256 step=1 default=0 value=127 flags=inactive +#focus_automatic_continuous 0x009a090c (bool) : default=1 value=1 + diff --git a/printer_data/config/custom_macros.cfg b/printer_data/config/custom_macros.cfg new file mode 100644 index 0000000..1ed221a --- /dev/null +++ b/printer_data/config/custom_macros.cfg @@ -0,0 +1,105 @@ +[gcode_macro HEAT_SOAK] +description: heats the bed for a while + +variable_target_temp: 0 +variable_stage: None ## heating -> soaking -> done -> None + +## in seconds +variable_check_interval: 10 +variable_soak_time_remaining: 0 +variable_total_time_elapsed: 0 + +gcode: + {% set TARGET = params.TARGET | default(0) | float %} + {% set DURATION = (params.DURATION | default(5) | int) * 60 %} ## minutes to seconds + + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=target_temp VALUE={ TARGET } + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=stage VALUE="'heating'" + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=soak_time_remaining VALUE={ DURATION } + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=total_time_elapsed VALUE=0 + + ;; fire up the heater + SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={ TARGET } + + ;; run the fan to circulate air + _SET_FAN_SPEED PERCENT=50 + SET_FAN_SPEED FAN=Nevermore SPEED=1 + + ;; put the bed and nozzle where they're a safe distance apart + G28 + ##CENTER + + M84 ;; turn off steppers + + UPDATE_DELAYED_GCODE ID=heat_soaker DURATION={ check_interval } + +[gcode_macro CANCEL_HEAT_SOAK] +description: cancels an in-progress HEAT_SOAK cycle +gcode: + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=stage VALUE="'cancel'" + UPDATE_DELAYED_GCODE ID=heat_soaker DURATION=1 + +[delayed_gcode heat_soaker] +; ## debug +; { action_respond_info( printer['gcode_macro HEAT_SOAK'] | tojson )} +gcode: + {% set heat_soak = printer['gcode_macro HEAT_SOAK'] %} + + ## update total time elapsed + {% set total_time_elapsed = heat_soak.total_time_elapsed + heat_soak.check_interval %} + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=total_time_elapsed VALUE={ total_time_elapsed } + + {% set stage = heat_soak.stage %} + {% if stage == "heating" and printer.heater_bed.temperature >= heat_soak.target_temp %} + {% set stage = "soaking" %} + {% endif %} + + {% if stage == "soaking" %} + ## update soak countdown + {% set soak_time_remaining = [heat_soak.soak_time_remaining - heat_soak.check_interval, 0] | max %} + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=soak_time_remaining VALUE={ soak_time_remaining } + + {% if soak_time_remaining == 0 %} + {% set stage = "done" %} + {% endif %} + {% endif %} + + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=stage VALUE="'{ stage }'" + + {% if stage in ("done", "cancel") %} + + {% if stage == "cancel" %} + {% set stage = "done" %} + TURN_OFF_HEATERS + M107 ; turn off fan + + M117 { "soak cancelled after ~%.1fm" | format(total_time_elapsed / 60.0) } + {% else %} + M117 { "soak complete after %.1fm" | format(total_time_elapsed / 60.0) } + {% endif %} + + ## reset all state vars, except stage, which may be queried via the api + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=target_temp VALUE=0 + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=soak_time_remaining VALUE=0 + SET_GCODE_VARIABLE MACRO=HEAT_SOAK VARIABLE=total_time_elapsed VALUE=0 + + {% else %} + + {% if total_time_elapsed % 90 == 0 %} + ## output status periodically + {% if stage == "heating" %} + M117 { "heating -- %.1fm elapsed" | format(total_time_elapsed / 60.0) } + {% elif stage == "soaking" %} + M117 { "soaking -- %.1fm remaining" | format(soak_time_remaining / 60.0) } + {% endif %} + {% endif %} + + ## trigger ourselves again + UPDATE_DELAYED_GCODE ID=heat_soaker DURATION={ heat_soak.check_interval } + + ## dwell for 1ms to prevent from going idle + G4 P1 + + {% endif %} + +#[gcode_macro NEW_TIMELAPSE_TAKE_FRAME] \ No newline at end of file diff --git a/printer_data/config/klicky-bed-mesh-calibrate.cfg b/printer_data/config/klicky-bed-mesh-calibrate.cfg new file mode 100644 index 0000000..8bc2477 --- /dev/null +++ b/printer_data/config/klicky-bed-mesh-calibrate.cfg @@ -0,0 +1,32 @@ +# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me. +# I have tweaked it a lot. +# They are based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, +# modified for better use on K-series printers by RyanG and Trails", kudos to them. +# That macro as since evolved into a klipper plugin that currently is pending inclusion in klipper, +# more information here, https://github.com/Annex-Engineering/Quickdraw_Probe/tree/main/Klipper_Macros +# User richardjm revised the macro variables and added some functions, thanks a lot +# by standing on the shoulders of giants, lets see if we can see further +# +# the current home for this version is https://github.com/jlas1/Klicky-Probe + +################### +# Bed mesh calibrate +[gcode_macro BED_MESH_CALIBRATE] +rename_existing: _BED_MESH_CALIBRATE +description: Perform Mesh Bed Leveling with klicky automount +gcode: + {% set V = printer["gcode_macro _User_Variables"].verbose %} + {% if V %} + { action_respond_info("Bed Mesh Calibrate") } + {% endif %} + + _CheckProbe action=query + G90 + Attach_Probe + _KLICKY_STATUS_MESHING + + _BED_MESH_CALIBRATE {% for p in params + %}{'%s=%s ' % (p, params[p])}{% + endfor %} + + Dock_Probe \ No newline at end of file diff --git a/printer_data/config/klicky-macros.cfg b/printer_data/config/klicky-macros.cfg new file mode 100644 index 0000000..4603789 --- /dev/null +++ b/printer_data/config/klicky-macros.cfg @@ -0,0 +1,990 @@ +# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me. +# I have tweaked it a lot. +# They are based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, +# modified for better use on K-series printers by RyanG and Trails", kudos to them. +# That macro as since evolved into a klipper plugin that currently is pending inclusion in klipper, +# more information here, https://github.com/Annex-Engineering/Quickdraw_Probe/tree/main/Klipper_Macros +# User richardjm revised the macro variables and added some functions +# User sporkus added led status notifications +# Thanks to all who helped, +# by standing on the shoulders of giants, lets see if we can see further +# +# the current home for this version is https://github.com/jlas1/Klicky-Probe + +[respond] + +[gcode_macro _Probe_Variables] +variable_probe_attached: False +variable_probe_state: False +variable_probe_lock: False +variable_probe_z_homed: False +variable_z_endstop_x: 0 +variable_z_endstop_y: 0 +gcode: + + +#checks if the variable definitions are up to date +[gcode_macro _klicky_check_variables_version] +gcode: + {% set version = printer["gcode_macro _User_Variables"].version|default(0) %} + + {% if version != 1 %} + { action_raise_error("Please update your klicky variables, there are some functionality changes") } + {% endif %} + +[gcode_macro _KlickyDebug] +gcode: + {% set message = params.MSG %} + {% set debug = printer["gcode_macro _User_Variables"].debug|default(False) %} + + {% if debug %} + { action_respond_info(message) } + {% endif %} + + +[gcode_macro _exit_point] +gcode: + {% set function = 'pre_' ~ params.FUNCTION %} + {% set move = params.MOVE|default(0) %} + {% set speed = printer["gcode_macro _User_Variables"].travel_speed %} + + # mandatory to save the new safe position + M400 + SET_VELOCITY_LIMIT ACCEL={printer.configfile.settings.printer.max_accel} + RESTORE_GCODE_STATE NAME={function} MOVE={move} MOVE_SPEED={speed} + + +[gcode_macro _entry_point] +gcode: + {% set function = 'pre_' ~ params.FUNCTION %} + {% set move_accel = printer["gcode_macro _User_Variables"].move_accel|default(1000) %} + # mandatory to save the new safe position + M400 + SAVE_GCODE_STATE NAME={function} + # removes the Z offset for better bed based docking + SET_GCODE_OFFSET Z=0 + # all the macros initially assume absolute positioning + G90 + # set a safe(sane) Acceleration + SET_VELOCITY_LIMIT ACCEL={move_accel} + +[gcode_macro _Homing_Variables] +gcode: + {% set reset = params.RESET|default(0) %} + {% if reset %} + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False } + {% endif %} + +########################## +# Attach probe and lock it +[gcode_macro Attach_Probe_Lock] +description: Attaches Klicky Probe, can only be docked after unlocking +gcode: + Attach_Probe + _Probe_Lock + +######################## +# Dock probe and lock it +[gcode_macro Dock_Probe_Unlock] +description: Docks Klicky Probe even if it was locked +gcode: + _Probe_Unlock + Dock_Probe + +############## +# Unlock Probe +[gcode_macro _Probe_Unlock] +description: Unlocks Klicky Probe state +gcode: + _KlickyDebug msg="_Probe_Lock setting probe_lock variable to False" + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ False } + +############ +# Lock Probe +[gcode_macro _Probe_Lock] +description: Locks Klicky Probe state +gcode: + _KlickyDebug msg="_Probe_Lock setting probe_lock variable to True" + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_lock VALUE={ True } + +################### +# Klicky Dock Servo Deploy + +[gcode_macro _DeployKlickyDock] +description: Deploys Klicky servo-controlled dock +gcode: + {% set enable_dock_servo = printer["gcode_macro _User_Variables"].enable_dock_servo|default(False) %} + {% set servo_delay = printer["gcode_macro _User_Variables"].servo_delay|default(1000)|int %} + {% set servo_name = printer["gcode_macro _User_Variables"].servo_name %} + {% set servo_deploy = printer["gcode_macro _User_Variables"].servo_deploy|default(360)|float %} + + #wait for all the moves to complete + M400 + {% if enable_dock_servo != False %} + _KlickyDebug msg="_DeployKlickyDock Klicky servo configuration enabled" + {% if servo_deploy == 360 %} + { action_raise_error("Klicky: servo active on klicky-variables, but no servo deploy angle specified") } + {% endif %} + _KlickyDebug msg="_DeployKlickyDock SET_SERVO SERVO={servo_name|string} ANGLE={servo_deploy}" + SET_SERVO SERVO={servo_name|string} ANGLE={servo_deploy} + M400 + G4 P{servo_delay} + _KlickyDebug msg="_DeployKlickyDock SET_SERVO SERVO={servo_name|string} WIDTH=0" + SET_SERVO SERVO={servo_name|string} WIDTH=0 + {% elif printer["gcode_macro _DeployDock"] is defined %} + _KlickyDebug msg="_DeployKlickyDock calling _DeployDock" + _DeployDock + {% endif %} + +#################### +# Dock Servo Retract + +[gcode_macro _RetractKlickyDock] +description: Retracts Klicky servo-controlled dock +gcode: + {% set enable_dock_servo = printer["gcode_macro _User_Variables"].enable_dock_servo|default(False) %} + {% set servo_delay = printer["gcode_macro _User_Variables"].servo_delay|default(1000)|int %} + {% set servo_name = printer["gcode_macro _User_Variables"].servo_name %} + {% set servo_retract = printer["gcode_macro _User_Variables"].servo_retract|default(360)|float %} + + #wait for all the moves to complete + M400 + {% if enable_dock_servo != False %} + _KlickyDebug msg="_RetractKlickyDock Klicky servo configuration enabled" + {% if servo_retract == 360 %} + { action_raise_error("Klicky: servo active on klicky-variables, but no servo retract angle specified") } + {% endif %} + _KlickyDebug msg="_RetractKlickyDock SET_SERVO SERVO={servo_name|string} ANGLE={servo_retract}" + SET_SERVO SERVO={servo_name|string} ANGLE={servo_retract} + M400 + G4 P{servo_delay} + _KlickyDebug msg="_RetractKlickyDock SET_SERVO SERVO={servo_name|string} WIDTH=0" + SET_SERVO SERVO={servo_name|string} WIDTH=0 + {% elif printer["gcode_macro _RetractDock"] is defined %} + _KlickyDebug msg="_RetractKlickyDock calling _RetractDock" + _RetractDock + {% endif %} + + +###################### +# Attach Probe Routine +[gcode_macro Attach_Probe] +description: Attaches Klicky Probe +gcode: + # See if the position should be restored after the attach + {% set goback = params.BACK|default(0) %} + # Get probe attach status + {% set probe_attached = printer["gcode_macro _Probe_Variables"].probe_attached %} + {% set probe_lock = printer["gcode_macro _Probe_Variables"].probe_lock %} + {% set verbose = printer["gcode_macro _User_Variables"].verbose %} + # Get Docking location + {% set dockmove_x = printer["gcode_macro _User_Variables"].dockmove_x|default(0)|float %} + {% set dockmove_y = printer["gcode_macro _User_Variables"].dockmove_y|default(0)|float %} + {% set dockmove_z = printer["gcode_macro _User_Variables"].dockmove_z|default(0)|float %} + {% set docklocation_x = printer["gcode_macro _User_Variables"].docklocation_x|float %} + {% set docklocation_y = printer["gcode_macro _User_Variables"].docklocation_y|float %} + {% set docklocation_z = printer["gcode_macro _User_Variables"].docklocation_z|float %} + {% set attachmove_x = printer["gcode_macro _User_Variables"].attachmove_x|default(0)|float %} + {% set attachmove_y = printer["gcode_macro _User_Variables"].attachmove_y|default(0)|float %} + {% set attachmove_z = printer["gcode_macro _User_Variables"].attachmove_z|default(0)|float %} + {% set attachmove2_x = printer["gcode_macro _User_Variables"].attachmove2_x|default(0)|float %} + {% set attachmove2_y = printer["gcode_macro _User_Variables"].attachmove2_y|default(0)|float %} + {% set attachmove2_z = printer["gcode_macro _User_Variables"].attachmove2_z|default(0)|float %} + # Safe Z for travel + {% set safe_z = printer["gcode_macro _User_Variables"].safe_z %} + {% set enable_z_hop = printer["gcode_macro _User_Variables"].enable_z_hop %} + # Set feedrates + {% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %} + {% set dock_feedrate = printer["gcode_macro _User_Variables"].dock_speed * 60 %} + {% set release_feedrate = printer["gcode_macro _User_Variables"].release_speed * 60 %} + {% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %} + {% set bypass_probe_docking = printer["gcode_macro _User_Variables"].bypass_probe_docking|default(False) %} + + _entry_point function=Attach_Probe + + {% if bypass_probe_docking == False %} + + # If x and y are not homed + {% if not 'xy' in printer.toolhead.homed_axes %} + { action_raise_error("Must Home X and Y Axis First!") } + _KlickyDebug msg="Attach_Probe Axis homed" + + # If probe not attached and locked + {% elif not probe_attached and not probe_lock %} + _KlickyDebug msg="Attach_Probe going to attach probe" + {% if verbose %} + { action_respond_info("Attaching Probe") } + {% endif %} + _KLICKY_STATUS_BUSY + + {% if not 'z' in printer.toolhead.homed_axes %} + {% if verbose %} + { action_respond_info("Resetting Z position to zero") } + {% endif %} + _KlickyDebug msg="Attach_Probe Z not homed, setting position as X=Y=Z=0" + SET_KINEMATIC_POSITION Z=0 + {% if not enable_z_hop %} # Disables safe_z + _KlickyDebug msg="Attach_Probe z_hop disabled" + {% set safe_z = 0 %} + {% endif %} + {% endif %} + + # Prior to saving actual position, check if its necessary to move to a safe Z + # that has enought overhead for the attached probe + {% if printer.gcode_move.gcode_position.z < safe_z %} + _KlickyDebug msg="Attach_Probe toolhead too low, raising it to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm" + {% if verbose %} + { action_respond_info("moving to a safe Z distance") } + {% endif %} + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + + {% if not 'z' in printer.toolhead.homed_axes %} #duplicate?? + {% if verbose %} + { action_respond_info("Resetting Z position to zero, duplicate?") } + {% endif %} + _KlickyDebug msg="Attach_Probe Z not homed, setting position as X=Y=Z=0" + SET_KINEMATIC_POSITION Z=0 + {% endif %} + + {% if printer.gcode_move.gcode_position.z < safe_z %} #duplicate?? + _KlickyDebug msg="Attach_Probe toolhead too low, raising it to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm" + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + + _Umbilical_Path + + _entry_point function=Attach_Probe_intern + + # Probe entry location + _KlickyDebug msg="Attach_Probe moving near the dock with G0 X{docklocation_x - attachmove_x - attachmove2_x} Y{docklocation_y - attachmove_y - attachmove2_y} F{travel_feedrate}" + G0 X{docklocation_x - attachmove_x - attachmove2_x} Y{docklocation_y - attachmove_y - attachmove2_y} F{travel_feedrate} + {% if docklocation_z != -128 %} + _KlickyDebug msg="Attach_Probe moving near the dock with G0 Z{docklocation_z - attachmove_z - attachmove2_z} F{dock_feedrate}" + G0 Z{docklocation_z - attachmove_z - attachmove2_z} F{dock_feedrate} + _KlickyDebug msg="Attach_Probe moving near the dock with G0 Z{docklocation_z - attachmove_z} F{dock_feedrate}" + G0 Z{docklocation_z - attachmove_z} F{dock_feedrate} + {% endif %} + # if necessary do some actions before moving the toolhead to dock + _DeployKlickyDock + + # Drop Probe to Probe location + {% if docklocation_z != -128 %} + _KlickyDebug msg="Attach_Probe moving to the dock with G0 Z{docklocation_z} F{dock_feedrate}" + G0 Z{docklocation_z} F{dock_feedrate} + {% endif %} + _KlickyDebug msg="Attach_Probe moving to the dock with G0 X{docklocation_x - attachmove2_x} Y{docklocation_y - attachmove2_y} F{dock_feedrate}" + G0 X{docklocation_x - attachmove2_x} Y{docklocation_y - attachmove2_y} F{dock_feedrate} + _KlickyDebug msg="Attach_Probe moving to the dock with G0 X{docklocation_x} Y{docklocation_y} F{dock_feedrate}" + G0 X{docklocation_x} Y{docklocation_y} F{dock_feedrate} + # Probe Attached + {% if docklocation_z != -128 %} + _KlickyDebug msg="Attach_Probe moving from the dock to G0 Z{docklocation_z - attachmove_z} F{z_drop_feedrate}" + G0 Z{docklocation_z - attachmove_z} F{z_drop_feedrate} + {% endif %} + _KlickyDebug msg="Attach_Probe moving from the dock to G0 X{docklocation_x - attachmove_x} Y{docklocation_y - attachmove_y} F{release_feedrate}" + G0 X{docklocation_x - attachmove_x} Y{docklocation_y - attachmove_y} F{release_feedrate} + # if necessary do some actions after attaching the probe + _RetractKlickyDock + ## Go to Z safe distance + {% if ((printer.gcode_move.gcode_position.z < safe_z) or (docklocation_z != -128 and docklocation_z < safe_z ))%} + _KlickyDebug msg="Attach_Probe moving to a safe Z position: G0 Z{safe_z} F{z_drop_feedrate} from {printer.gcode_move.gcode_position.z}" + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + + _Park_Toolhead + + _CheckProbe action=attach + + _exit_point function=Attach_Probe_intern move={goback} + _KLICKY_STATUS_READY + + {% elif probe_lock %} + {% if verbose %} + { action_respond_info("Probe locked!") } + {% endif %} + + # Probe attached, do nothing + _KlickyDebug msg="Attach_Probe probe locked not attaching probe" + _CheckProbe action=query + + {% else %} + {% if verbose %} + { action_respond_info("Probe already attached!") } + {% endif %} + + # Probe attached, do nothing + _KlickyDebug msg="Attach_Probe probe already attached, doing nothing" + _CheckProbe action=query + + {% endif %} + + _exit_point function=Attach_Probe + {% else %} + _KlickyDebug msg="Attach_Probe probe docking bypassed, doing nothing" + {% endif %} + + +#################### +# Dock Probe Routine +[gcode_macro Dock_Probe] +description: Docks Klicky Probe +gcode: + # See if the position should be restored after the dock + {% set goback = params.BACK|default(0) %} + # Get probe attach status + {% set probe_attached = printer["gcode_macro _Probe_Variables"].probe_attached %} + {% set probe_lock = printer["gcode_macro _Probe_Variables"].probe_lock %} + {% set verbose = printer["gcode_macro _User_Variables"].verbose %} + # Get Docking location + {% set dockmove_x = printer["gcode_macro _User_Variables"].dockmove_x|default(0)|float %} + {% set dockmove_y = printer["gcode_macro _User_Variables"].dockmove_y|default(0)|float %} + {% set dockmove_z = printer["gcode_macro _User_Variables"].dockmove_z|default(0)|float %} + {% set docklocation_x = printer["gcode_macro _User_Variables"].docklocation_x|float %} + {% set docklocation_y = printer["gcode_macro _User_Variables"].docklocation_y|float %} + {% set docklocation_z = printer["gcode_macro _User_Variables"].docklocation_z|float %} + {% set attachmove_x = printer["gcode_macro _User_Variables"].attachmove_x|default(0)|float %} + {% set attachmove_y = printer["gcode_macro _User_Variables"].attachmove_y|default(0)|float %} + {% set attachmove_z = printer["gcode_macro _User_Variables"].attachmove_z|default(0)|float %} + # Safe Z for travel + {% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %} + # Set feedrates + {% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %} + {% set dock_feedrate = printer["gcode_macro _User_Variables"].dock_speed * 60 %} + {% set release_feedrate = printer["gcode_macro _User_Variables"].release_speed * 60 %} + {% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %} + {% set bypass_probe_docking = printer["gcode_macro _User_Variables"].bypass_probe_docking|default(False) %} + {% if bypass_probe_docking == True %} + _KlickyDebug msg="Attach_Probe probe docking bypassed, doing nothing" + {% endif %} + + {% if bypass_probe_docking != True %} + _entry_point function=Dock_Probe + + # If probe not attached and not locked + {% if probe_attached and not probe_lock %} + _KLICKY_STATUS_BUSY + {% if printer.gcode_move.gcode_position.z < safe_z %} + _KlickyDebug msg="Dock_Probe toolhead too low, raising it to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm" + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + _Umbilical_Path + + # Probe entry location + _KlickyDebug msg="Dock_Probe moving near the dock with G0 X{docklocation_x - attachmove_x} Y{docklocation_y - attachmove_y} F{travel_feedrate}" + G0 X{docklocation_x - attachmove_x} Y{docklocation_y - attachmove_y} F{travel_feedrate} + + {% if docklocation_z != -128 %} + _KlickyDebug msg="Dock_Probe moving near the dock with G0 Z{docklocation_z - attachmove_z} F{dock_feedrate}" + G0 Z{docklocation_z - attachmove_z} F{dock_feedrate} + {% endif %} + + # if necessary do some actions before moving the toolhead to dock + _DeployKlickyDock + + # Drop Probe to Probe location + _KlickyDebug msg="Dock_Probe moving to the dock with G0 X{docklocation_x} Y{docklocation_y} F{dock_feedrate}" + + G0 X{docklocation_x} Y{docklocation_y} F{dock_feedrate} + {% if docklocation_z != -128 %} + _KlickyDebug msg="Attach_Probe moving to the dock with G0 Z{docklocation_z} F{dock_feedrate}" + G0 Z{docklocation_z} F{dock_feedrate} + {% endif %} + + # Probe decoupling + {% if docklocation_z != -128 %} + _KlickyDebug msg="Dock_Probe moving from the dock to G0 Z{docklocation_z + dockmove_z} F{release_feedrate}" + G0 Z{docklocation_z + dockmove_z} F{release_feedrate} + {% endif %} + + _KlickyDebug msg="Dock_Probe moving from the dock to G0 X{docklocation_x + dockmove_x} Y{docklocation_y + dockmove_y} F{release_feedrate}" + G0 X{docklocation_x + dockmove_x} Y{docklocation_y + dockmove_y} F{release_feedrate} + + #Do an extra move away + _KlickyDebug msg="Dock_Probe moving away from the dock to G0 X{docklocation_x + dockmove_x - attachmove_x} Y{docklocation_y + dockmove_y - attachmove_y} F{release_feedrate}" + G0 X{docklocation_x + dockmove_x - attachmove_x} Y{docklocation_y + dockmove_y - attachmove_y} F{release_feedrate} + + # if necessary do some actions after attaching the probe + _RetractKlickyDock + + ## Go to Z safe distance + {% if (printer.gcode_move.gcode_position.z < safe_z) %} + _KlickyDebug msg="Dock_Probe moving to a safe Z position: G0 Z{safe_z} F{z_drop_feedrate} from {printer.gcode_move.gcode_position.z}" + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + + _Park_Toolhead + + G4 P1000 + _CheckProbe action=dock + _KLICKY_STATUS_READY + + {% elif probe_lock %} + {% if verbose %} + { action_respond_info("Probe locked") } + {% endif %} + + # Probe docked, do nothing + _KlickyDebug msg="Dock_Probe probe locked not docking probe" + _CheckProbe action=query + + {% else %} + {% if verbose %} + { action_respond_info("Probe already docked") } + {% endif %} + + # Probe docked, do nothing + _KlickyDebug msg="Dock_Probe probe already docked, doing nothing" + _CheckProbe action=query + + {% endif %} + + _exit_point function=Dock_Probe move={goback} + {% else %} + _KlickyDebug msg="Dock_Probe probe docking bypassed, doing nothing" + {% endif %} + + +################# +# Probe Calibrate +[gcode_macro PROBE_CALIBRATE] +rename_existing: _PROBE_CALIBRATE +description:Calibrate the probes z_offset with klicky automount +gcode: + {% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %} + {% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %} + {% set max_x = printer["gcode_macro _User_Variables"].max_bed_x|float %} + {% set max_y = printer["gcode_macro _User_Variables"].max_bed_y|float %} + {% set probe_offset_x = printer['configfile'].config["probe"]["x_offset"]|float %} + {% set probe_offset_y = printer['configfile'].config["probe"]["y_offset"]|float %} + {% set bypass_probe_docking = printer["gcode_macro _User_Variables"].bypass_probe_docking|default(False) %} + + + {% if not 'xyz' in printer.toolhead.homed_axes %} + { action_raise_error("Must Home X, Y and Z Axis First!") } + {% endif %} + _KlickyDebug msg="probe_calibrate Axis homed" + _KlickyDebug msg="probe_calibrate Variables max_x={max_x},max_y={max_y},probe_offset_x={probe_offset_x},probe_offset_y={probe_offset_y}" + + # Protect against PROBE CALIBRATE performed from outside the bed + {% if printer['gcode_move'].position.y > (max_y - probe_offset_y) + or printer['gcode_move'].position.y < - probe_offset_y + or printer['gcode_move'].position.x > (max_x - probe_offset_x) + or printer['gcode_move'].position.x < - probe_offset_x %} + { action_raise_error("Must perform PROBE_CALIBRATE with the probe above the BED, check klicky_variables bed size!") } + {% endif %} + + {% if bypass_probe_docking == False %} + _CheckProbe action=query + G90 + Attach_Probe back=1 + _KLICKY_STATUS_CALIBRATING_Z + + _KlickyDebug msg="probe_calibrate calling klipper probe_calibrate" + _PROBE_CALIBRATE {% for p in params + %}{'%s=%s ' % (p, params[p])}{% + endfor %} + + M118 moving the toolhead 20 mm from the bed + _KlickyDebug msg="probe_calibrate Moving Z up by 20mm" + TESTZ Z=20 + M118 remove manually the probe and continue calibration + _KLICKY_STATUS_READY + {% else %} + _KLICKY_STATUS_CALIBRATING_Z + _KlickyDebug msg="probe_calibrate calling klipper probe_calibrate" + _PROBE_CALIBRATE {% for p in params + %}{'%s=%s ' % (p, params[p])}{% + endfor %} + _KLICKY_STATUS_READY + {% endif %} + +################ +# Probe Accuracy +[gcode_macro PROBE_ACCURACY] +rename_existing: _PROBE_ACCURACY +description:Probe Z-height accuracy at current XY position with klicky automount +gcode: + {% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %} + {% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %} + {% set max_x = printer["gcode_macro _User_Variables"].max_bed_x|float %} + {% set max_y = printer["gcode_macro _User_Variables"].max_bed_y|float %} + {% set probe_offset_x = printer['configfile'].config["probe"]["x_offset"]|float %} + {% set probe_offset_y = printer['configfile'].config["probe"]["y_offset"]|float %} + + {% if not 'xyz' in printer.toolhead.homed_axes %} + { action_raise_error("Must Home X, Y and Z Axis First!") } + {% endif %} + _KlickyDebug msg="probe_accuracy Axis homed" + _KlickyDebug msg="probe_accuracy Variables max_x={max_x},max_y={max_y},probe_offset_x={probe_offset_x},probe_offset_y={probe_offset_y}" + + _entry_point function=PROBE_ACCURACY + + # Protect against PROBE_ACCURACY performed from outside the bed + {% if printer['gcode_move'].position.y > (max_y - probe_offset_y) + or printer['gcode_move'].position.y < - probe_offset_y + or printer['gcode_move'].position.x > (max_x - probe_offset_x) + or printer['gcode_move'].position.x < - probe_offset_x %} + { action_raise_error("Must perform PROBE_ACCURACY with the probe above the BED, check klicky_variables bed size!") } + {% endif%} + + _CheckProbe action=query + Attach_Probe back=1 + + _KlickyDebug msg="probe_accuracy calling klipper probe accuracy" + _PROBE_ACCURACY {% for p in params + %}{'%s=%s ' % (p, params[p])}{% + endfor %} + + Dock_Probe back=1 + + _exit_point function=PROBE_ACCURACY move=1 + +############################################# +# Enable to SET_KINEMATIC_POSITION for Z hop +[force_move] +enable_force_move: True + +################# +# Homing Override +[homing_override] +axes: xyz +gcode: + # collect user state variables + _User_Variables + {% set verbose = printer["gcode_macro _User_Variables"].verbose %} + {% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %} + # Safe Z for travel + {% set safe_z = printer["gcode_macro _User_Variables"].safe_z %} + {% set enable_z_hop = printer["gcode_macro _User_Variables"].enable_z_hop %} + {% set kinematic_z = 0 %} + {% set dock_on_zhome = printer["gcode_macro _User_Variables"].dock_on_zhome|default(True) %} + {% set attachmove_y = printer["gcode_macro _User_Variables"].attachmove_y|default(0)|float %} + {% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %} + {% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %} + {% set home_backoff_x = printer["gcode_macro _User_Variables"].home_backoff_x|default(0)|float %} + {% set home_backoff_y = printer["gcode_macro _User_Variables"].home_backoff_y|default(0)|float %} + {% set override_homing = printer["gcode_macro _User_Variables"].override_homing|default('') %} + + #checks if the variable definitions are up to date + _klicky_check_variables_version + + _CheckProbe action=query + + # reset parameters + {% set home_x, home_y, home_z, leave_probe_attached = False, False, False, False %} + + {% if 'PROBE_LOCK' in params%} + {% if verbose %} + { action_respond_info("PROBE_LOCK = True") } + {% endif %} + {% set leave_probe_attached = True %} + {% endif %} + + # which axes have been requested for homing + {% if not 'X' in params + and not 'Y' in params + and not 'Z' in params %} + + {% set home_x, home_y, home_z = True, True, True %} + _KlickyDebug msg="homing_override going to home all axes" + + {% else %} + {% if 'X' in params %} + {% set home_x = True %} + _KlickyDebug msg="homing_override going to home X" + + {% endif %} + + {% if 'Y' in params %} + {% set home_y = True %} + _KlickyDebug msg="homing_override going to home Y" + {% endif %} + + {% if 'Z' in params %} + {% set home_z = True %} + _KlickyDebug msg="homing_override going to home Z" + {% endif %} + + {% if 'X' in params + and 'Y' in params + and 'Z' in params %} + # reset homing state variables + # if homing all axes + _Homing_Variables reset=1 + _KlickyDebug msg="homing_override going to home all axes" + {% endif %} + + {% endif %} + + _entry_point function=homing_override + _KLICKY_STATUS_HOMING + + # if Z is not homed, do not move the bed if it goes down + {% if 'z' not in printer.toolhead.homed_axes %} + {% if enable_z_hop == False %} # Disables safe_z + _KlickyDebug msg="homing_override z_hop disabled" + #preserve safe_z to use as the SET KINEMATIC Z position, so that the toolhead does not move to pick up the probe + {% set kinematic_z = safe_z %} + {% set safe_z = safe_z %} + {% endif %} + {% endif %} + + #On the first G28 after motors losing power, moves the Z to safe_z distance, if z_hop is enabled + {% if 'x' not in printer.toolhead.homed_axes and 'y' not in printer.toolhead.homed_axes and 'z' not in printer.toolhead.homed_axes%} + {% if verbose %} + { action_respond_info("No axis homed") } + {% endif %} + _KlickyDebug msg="homing_override no axis homed, setting position as X=Y=0 Z={kinematic_z}" + SET_KINEMATIC_POSITION X=0 Y=0 Z={kinematic_z} + M400 + _KlickyDebug msg="homing_override moving toolhead to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm" + {% if verbose %} + { action_respond_info("moving to a safe Z distance") } + {% endif %} + G0 Z{safe_z} F{z_drop_feedrate} + {% if home_z != True %} + _KlickyDebug msg="homing_override clearing axis homed state if not already homing Z" + M84 + {% endif %} + {% else %} + _KlickyDebug msg="All axis homed" + {% if printer.gcode_move.gcode_position.z > safe_z %} + {% set safe_z = printer.gcode_move.gcode_position.z|float %} + _KlickyDebug msg="Setting Safe_z to {printer.gcode_move.gcode_position.z}mm as Z is now above configured safe_z" + {% endif %} + {% endif %} + + {% if home_z %} + {% if 'x' not in printer.toolhead.homed_axes and 'y' not in printer.toolhead.homed_axes%} + {% if verbose %} + { action_respond_info("X or Y not homed, forcing full G28") } + {% endif %} + {% set home_x, home_y, home_z = True, True, True %} + {% endif %} + {% endif %} + + # if the dock is oriented on the Y, first do Y endstop + {% if ((attachmove_y == 0 and override_homing == '' ) or (override_homing == 'Y'))%} + # Home y + {% if home_y %} + {% if override_homing == 'Y' %} + _KlickyDebug msg="homing_override Y homing first override, due to override_homing = Y" + {% else %} + _KlickyDebug msg="homing_override Y homing first override, due to attachmove_y = 0" + {% endif %} + {% if verbose %} + { action_respond_info("Homing Y") } + {% endif %} + {% if 'z' in printer.toolhead.homed_axes and printer.gcode_move.gcode_position.z < safe_z %} + _KlickyDebug msg="homing_override moving toolhead to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm in Y homing seq" + {% if verbose %} + { action_respond_info("moving to a safe Z distance") } + {% endif %} + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + {% if printer["gcode_macro _HOME_Y"] is defined %} + _KlickyDebug msg="homing_override calling _HOME_Y external script to handle the Y homing" + _HOME_Y + {% else %} + _KlickyDebug msg="homing_override Homing Y G28 Y0" + G28 Y0 + # does it need to back away from the home position + {% if home_backoff_y != 0 %} + {% if (printer.configfile.settings.stepper_y.position_endstop > (printer.configfile.settings.stepper_y.position_min|default(0) + printer.configfile.settings.stepper_y.position_max)/2) %} + _KlickyDebug msg="homing_override backing off Y endstop, G0 Y{printer.configfile.settings.stepper_y.position_endstop-home_backoff_y} F{travel_feedrate}" + G0 Y{printer.configfile.settings.stepper_y.position_endstop - home_backoff_y} F{travel_feedrate} + {% else %} + _KlickyDebug msg="homing_override backing off Y endstop, G0 Y{printer.configfile.settings.stepper_y.position_endstop + home_backoff_y} F{travel_feedrate}" + G0 Y{printer.configfile.settings.stepper_y.position_endstop + home_backoff_y} F{travel_feedrate} + {%endif %} + {%endif %} + {% endif %} + {% endif %} + {% set home_y = False %} + {% endif %} + + + # Home x + {% if home_x %} + {% if verbose %} + { action_respond_info("Homing X") } + {% endif %} + {% if 'z' in printer.toolhead.homed_axes and printer.gcode_move.gcode_position.z < safe_z %} + _KlickyDebug msg="homing_override moving toolhead to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm in X homing seq" + {% if verbose %} + { action_respond_info("moving to a safe Z distance") } + {% endif %} + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + {% if printer["gcode_macro _HOME_X"] is defined %} + _KlickyDebug msg="homing_override calling _HOME_X external script to handle the X homing" + _HOME_X + {% else %} + _KlickyDebug msg="homing_override Homing X, G28 X0" + G28 X0 + # does it need to back away from the home position + {% if home_backoff_x != 0 %} + {% if (printer.configfile.settings.stepper_x.position_endstop > (printer.configfile.settings.stepper_x.position_min|default(0) + printer.configfile.settings.stepper_x.position_max)/2) %} + _KlickyDebug msg="homing_override backing off X endstop, G0 X{printer.configfile.settings.stepper_x.position_endstop - home_backoff_x} F{travel_feedrate}" + G0 X{printer.configfile.settings.stepper_x.position_endstop - home_backoff_x} F{travel_feedrate} + {% else %} + _KlickyDebug msg="homing_override backing off X endstop, G0 X{printer.configfile.settings.stepper_x.position_endstop + home_backoff_x} F{travel_feedrate}" + G0 X{printer.configfile.settings.stepper_x.position_endstop + home_backoff_x} F{travel_feedrate} + {%endif %} + {%endif %} + {% endif %} + {% endif %} + + # Home y + {% if home_y %} + {% if verbose %} + { action_respond_info("Homing Y") } + {% endif %} + {% if 'z' in printer.toolhead.homed_axes and printer.gcode_move.gcode_position.z < safe_z %} + _KlickyDebug msg="homing_override moving toolhead to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm in Y homing seq" + {% if verbose %} + { action_respond_info("moving to a safe Z distance") } + {% endif %} + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + {% if printer["gcode_macro _HOME_Y"] is defined %} + _KlickyDebug msg="homing_override calling _HOME_Y external script to handle the Y homing" + _HOME_Y + {% else %} + _KlickyDebug msg="homing_override Homing Y, G28 Y0" + G28 Y0 + {% if home_backoff_y != 0 %} + {% if (printer.configfile.settings.stepper_y.position_endstop > (printer.configfile.settings.stepper_y.position_min|default(0) + printer.configfile.settings.stepper_y.position_max)/2) %} + _KlickyDebug msg="homing_override backing off Y endstop, G0 Y{printer.configfile.settings.stepper_y.position_endstop - home_backoff_y} F{travel_feedrate}" + G0 Y{printer.configfile.settings.stepper_y.position_endstop - home_backoff_y} F{travel_feedrate} + {% else %} + _KlickyDebug msg="homing_override backing off Y endstop, G0 Y{printer.configfile.settings.stepper_y.position_endstop + home_backoff_y} F{travel_feedrate}" + G0 Y{printer.configfile.settings.stepper_y.position_endstop + home_backoff_y} F{travel_feedrate} + {%endif %} + {%endif %} + {% endif %} + {% endif %} + # Home z + {% if home_z %} + {% if verbose %} + { action_respond_info("Homing Z") } + {% endif %} + {% if 'z' in printer.toolhead.homed_axes and printer.gcode_move.gcode_position.z < safe_z %} + _KlickyDebug msg="homing_override moving toolhead to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm in Y homing seq" + {% if verbose %} + { action_respond_info("moving to a safe Z distance") } + {% endif %} + G0 Z{safe_z} F{z_drop_feedrate} + {% endif %} + + # if probe is configured as endstop, attach it, else check if the probe needs to be docked if attached + {% if 'z_virtual_endstop' in printer['configfile'].config["stepper_z"]["endstop_pin"] %} + _KlickyDebug msg="homing_override probe configured as a virtual Z endstop attaching probe" + Attach_Probe + # if PROBE_LOCK parameter is given, Attach Probe and lock until it´s unlocked + {% if leave_probe_attached %} + _Probe_Lock + {% endif %} + {% elif dock_on_zhome == True %} + Dock_Probe + {% endif %} + + _Home_Z_ + + # if probe is configured as endstop, dock it + {% if 'z_virtual_endstop' in printer['configfile'].config["stepper_z"]["endstop_pin"] %} + _KlickyDebug msg="homing_override probe no longer required, docking probe" + Dock_Probe + {% elif dock_on_zhome == False %} + Dock_Probe + {% endif %} + {% endif %} + _CheckProbe action=query + + # park the toolhead + _Park_Toolhead + + _exit_point function=homing_override + _KLICKY_STATUS_READY + +# Umbilical path setup +[gcode_macro _Umbilical_Path] +gcode: + {% set umbilical = printer["gcode_macro _User_Variables"].umbilical %} + {% set umbilical_x = printer["gcode_macro _User_Variables"].umbilical_x %} + {% set umbilical_y = printer["gcode_macro _User_Variables"].umbilical_y %} + {% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %} + {% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %} + + {% if umbilical %} + # Used to give the umbilical a better path to follow and coil properly if dock is tight in space + _entry_point function=Umbilical_Path + + _KlickyDebug msg="_Umbilical_Path moving to G0 X{umbilical_x} Y{umbilical_y} Z{safe_z} F{travel_feedrate}" + G0 X{umbilical_x} Y{umbilical_y} Z{safe_z} F{travel_feedrate} + + _exit_point function=Umbilical_Path + {% endif %} + + +# Home Z Routine +[gcode_macro _Home_Z_] +gcode: + {% set z_endstop_x = printer["gcode_macro _Probe_Variables"].z_endstop_x %} + {% set z_endstop_y = printer["gcode_macro _Probe_Variables"].z_endstop_y %} + {% set safe_z = printer["gcode_macro _User_Variables"].safe_z|float %} + {% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %} {% set z_drop_feedrate = printer["gcode_macro _User_Variables"].z_drop_speed * 60 %} + {% set verbose = printer["gcode_macro _User_Variables"].verbose %} + + _entry_point function=Home_Z + + # if x and y are not homed yet, raise error + {% if not 'xy' in printer.toolhead.homed_axes %} + { action_raise_error("Must Home X and Y Axis First!") } + {% else %} + _KlickyDebug msg="_Home_Z_ XY Axis homed" + {% if not 'z' in printer.toolhead.homed_axes %} + {% if verbose %} + { action_respond_info("Resetting Z position to zero") } + {% endif %} + _KlickyDebug msg="_Home_Z_ Z not homed, setting position as X=Y=Z=0" + SET_KINEMATIC_POSITION Z=0 + {% endif %} + + # Move tool to safe homing position and home Z axis + # location of z endstop + _KlickyDebug msg="_Home_Z_ moving to Z endstop position G0 X{z_endstop_x} Y{z_endstop_y} F{travel_feedrate}" + G0 X{z_endstop_x} Y{z_endstop_y} F{travel_feedrate} + _KlickyDebug msg="_Home_Z_ Homing Z G28 Z" + G28 Z0 + _KlickyDebug msg="_Home_Z_ toolhead too low, raising it to {safe_z}mm from {printer.gcode_move.gcode_position.z}mm" + G0 Z{safe_z} F{z_drop_feedrate} + + {% endif %} + + _exit_point function=Home_Z + +# Check to see if probe is where it is supposed to be after +# attaching/docking maneuver and set homing error or shutdown +[gcode_macro _CheckProbe] +variable_probe_state: 0 +gcode: + Query_Probe + _SetProbeState action={ params.ACTION } + +# Due to how templates are evaluated, we have query endstops in one +# macro and call another macro to make decisions based on the result +[gcode_macro _SetProbeState] +gcode: + {% set query_probe_triggered = printer.probe.last_query %} + {% set action = params.ACTION|default('') %} + + # If triggered (true), probe not attached + {% if query_probe_triggered %} + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ False } + {% else %} + # If not triggered (false), probe attached + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_attached VALUE={ True } + {% endif %} + + {% if action == 'query' %} + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=probe_state VALUE={ query_probe_triggered } + {% endif %} + + # If probe fails to attach/detach + + # If not docked + {% if not query_probe_triggered and action == 'dock' %} + { action_raise_error("Probe dock failed!") } + {% endif %} + + # If not attached + {% if query_probe_triggered and action == 'attach' %} + { action_raise_error("Probe attach failed!") } + {% endif %} + +# Park Toolhead Routine +[gcode_macro _Park_Toolhead] +gcode: + {% set park_toolhead = printer["gcode_macro _User_Variables"].park_toolhead %} + {% set parkposition_x = printer["gcode_macro _User_Variables"].parkposition_x %} + {% set parkposition_y = printer["gcode_macro _User_Variables"].parkposition_y %} + {% set parkposition_z = printer["gcode_macro _User_Variables"].parkposition_z %} + {% set travel_feedrate = printer["gcode_macro _User_Variables"].travel_speed * 60 %} + {% set verbose = printer["gcode_macro _User_Variables"].verbose %} + + _entry_point function=Park_Toolhead + + {% if park_toolhead and 'xyz' in printer.toolhead.homed_axes %} + {% if verbose %} + { action_respond_info("Parking Toolhead") } + {% endif %} + {% if parkposition_z == -128 %} + _KlickyDebug msg="_Park_Toolhead moving to G0 X{parkposition_x} Y{parkposition_y} F{travel_feedrate}" + G0 X{parkposition_x} Y{parkposition_y} F{travel_feedrate} + + {% else %} + + _KlickyDebug msg="_Park_Toolhead moving to G0 X{parkposition_x} Y{parkposition_y} Z{parkposition_z} F{travel_feedrate}" + G0 X{parkposition_x} Y{parkposition_y} Z{parkposition_z} F{travel_feedrate} + + {% endif %} + + {% endif %} + _exit_point function=Park_Toolhead + + + +################# +# Status LEDs +# This enables stealthburner-led status macros to be used in klicky macros if they exist. +# https://github.com/VoronDesign/Voron-Afterburner/blob/sb-beta/Klipper_Macros/stealthburner_leds.cfg +[gcode_macro _klicky_status_ready] +gcode: + {% if printer['gcode_macro status_ready'] is defined %} + _KlickyDebug msg="_klicky_status_ready activating the LED STATUS_READY" + STATUS_READY + {% endif %} + +[gcode_macro _klicky_status_busy] +gcode: + {% if printer['gcode_macro status_busy'] is defined %} + _KlickyDebug msg="_klicky_status_busy activating the LED STATUS_BUSY" + STATUS_BUSY + {% endif %} + +[gcode_macro _klicky_status_leveling] +gcode: + {% if printer['gcode_macro status_leveling'] is defined %} + _KlickyDebug msg="_klicky_status_leveling activating the LED STATUS_LEVELING" + STATUS_LEVELING + {% endif %} + +[gcode_macro _klicky_status_homing] +gcode: + {% if printer['gcode_macro status_homing'] is defined %} + _KlickyDebug msg="_klicky_status_homing activating the LED STATUS_HOMING" + STATUS_HOMING + {% endif %} + +[gcode_macro _klicky_status_cleaning] +gcode: + {% if printer['gcode_macro status_cleaning'] is defined %} + _KlickyDebug msg="_klicky_status_cleaning activating the LED STATUS_CLEANING" + STATUS_CLEANING + {% endif %} + +[gcode_macro _klicky_status_meshing] +gcode: + {% if printer['gcode_macro status_meshing'] is defined %} + _KlickyDebug msg="_klicky_status_meshing activating the LED STATUS_MESHING" + STATUS_MESHING + {% endif %} + +[gcode_macro _klicky_status_calibrating_z] +gcode: + {% if printer['gcode_macro status_calibrating_z'] is defined %} + _KlickyDebug msg="_klicky_status_calibrating_z activating the LED STATUS_CALIBRATING_Z" + STATUS_CALIBRATING_Z + {% endif %} diff --git a/printer_data/config/klicky-probe.cfg b/printer_data/config/klicky-probe.cfg new file mode 100644 index 0000000..ece86be --- /dev/null +++ b/printer_data/config/klicky-probe.cfg @@ -0,0 +1,10 @@ +#Simple way to include all the various klicky macros and configurations +# the current home for this configuration is https://github.com/jlas1/Klicky-Probe, please check it + +[include ./klicky-specific.cfg] #place to put other configurations specific to your printer +[include ./klicky-variables.cfg] #Required +[include ./klicky-macros.cfg] #Required +[include ./klicky-bed-mesh-calibrate.cfg] #bed mesh, requires klipper configuration +#[include ./klicky-screws-tilt-calculate.cfg] #help adjust bed screws automatically +#[include ./klicky-quad-gantry-level.cfg] #level 4 Z motors +[include ./klicky-z-tilt-adjust.cfg] #level 2 or 3 Z motors diff --git a/printer_data/config/klicky-specific.cfg b/printer_data/config/klicky-specific.cfg new file mode 100644 index 0000000..e69de29 diff --git a/printer_data/config/klicky-variables.cfg b/printer_data/config/klicky-variables.cfg new file mode 100644 index 0000000..761b975 --- /dev/null +++ b/printer_data/config/klicky-variables.cfg @@ -0,0 +1,109 @@ +# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me. +# I have tweaked it a lot. +# They are based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, +# modified for better use on K-series printers by RyanG and Trails", kudos to them. +# That macro as since evolved into a klipper plugin that currently is pending inclusion in klipper, +# more information here, https://github.com/Annex-Engineering/Quickdraw_Probe/tree/main/Klipper_Macros +# User richardjm revised the macro variables and added some functions, thanks a lot +# by standing on the shoulders of giants, lets see if we can see further +# +# the current home for this version is https://github.com/jlas1/Klicky-Probe +# the 1000 values below is to give an error instead of doing something wrong, hopefully, this won't be used is a printer larger than 1 meter + +[gcode_macro _User_Variables] +variable_verbose: True # Enable verbose output +variable_debug: False # Enable Debug output +variable_travel_speed: 200 # how fast all other travel moves will be performed when running these macros +variable_move_accel: 1000 # how fast should the toolhead accelerate when moving +variable_dock_speed: 50 # how fast should the toolhead move when docking the probe for the final movement +variable_release_speed: 75 # how fast should the toolhead move to release the hold of the magnets after docking +variable_z_drop_speed: 20 # how fast the z will lower when moving to the z location to clear the probe + +variable_safe_z: 25 # Minimum Z for attach/dock and homing functions +# if true it will move the bed away from the nozzle when Z is not homed +variable_enable_z_hop: True # set this to false for beds that fall significantly under gravity (almost to Z max) + +variable_max_bed_y: 350 # maximum Bed size avoids doing a probe_accuracy outside the bed +variable_max_bed_x: 350 # maximum Bed size avoids doing a probe_accuracy outside the bed + +# if a separate Z endstop switch is in +# use, specify the coordinates of the switch here (Voron). +# Set to 0 to have the probe move to center of bed +variable_z_endstop_x: 0 +variable_z_endstop_y: 0 + +#Check the printer specific documentation on klipper Dock/Undock configuration, these are dummy values +#dock location +variable_docklocation_x: 37 # X Dock position +variable_docklocation_y: 349 # Y Dock position +variable_docklocation_z: -128 # Z dock position (-128 for a gantry/frame mount) + +#The following variables are used if the dock is deployed and retracted via a servo motor +variable_enable_dock_servo: False # Set to true if your klicky dock is servo-controlled +variable_servo_name: 'NAME' # The name of the dock servo defined in printer.cfg under [servo] +variable_servo_deploy: 10 # This EXAMPLE is the value used to deploy the servo fully +variable_servo_retract: 11 # This EXAMPLE is the value used to retract the servo fully (initial_angle in [servo] config) +variable_servo_delay: 250 # This is a delay to wait the servo to reach the requested position, be carefull with high values + +#Dock move, final toolhead movement to release the probe on the dock +#it's a relative move +Variable_dockmove_x: 40 +Variable_dockmove_y: 0 +Variable_dockmove_z: 0 + +#Attach move. final toolhead movement to attach the probe on the mount +#it's a relative move +Variable_attachmove_x: 0 +Variable_attachmove_y: 30 +Variable_attachmove_z: 0 + +#Umbilical to help untangle the umbilical in difficult situations +variable_umbilical: False # should we untangle the umbilical +variable_umbilical_x: 15 # X umbilical position +variable_umbilical_y: 15 # Y umbilical position + +# location to park the toolhead +variable_park_toolhead: False # Enable toolhead parking +variable_parkposition_x: 125 +variable_parkposition_y: 125 +variable_parkposition_z: 30 # -128 excludes Z - Park only on X-Y + +variable_version: 1 # Helps users to update the necessary variables, do not update if the variables above are not updated + +#Below this remark, you normally do not need to configure +#Attach move2 +Variable_attachmove2_x: 0 # intermediate toolhead movement to attach +Variable_attachmove2_y: 0 # the probe on the dock +Variable_attachmove2_z: 0 # (can be negative) + +variable_home_backoff_x: 10 # how many mm to move away from the X endstop after homing X + # this is useful for the voron v0 to enable the toolhead to move out of the way to allow an unstricted Y homing +variable_home_backoff_y: 10 # how many mm to move away from the Y endstop after homing Y + +variable_override_homing: '' # configures what axis to home first + # '' = default klicky behavior (tries to avoid the hitting the dock) + # 'X' = forces X to home first + # 'Y' = forces Y to home first + +variable_dock_on_zhome: True # docks the probe on Z Homing if not necessary (avoids hitting the bed on some printers + +variable_bypass_probe_docking: False + +# Do not modify below +gcode: + {% set Mx = printer['configfile'].config["stepper_x"]["position_max"]|float %} + {% set My = printer['configfile'].config["stepper_y"]["position_max"]|float %} + {% set Ox = printer['configfile'].config["probe"]["x_offset"]|float %} + {% set Oy = printer['configfile'].config["probe"]["y_offset"]|float %} + {% set Oz = printer['configfile'].config["probe"]["z_offset"]|float %} + + # If x, y coordinates are set for z endstop, assign them + {% if z_endstop_x != 0 or z_endstop_y != 0 %} + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ z_endstop_x } + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ z_endstop_y } + + # if no x, y coordinates for z endstop, assume probe is endstop and move toolhead to center of bed + {% else %} + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_x VALUE={ (Mx * 0.5) - Ox } + SET_GCODE_VARIABLE MACRO=_Probe_Variables VARIABLE=z_endstop_y VALUE={ (My * 0.5) - Oy } + {% endif %} diff --git a/printer_data/config/klicky-z-tilt-adjust.cfg b/printer_data/config/klicky-z-tilt-adjust.cfg new file mode 100644 index 0000000..3264c85 --- /dev/null +++ b/printer_data/config/klicky-z-tilt-adjust.cfg @@ -0,0 +1,32 @@ +# This macro was provided by discord user Garrettwp to whom i give my thanks for sharing it with me. +# I have tweaked it a lot. +# +# this macro is based on the great Annex magprobe dockable probe macros "#Originally developed by Mental, modified for better use on K-series printers by RyanG and Trails" +# that macro as since evolved into a klipper plugin that currently is pending inclusion in klipper +# more information here https://github.com/Annex-Engineering/Quickdraw_Probe/tree/main/Klipper_Macros +# +# by standing on the shoulders of giants, lets see if we can see further +# User richardjm revised the macro variables and added some functions, thanks a lot +# This macro home is https://github.com/jlas1/Klicky-Probe + +################### +## Z Tilt Adjust +[gcode_macro Z_TILT_ADJUST] +rename_existing: _Z_TILT_ADJUST +description: +gcode: + {% set V = printer["gcode_macro _User_Variables"].verbose %} + {% if V %} + { action_respond_info("Z Tilt Adjust") } + {% endif %} + + _CheckProbe action=query + G90 + Attach_Probe + _KLICKY_STATUS_LEVELING + + _Z_TILT_ADJUST {% for p in params + %}{'%s=%s ' % (p, params[p])}{% + endfor %} + Dock_Probe + G28 Z0 \ No newline at end of file diff --git a/printer_data/config/mainsail.cfg b/printer_data/config/mainsail.cfg new file mode 100644 index 0000000..0dd46db --- /dev/null +++ b/printer_data/config/mainsail.cfg @@ -0,0 +1,230 @@ +## Client klipper macro definitions +## +## Copyright (C) 2022 Alex Zellner +## +## This file may be distributed under the terms of the GNU GPLv3 license +## +## !!! This file is read-only. Maybe the used editor indicates that. !!! +## +## Customization: +## 1) copy the gcode_macro _CLIENT_VARIABLE (see below) to your printer.cfg +## 2) remove the comment mark (#) from all lines +## 3) change any value in there to your needs +## +## Use the PAUSE macro direct in your M600: +## e.g. with a different park position front left and a minimal height of 50 +## [gcode_macro M600] +## description: Filament change +## gcode: PAUSE X=10 Y=10 Z_MIN=50 +## Z_MIN will park the toolhead at a minimum of 50 mm above to bed to make it easier for you to swap filament. +## +## Client variable macro for your printer.cfg +#[gcode_macro _CLIENT_VARIABLE] +#variable_use_custom_pos : False ; use custom park coordinates for x,y [True/False] +#variable_custom_park_x : 0.0 ; custom x position; value must be within your defined min and max of X +#variable_custom_park_y : 0.0 ; custom y position; value must be within your defined min and max of Y +#variable_custom_park_dz : 2.0 ; custom dz value; the value in mm to lift the nozzle when move to park position +#variable_retract : 1.0 ; the value to retract while PAUSE +#variable_cancel_retract : 5.0 ; the value to retract while CANCEL_PRINT +#variable_speed_retract : 35.0 ; retract speed in mm/s +#variable_unretract : 1.0 ; the value to unretract while RESUME +#variable_speed_unretract : 35.0 ; unretract speed in mm/s +#variable_speed_hop : 15.0 ; z move speed in mm/s +#variable_speed_move : 100.0 ; move speed in mm/s +#variable_park_at_cancel : False ; allow to move the toolhead to park while execute CANCEL_PRINT [True/False] +#variable_park_at_cancel_x : None ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True +#variable_park_at_cancel_y : None ; different park position during CANCEL_PRINT [None/Position as Float]; park_at_cancel must be True +## !!! Caution [firmware_retraction] must be defined in the printer.cfg if you set use_fw_retract: True !!! +#variable_use_fw_retract : False ; use fw_retraction instead of the manual version [True/False] +#variable_idle_timeout : 0 ; time in sec until idle_timeout kicks in. Value 0 means that no value will be set or restored +#gcode: + +[virtual_sdcard] +path: ~/printer_data/gcodes +on_error_gcode: CANCEL_PRINT + +[pause_resume] + +[display_status] + +[gcode_macro CANCEL_PRINT] +description: Cancel the actual running print +rename_existing: CANCEL_PRINT_BASE +gcode: + ##### get user parameters or use default ##### + {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} + {% set allow_park = client.park_at_cancel|default(false)|lower == 'true' %} + {% set retract = client.cancel_retract|default(5.0)|abs %} + ##### define park position ##### + {% set park_x = "" if (client.park_at_cancel_x|default(none) is none) + else "X=" ~ client.park_at_cancel_x %} + {% set park_y = "" if (client.park_at_cancel_y|default(none) is none) + else "Y=" ~ client.park_at_cancel_y %} + {% set custom_park = park_x|length > 0 or park_y|length > 0 %} + ##### end of definitions ##### + # restore idle_timeout time if needed + {% if printer['gcode_macro PAUSE'].restore_idle_timeout > 0 %} + SET_IDLE_TIMEOUT TIMEOUT={printer['gcode_macro PAUSE'].restore_idle_timeout} + {% endif %} + {% if (custom_park or not printer.pause_resume.is_paused) and allow_park %} _TOOLHEAD_PARK_PAUSE_CANCEL {park_x} {park_y} {% endif %} + _CLIENT_RETRACT LENGTH={retract} + TURN_OFF_HEATERS + M106 S0 + # clear pause_next_layer and pause_at_layer as preparation for next print + SET_PAUSE_NEXT_LAYER ENABLE=0 + SET_PAUSE_AT_LAYER ENABLE=0 LAYER=0 + CANCEL_PRINT_BASE + +[gcode_macro PAUSE] +description: Pause the actual running print +rename_existing: PAUSE_BASE +variable_restore_idle_timeout: 0 +gcode: + ##### get user parameters or use default ##### + {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} + {% set idle_timeout = client.idle_timeout|default(0) %} + ##### end of definitions ##### + SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=last_extruder_temp VALUE={printer[printer.toolhead.extruder].target} + # set a new idle_timeout value + {% if idle_timeout > 0 %} + SET_GCODE_VARIABLE MACRO=PAUSE VARIABLE=restore_idle_timeout VALUE={printer.configfile.settings.idle_timeout.timeout} + SET_IDLE_TIMEOUT TIMEOUT={idle_timeout} + {% endif %} + PAUSE_BASE + _TOOLHEAD_PARK_PAUSE_CANCEL {rawparams} + +[gcode_macro RESUME] +description: Resume the actual running print +rename_existing: RESUME_BASE +variable_last_extruder_temp: 0 +gcode: + ##### get user parameters or use default ##### + {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} + {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} + {% set sp_move = client.speed_move|default(velocity) %} + ##### end of definitions ##### + # restore idle_timeout time if needed + {% if printer['gcode_macro PAUSE'].restore_idle_timeout > 0 %} + SET_IDLE_TIMEOUT TIMEOUT={printer['gcode_macro PAUSE'].restore_idle_timeout} + {% endif %} + M109 S{last_extruder_temp} + _CLIENT_EXTRUDE + RESUME_BASE VELOCITY={params.VELOCITY|default(sp_move)} + +# Usage: SET_PAUSE_NEXT_LAYER [ENABLE=[0|1]] [MACRO=] +[gcode_macro SET_PAUSE_NEXT_LAYER] +description: Enable a pause if the next layer is reached +gcode: + {% set pause_next_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_next_layer %} + {% set ENABLE = params.ENABLE|default(1)|int != 0 %} + {% set MACRO = params.MACRO|default(pause_next_layer.call, True) %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_next_layer VALUE="{{ 'enable': ENABLE, 'call': MACRO }}" + +# Usage: SET_PAUSE_AT_LAYER [ENABLE=[0|1]] [LAYER=] [MACRO=] +[gcode_macro SET_PAUSE_AT_LAYER] +description: Enable/disable a pause if a given layer number is reached +gcode: + {% set pause_at_layer = printer['gcode_macro SET_PRINT_STATS_INFO'].pause_at_layer %} + {% set ENABLE = params.ENABLE|int != 0 if params.ENABLE is defined + else params.LAYER is defined %} + {% set LAYER = params.LAYER|default(pause_at_layer.layer)|int %} + {% set MACRO = params.MACRO|default(pause_at_layer.call, True) %} + SET_GCODE_VARIABLE MACRO=SET_PRINT_STATS_INFO VARIABLE=pause_at_layer VALUE="{{ 'enable': ENABLE, 'layer': LAYER, 'call': MACRO }}" + +# Usage: SET_PRINT_STATS_INFO [TOTAL_LAYER=] [CURRENT_LAYER= ] +[gcode_macro SET_PRINT_STATS_INFO] +rename_existing: SET_PRINT_STATS_INFO_BASE +description: Overwrite, to get pause_next_layer and pause_at_layer feature +variable_pause_next_layer: { 'enable': False, 'call': "PAUSE" } +variable_pause_at_layer : { 'enable': False, 'layer': 0, 'call': "PAUSE" } +gcode: + {% if pause_next_layer.enable %} + {action_respond_info("%s, forced by pause_next_layer" % pause_next_layer.call)} + {pause_next_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE + SET_PAUSE_NEXT_LAYER ENABLE=0 + {% elif pause_at_layer.enable and params.CURRENT_LAYER is defined and params.CURRENT_LAYER|int == pause_at_layer.layer %} + {action_respond_info("%s, forced by pause_at_layer [%d]" % (pause_at_layer.call, pause_at_layer.layer))} + {pause_at_layer.call} ; execute the given gcode to pause, should be either M600 or PAUSE + SET_PAUSE_AT_LAYER ENABLE=0 + {% endif %} + SET_PRINT_STATS_INFO_BASE {rawparams} + +##### internal use ##### +[gcode_macro _TOOLHEAD_PARK_PAUSE_CANCEL] +description: Helper: park toolhead used in PAUSE and CANCEL_PRINT +gcode: + ##### get user parameters or use default ##### + {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} + {% set velocity = printer.configfile.settings.pause_resume.recover_velocity %} + {% set use_custom = client.use_custom_pos|default(false)|lower == 'true' %} + {% set custom_park_x = client.custom_park_x|default(0.0) %} + {% set custom_park_y = client.custom_park_y|default(0.0) %} + {% set park_dz = client.custom_park_dz|default(2.0)|abs %} + {% set sp_hop = client.speed_hop|default(15) * 60 %} + {% set sp_move = client.speed_move|default(velocity) * 60 %} + ##### get config and toolhead values ##### + {% set origin = printer.gcode_move.homing_origin %} + {% set act = printer.gcode_move.gcode_position %} + {% set max = printer.toolhead.axis_maximum %} + {% set cone = printer.toolhead.cone_start_z|default(max.z) %} ; height as long the toolhead can reach max and min of an delta + {% set round_bed = True if printer.configfile.settings.printer.kinematics is in ['delta','polar','rotary_delta','winch'] + else False %} + ##### define park position ##### + {% set z_min = params.Z_MIN|default(0)|float %} + {% set z_park = [[(act.z + park_dz), z_min]|max, (max.z - origin.z)]|min %} + {% set x_park = params.X if params.X is defined + else custom_park_x if use_custom + else 0.0 if round_bed + else (max.x - 5.0) %} + {% set y_park = params.Y if params.Y is defined + else custom_park_y if use_custom + else (max.y - 5.0) if round_bed and z_park < cone + else 0.0 if round_bed + else (max.y - 5.0) %} + ##### end of definitions ##### + _CLIENT_RETRACT + {% if "xyz" in printer.toolhead.homed_axes %} + G90 + G1 Z{z_park} F{sp_hop} + G1 X{x_park} Y{y_park} F{sp_move} + {% if not printer.gcode_move.absolute_coordinates %} G91 {% endif %} + {% else %} + {action_respond_info("Printer not homed")} + {% endif %} + +[gcode_macro _CLIENT_EXTRUDE] +description: Extrudes, if the extruder is hot enough +gcode: + {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} + {% set use_fw_retract = (client.use_fw_retract|default(false)|lower == 'true') and (printer.firmware_retraction is defined) %} + {% set length = params.LENGTH|default(client.unretract)|default(1.0)|float %} + {% set speed = params.SPEED|default(client.speed_unretract)|default(35) %} + {% set absolute_extrude = printer.gcode_move.absolute_extrude %} + + {% if printer.extruder.can_extrude %} + {% if use_fw_retract %} + {% if length < 0 %} + G10 + {% else %} + G11 + {% endif %} + {% else %} + M83 + G1 E{length} F{(speed|float|abs) * 60} + {% if absolute_extrude %} + M82 + {% endif %} + {% endif %} + {% else %} + {action_respond_info("Extruder not hot enough")} + {% endif %} + +[gcode_macro _CLIENT_RETRACT] +description: Retracts, if the extruder is hot enough +gcode: + {% set client = printer['gcode_macro _CLIENT_VARIABLE']|default({}) %} + {% set length = params.LENGTH|default(client.retract)|default(1.0)|float %} + {% set speed = params.SPEED|default(client.speed_retract)|default(35) %} + + _CLIENT_EXTRUDE LENGTH=-{length|float|abs} SPEED={speed|float|abs} + \ No newline at end of file diff --git a/printer_data/config/moonraker.conf b/printer_data/config/moonraker.conf new file mode 100644 index 0000000..a1efd26 --- /dev/null +++ b/printer_data/config/moonraker.conf @@ -0,0 +1,117 @@ +[server] +host: 0.0.0.0 +port: 7125 +# The maximum size allowed for a file upload (in MiB). Default 1024 MiB +max_upload_size: 1024 +# Path to klippy Unix Domain Socket +klippy_uds_address: ~/printer_data/comms/klippy.sock + +[file_manager] +# post processing for object cancel. Not recommended for low resource SBCs such as a Pi Zero. Default False +enable_object_processing: True + +[authorization] +cors_domains: + https://my.mainsail.xyz + http://my.mainsail.xyz + http://*.local + http://*.lan +trusted_clients: + 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 + 100.0.0.0/8 + +# enables partial support of Octoprint API +[octoprint_compat] + +# enables moonraker to track and store print history. +[history] + +# this enables moonraker announcements for mainsail +[announcements] +subscriptions: + mainsail + +# this enables moonraker's update manager +[update_manager] +refresh_interval: 168 +enable_auto_refresh: True + +[update_manager mainsail] +type: web +channel: stable +repo: mainsail-crew/mainsail +path: ~/mainsail + +[update_manager mainsail-config] +type: git_repo +primary_branch: master +path: ~/mainsail-config +origin: https://github.com/mainsail-crew/mainsail-config.git +managed_services: klipper + +### moonraker-timelapse +### Don't forget to include timelapse.cfg to your printer.cfg +### Uncomment to enable moonraker-timelapse + + +[update_manager timelapse] +type: git_repo +primary_branch: main +path: ~/moonraker-timelapse +origin: https://github.com/mainsail-crew/moonraker-timelapse.git +managed_services: klipper moonraker + +[timelapse] +## Directory where the generated video will be saved +output_path: ~/printer_data/timelapse/ +frame_path: /tmp/timelapse/printer +## Directory where ffmpeg is installed +ffmpeg_binary_path: /usr/bin/ffmpeg + +# Crowsnest update_manager entry +[update_manager crowsnest] +type: git_repo +path: ~/crowsnest +origin: https://github.com/mainsail-crew/crowsnest.git +managed_services: crowsnest +install_script: tools/install.sh +#install_script: tools/pkglist.sh + +# Sonar update_manager entry +[update_manager sonar] +type: git_repo +path: ~/sonar +origin: https://github.com/mainsail-crew/sonar.git +primary_branch: main +managed_services: sonar +install_script: tools/install.sh + +[update_manager Klipper-Adaptive-Meshing-Purging] + type: git_repo + channel: dev + path: ~/Klipper-Adaptive-Meshing-Purging + origin: https://github.com/kyleisah/Klipper-Adaptive-Meshing-Purging.git + managed_services: klipper + primary_branch: main + +#[include octoeverywhere-system.cfg] +[update_manager klipper-backup] +type: git_repo +path: ~/klipper-backup +origin: https://github.com/Staubgeborener/klipper-backup.git +managed_services: moonraker +primary_branch: main + +[update_manager led_effect] +type: git_repo +path: ~/klipper-led_effect +origin: https://github.com/julianschill/klipper-led_effect.git +is_system_service: False + + diff --git a/printer_data/config/nevermore.cfg b/printer_data/config/nevermore.cfg new file mode 100644 index 0000000..e880321 --- /dev/null +++ b/printer_data/config/nevermore.cfg @@ -0,0 +1,46 @@ +## This is a simple include for the Nevermore. To use it with your printer, edit +## the pin definition in line 16 so it matches your printer. +## What you get: +## - a generic fan "Nevermore" which is adjustable in GCODE and in Mainsail/Fluidd +## - Commands in your 12864-controller to turn the fan on/off or adjust in 10%-steps +## - a Macro to turn the fan off some time after the print. +## +## Slicer integration: Add "SET_FAN_SPEED FAN=Nevermore SPEED=1" in your start-macro +## (or less fan depending on your needs, like SPEED=0.8) +## in your end print code, add "UPDATE_DELAYED_GCODE ID=filter_off DURATION=180" +## this keeps your Nevermore running for 180s after the print finishes to clean the chamber a bit more. + +[fan_generic Nevermore] +## Nevermore - FAN5 on Octopus +## Adjust if you use a different board or a different terminal. +pin: PD13 + +[menu __main __control __nevermoreonoff] +type: command +name: Nevermore {'ON' if printer['fan_generic Nevermore'].speed > 0 else 'OFF'} +enable: {'fan_generic Nevermore' in printer} +gcode: + TOGGLE_NEVERMORE + +[menu __main __control __filterspeed] +type: input +enable: {'fan_generic Nevermore' in printer} +name: Filter %: {'%3d' % (menu.input*100)}% +input: {printer["fan_generic Nevermore"].speed} +input_min: 0 +input_max: 1 +input_step: 0.1 +gcode: + SET_FAN_SPEED FAN=Nevermore SPEED={menu.input} + +[delayed_gcode filter_off] +gcode: + SET_FAN_SPEED FAN=Nevermore SPEED=0 + +[gcode_macro TOGGLE_NEVERMORE] +gcode: + {% if printer['fan_generic Nevermore'].speed > 0 %} + SET_FAN_SPEED FAN=Nevermore SPEED=0 + {% else %} + SET_FAN_SPEED FAN=Nevermore SPEED=1 + {% endif %} \ No newline at end of file diff --git a/printer_data/config/nitehawk36.cfg b/printer_data/config/nitehawk36.cfg new file mode 100644 index 0000000..495dd06 --- /dev/null +++ b/printer_data/config/nitehawk36.cfg @@ -0,0 +1,126 @@ +# This file contains pin mappings for the LDO Nitehawk-36 Toolboard +# To use this config, the firmware should be compiled for the Raspberry Pi RP2040 +# Make sure to include this config *at the end* of printer.cfg to overwrite the relevent sections + +# See https://docs.ldomotors.com/en/Toolboard/nitehawk-36#firmware-setup-and-update +# For instructions on uploading/updating klipper firmware to the PCB + +## LDO Nitehawk-SB Toolboard Partial Config + +## *** THINGS TO CHANGE/CHECK: *** +## MCU paths [mcu] section +## Thermistor types [extruder] sections + +## *MAKE SURE* to include this partial config file *AFTER* the main controller config. +## This will ensure the relavent sections are overwritten by the pin mappings specified here. + +[mcu nhk] +## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/usb-Klipper_rp2040_4E363334320D3925-if00 +restart_method: command +##-------------------------------------------------------------------- + +##################################################################### +# Endstops +##################################################################### +## XES - Toolhead PCB +[stepper_x] +endstop_pin: nhk:gpio13 + + +##################################################################### +# Filament Sensor +##################################################################### +#[filament_switch_sensor filament_sensor] +#switch_pin: nhk:gpio3 +#pause_on_runout: True + +##################################################################### +# Extruder +##################################################################### +[extruder] +step_pin: nhk:gpio23 +dir_pin: nhk:gpio24 +enable_pin: !nhk:gpio25 +heater_pin: nhk:gpio9 +sensor_pin: nhk:gpio29 +pullup_resistor: 2200 + +[tmc2209 extruder] +sense_resistor: 0.100 +uart_pin: nhk:gpio0 +tx_pin: nhk:gpio1 +interpolate: false +#run_current: #recommend setting it below 0.7A. + +##################################################################### +# Fans +##################################################################### +## PCF +[fan] +pin: nhk:gpio6 + + +## HEF +[heater_fan hotend_fan] +pin: nhk:gpio5 +tachometer_pin: nhk:gpio16 +tachometer_ppr: 2 + +##################################################################### +# Probe +##################################################################### +## Probe Port +[probe] +pin: nhk:gpio10 + +##################################################################### +# Lights +##################################################################### +##Stealthburner Headlights +[neopixel sb_leds] +pin: nhk:gpio7 +chain_count: 3 +color_order: GRBW +initial_RED: 0.0 +initial_GREEN: 0.0 +initial_BLUE: 1.0 +initial_WHITE: 0.0 + +## PCB Activity Light +[output_pin act_led] +pin: !nhk:gpio8 + +##################################################################### +# Accelerometer +##################################################################### +[adxl345] +cs_pin: nhk:gpio27 +spi_software_sclk_pin: nhk:gpio18 +spi_software_mosi_pin: nhk:gpio20 +spi_software_miso_pin: nhk:gpio19 + +[resonance_tester] +accel_chip: adxl345 +##-------------------------------------------------------------------- +## Uncomment below for 250mm build +#probe_points: +# 125, 125, 20 + +## Uncomment below for 300mm build +#probe_points: +# 155, 155, 20 + +## Uncomment below for 350mm build +#probe_points: +# 175, 175, 20 + +##################################################################### +# Addtional Sensors +##################################################################### +[temperature_sensor NH36] +sensor_type: temperature_mcu +sensor_mcu: nhk +min_temp: 0 +max_temp: 100 \ No newline at end of file diff --git a/printer_data/config/octoeverywhere.conf b/printer_data/config/octoeverywhere.conf new file mode 100644 index 0000000..343ea08 --- /dev/null +++ b/printer_data/config/octoeverywhere.conf @@ -0,0 +1,36 @@ +[logging] +# The active logging level. Valid values include: DEBUG, INFO, WARNING, or ERROR. +log_level = INFO +max_file_size_mb = 5 +max_file_count = 3 + +[server] + +[relay] +# The port used for http relay. If your desired frontend runs on a different port, change this value. The OctoEverywhere plugin service needs to be restarted before changes will take effect. +frontend_port = 80 + +[webcam] +# This is the webcam name OctoEverywhere will use for Gadget AI, notifications, and such. This much match the camera 'Name' from your Mainsail of Fluidd webcam settings. The default value of 'Default' will pick whatever camera the system can find. +webcam_name_to_use_as_primary = Default +# Enables or disables auto webcam setting detection. If enabled, OctoEverywhere will find the webcam settings configured via the frontend (Fluidd, Mainsail, etc) and use them. Disable to manually set the values and have them not be overwritten. +auto_settings_detection = True +# Webcam streaming URL. This can be a local relative path (ex: /webcam/?action=stream) or absolute http URL (ex: http://10.0.0.1:8080/webcam/?action=stream or http://webcam.local/webcam/?action=stream) +stream_url = /webcam/?action=stream +# Webcam snapshot URL. This can be a local relative path (ex: /webcam/?action=snapshot) or absolute http URL (ex: http://10.0.0.1:8080/webcam/?action=snapshot or http://webcam.local/webcam/?action=snapshot) +snapshot_url = /webcam/?action=snapshot +# Flips the webcam image horizontally. Valid values are True or False +flip_horizontally = False +# Flips the webcam image vertically. Valid values are True or False +flip_vertically = True +# Rotates the webcam image. Valid values are 0, 90, 180, or 270 +rotate = 0 + +[general] +# The temperature in Celsius that the bed must be under to be considered cooled down. This is used to fire the Bed Cooldown Complete notification. +bed_cooldown_threshold_temp_celsius = 40.0 + +[moonraker] +# Leave blank unless your Moonraker requires an API key to connect. Moonraker API keys can be generated from the Mainsail or Fluidd. +moonraker_api_key = + diff --git a/printer_data/config/print_handling.cfg b/printer_data/config/print_handling.cfg new file mode 100644 index 0000000..ad92e88 --- /dev/null +++ b/printer_data/config/print_handling.cfg @@ -0,0 +1,128 @@ +##################################################################### +# print_start macro +##################################################################### + +[include klicky-probe.cfg] + +## *** THINGS TO UNCOMMENT: *** +## Bed mesh (2 lines at 2 locations) +## Z_TILT_ADJUST if your printer is a Trident +## Quad gantry level if your printer is a V2 +## Nevermore - if you have one + +[gcode_macro PRINT_START] +gcode: + # This part fetches data from your slicer. Such as bed temp, extruder temp, chamber temp and size of your printer. + {% set target_bed = params.BED|int %} + {% set target_extruder = params.EXTRUDER|int %} + +##Uncomment bellow when you install chamber thermistor ---------------------------------------------------------------------------------------------------------------------- + {% set target_chamber = params.CHAMBER|default("40")|int %} + + {% set x_wait = printer.toolhead.axis_maximum.x|float / 2 %} + {% set y_wait = printer.toolhead.axis_maximum.y|float / 2 %} + + # Homes the printer, sets absolute positioning and updates the Stealthburner leds. + STATUS_HOMING # Sets SB-leds to homing-mode + G28 # Full home (XYZ) + G90 # Absolut position + + ## Uncomment for bed mesh (1 of 2) + #BED_MESH_CLEAR # Clears old saved bed mesh (if any) + + # Checks if the bed temp is higher than 90c - if so then trigger a heatsoak. + {% if params.BED|int > 90 %} + SET_DISPLAY_TEXT MSG="Bed: {target_bed}c" # Displays info + STATUS_HEATING # Sets SB-leds to heating-mode + M106 S255 # Turns on the PT-fan + + # Uncomment if you have a Nevermore. + SET_FAN_SPEED FAN=Nevermore SPEED=1 # Turns on the nevermore + + G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed + M190 S{target_bed} # Sets the target temp for the bed + SET_DISPLAY_TEXT MSG="Heatsoak: {target_chamber}c" # Displays info + +##Uncomment Bellow when chaimber thermistor is installed---------------------------------------------------------------------------------------------------------- +#TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={target_chamber} # Waits for chamber to reach desired temp + + # If the bed temp is not over 90c, then it skips the heatsoak and just heats up to set temp with a 5min soak + {% else %} + SET_DISPLAY_TEXT MSG="Bed: {target_bed}c" # Displays info + STATUS_HEATING # Sets SB-leds to heating-mode + G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed + M190 S{target_bed} # Sets the target temp for the bed + SET_DISPLAY_TEXT MSG="Soak for 5min" # Displays info + G4 P300000 # Waits 5 min for the bedtemp to stabilize + {% endif %} + + # Heating nozzle to 150 degrees. This helps with getting a correct Z-home + SET_DISPLAY_TEXT MSG="Hotend: 150c" # Displays info + #M109 S150 # Heats the nozzle to 150c + CLEAN_NOZZLE + SET_DISPLAY_TEXT MSG="Clean Boi" + + # Uncomment for Trident (Z_TILT_ADJUST) + SET_DISPLAY_TEXT MSG="Z-tilt adjust" # Displays info + STATUS_LEVELING # Sets SB-leds to leveling-mode + Z_TILT_ADJUST # Levels the buildplate via z_tilt_adjust + G28 Z # Homes Z again after z_tilt_adjust + + ## Uncomment for V2 (Quad gantry level AKA QGL) + #SET_DISPLAY_TEXT MSG="QGL" # Displays info + #STATUS_LEVELING # Sets SB-leds to leveling-mode + #quad_gantry_level # Levels the buildplate via QGL + #G28 Z # Homes Z again after QGL + + ## Uncomment for Klicky auto-z + #CALIBRATE_Z # Calibrates Z-offset with klicky + #SET_DISPLAY_TEXT MSG="Z-offset" # Displays info + + # Uncomment for bed mesh (2 of 2) + SET_DISPLAY_TEXT MSG="Bed mesh" # Displays info + STATUS_MESHING # Sets SB-leds to bed mesh-mode + bed_mesh_calibrate # Starts bed mesh + + # Heats up the nozzle up to target via data from slicer + SET_DISPLAY_TEXT MSG="Hotend: {target_extruder}c" # Displays info + STATUS_HEATING # Sets SB-leds to heating-mode + G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed + M107 # Turns off partcooling fan + M109 S{target_extruder} # Heats the nozzle to printing temp + + + # Gets ready to print by doing a purge line and updating the SB-leds + SET_DISPLAY_TEXT MSG="Printer goes brr" # Displays info + STATUS_PRINTING # Sets SB-leds to printing-mode + LINE_PURGE + #G0 X{x_wait - 50} Y4 F10000 # Moves to starting point + #G0 Z0.4 # Raises Z to 0.4 + #G91 # Incremental positioning + #G1 X100 E20 F1000 # Purge line + #G90 # Absolut position + +[gcode_macro PRINT_END] +# Use PRINT_END for the slicer ending script - please customise for your slicer of choice +gcode: + # safe anti-stringing move coords + {% set th = printer.toolhead %} + {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %} + {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %} + {% set z_safe = [th.position.z + 2, th.axis_maximum.z]|min %} + + SAVE_GCODE_STATE NAME=STATE_PRINT_END + + M400 ; wait for buffer to clear + G92 E0 ; zero the extruder + G1 E-2.0 F3600 ; retract filament + + TURN_OFF_HEATERS + + G90 ; absolute positioning + G0 X{x_safe} Y{y_safe} Z{z_safe} F20000 ; move nozzle to remove stringing + G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y - 2} F3600 ; park nozzle at rear + M107 ; turn off fan + + SET_FAN_SPEED FAN=Nevermore SPEED=0 + BED_MESH_CLEAR + RESTORE_GCODE_STATE NAME=STATE_PRINT_END \ No newline at end of file diff --git a/printer_data/config/printer.cfg b/printer_data/config/printer.cfg new file mode 100644 index 0000000..12d80a4 --- /dev/null +++ b/printer_data/config/printer.cfg @@ -0,0 +1,674 @@ +[include shell_command.cfg] +# This file contains common pin mappings for the BigTreeTech Octopus V1. +# To use this config, the firmware should be compiled for the STM32F446 with a "32KiB bootloader" +# Enable "extra low-level configuration options" and select the "12MHz crystal" as clock reference + +# after running "make", copy the generated "klipper/out/klipper.bin" file to a +# file named "firmware.bin" on an SD card and then restart the OctoPus with that SD card. + +# See docs/Config_Reference.md for a description of parameters. + +## Voron Design Trident 250/300/350mm BigTreeTech OctoPus V1 TMC2209 UART config + +## *** THINGS TO CHANGE/CHECK: *** +## MCU paths [mcu] section +## Thermistor types [extruder] and [heater_bed] sections - See https://www.klipper3d.org/Config_Reference.html#common-thermistors for common thermistor types +## Leadscrew Rotation Distance [stepper_z], [stepper_z1], [stepper_z2] +## Z Endstop Switch location [safe_z_home] section +## Z Endstop Switch offset for Z0 [stepper_z] section +## PID tune [extruder] and [heater_bed] sections +## e pin [probe] section +## Fine tune E steps [extruder] section + +#this is a test :D 2 + +[mcu] +## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_41004C000A51313133353932-if00 +restart_method: command +##-------------------------------------------------------------------- + +[mcu nhk] +## Obtain definition by "ls -l /dev/serial/by-id/" then unplug to verify +##-------------------------------------------------------------------- +serial: /dev/serial/by-id/usb-Klipper_rp2040_4E363334320D3925-if00 +restart_method: command +##-------------------------------------------------------------------- + +[include mainsail.cfg] +[include stealthburner_leds.cfg] +[include case_lights.cfg] +[include print_handling.cfg] +[include nevermore.cfg] +[include Bed_Mesh.cfg] +[include KAMP_Settings.cfg] +[include ./KAMP/Adaptive_Meshing.cfg] # Include to enable adaptive meshing configuration. +[include ./KAMP/Line_Purge.cfg] # Include to enable adaptive line purging configuration. +[include ./KAMP/Smart_Park.cfg] # Include to enable the Smart Park function, which parks the printhead near the print area for final heating. +[include custom_macros.cfg] +[include purge.cfg] +[include IS_shaper_calibrate.cfg] +[include timelapse.cfg] +[include shell_command.cfg] + +[include klicky-probe.cfg] + +[exclude_object] +[gcode_arcs] +resolution: 0.1 + +[printer] +kinematics: corexy +max_velocity: 300 +max_accel: 6000 #Max 4000 +max_z_velocity: 15 #Max 15 for 12V TMC Drivers, can increase for 24V +max_z_accel: 350 +square_corner_velocity: 5.0 + +##################################################################### +# X/Y Stepper Settings +##################################################################### + +## B Stepper - Left +## Connected to MOTOR_0 +## Endstop connected to DIAG_0 +[stepper_x] +step_pin: PF13 +dir_pin: PF12 +enable_pin: !PF14 +rotation_distance: 40 +microsteps: 32 +full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper +endstop_pin: nhk:gpio13 +position_min: 0 +##-------------------------------------------------------------------- + +## Uncomment below for 250mm build +#position_endstop: 250 +#position_max: 250 + +## Uncomment for 300mm build +#position_endstop: 300 +#position_max: 300 + +## Uncomment for 350mm build +position_endstop: 350 +position_max: 350 + +##-------------------------------------------------------------------- +homing_speed: 25 #Max 100 +homing_retract_dist: 5 +homing_positive_dir: true + +## Make sure to update below for your relevant driver (2208 or 2209) +[tmc2209 stepper_x] +uart_pin: PC4 +interpolate: False +run_current: 0.8 +sense_resistor: 0.110 +stealthchop_threshold: 0 + +## A Stepper - Right +## Connected to MOTOR_1 +## Endstop connected to DIAG_1 +[stepper_y] +step_pin: PG0 +dir_pin: PG1 +enable_pin: !PF15 +rotation_distance: 40 +microsteps: 32 +full_steps_per_rotation:200 #set to 400 for 0.9 degree stepper +endstop_pin: PG6 +position_min: 0 +##-------------------------------------------------------------------- + +## Uncomment for 250mm build +#position_endstop: 250 +#position_max: 250 + +## Uncomment for 300mm build +#position_endstop: 300 +#position_max: 300 + +## Uncomment for 350mm build +position_endstop: 350 +position_max: 350 + +##-------------------------------------------------------------------- +homing_speed: 25 #Max 100 +homing_retract_dist: 5 +homing_positive_dir: true + +## Make sure to update below for your relevant driver (2208 or 2209) +[tmc2209 stepper_y] +uart_pin: PD11 +interpolate: False +run_current: 0.8 +sense_resistor: 0.110 +stealthchop_threshold: 0 + +##################################################################### +# Z Stepper Settings +##################################################################### + +## Z0 Stepper - Front Left +## Connected to MOTOR_2 +## Endstop connected to DIAG_2 +[stepper_z] +step_pin: PF11 +dir_pin: PG3 +enable_pin: !PG5 +# Rotation Distance for TR8x8 = 8, TR8x4 = 4, TR8x2 = 2 +rotation_distance: 4 +microsteps: 32 +endstop_pin: probe:z_virtual_endstop +## Z-position of nozzle (in mm) to z-endstop trigger point relative to print surface (Z0) +## (+) value = endstop above Z0, (-) value = endstop below +## Increasing position_endstop brings nozzle closer to the bed +## After you run Z_ENDSTOP_CALIBRATE, position_endstop will be stored at the very end of your config +#position_endstop: -0.5 +## All builds use same Max Z +position_max: 250 +position_min: -8 +homing_speed: 8.0 # Leadscrews are slower than 2.4, 10 is a recommended max. +second_homing_speed: 3 +homing_retract_dist: 3 + +## Make sure to update below for your relevant driver (2208 or 2209) +[tmc2209 stepper_z] +uart_pin: PC6 +interpolate: False +run_current: 0.6 +sense_resistor: 0.110 +stealthchop_threshold: 0 + +## Z1 Stepper - Rear Center +## Connected to MOTOR_3 +[stepper_z1] +step_pin: PG4 +dir_pin: PC1 +enable_pin: !PA0 +# Rotation Distance for TR8x8 = 8, TR8x4 = 4, TR8x2 = 2 +rotation_distance: 4 +microsteps: 32 + +## Make sure to update below for your relevant driver (2208 or 2209) +[tmc2209 stepper_z1] +uart_pin: PC7 +interpolate: False +run_current: 0.6 +sense_resistor: 0.110 +stealthchop_threshold: 0 + +## Z2 Stepper - Front Right +## Connected to MOTOR_4 +[stepper_z2] +step_pin: PF9 +dir_pin: PF10 +enable_pin: !PG2 +# Rotation Distance for TR8x8 = 8, TR8x4 = 4, TR8x2 = 2 +rotation_distance: 4 +microsteps: 32 + +## Make sure to update below for your relevant driver (2208 or 2209) +[tmc2209 stepper_z2] +uart_pin: PF2 +interpolate: False +run_current: 0.6 +sense_resistor: 0.110 +stealthchop_threshold: 0 + + +##################################################################### +# Extruder +##################################################################### + +# Connected to MOTOR_6 +# Heater - HE0 +# Thermistor - T0 +[extruder] +step_pin: nhk:gpio23 +dir_pin: !nhk:gpio24 +enable_pin: !nhk:gpio25 +## Update value below when you perform extruder calibration +## If you ask for 100mm of filament, but in reality it is 98mm: +## rotation_distance = * / 100 +## 22.6789511 is a good starting point +rotation_distance: 23.2556 #22.6789511 #Bondtech 5mm Drive Gears old: 13.056242 +max_extrude_only_distance: 101 +## Update Gear Ratio depending on your Extruder Type +## Use 50:10 for Stealthburner/Clockwork 2 +## Use 50:17 for Afterburner/Clockwork (BMG Gear Ratio) +## Use 80:20 for M4, M3.1 +gear_ratio: 50:10 #BMG Gear Ratio +microsteps: 32 +full_steps_per_rotation: 200 #200 for 1.8 degree, 400 for 0.9 degree +nozzle_diameter: 0.400 +filament_diameter: 1.75 +heater_pin: nhk:gpio9 +## Check what thermistor type you have. See https://www.klipper3d.org/Config_Reference.html#common-thermistors for common thermistor types. +## Use "Generic 3950" for NTC 100k 3950 thermistors +sensor_type: ATC Semitec 104NT-4-R025H42G +sensor_pin: nhk:gpio29 +pullup_resistor: 2200 +min_temp: 10 +max_temp: 280 +max_power: 1.0 +min_extrude_temp: 10 # change back to 170 +max_extrude_cross_section: 5 +#control = pid +#pid_kp = 26.213 +#pid_ki = 1.304 +#pid_kd = 131.721 +# Try to keep pressure_advance below 1.0 +pressure_advance: 0.0355 +# Default is 0.040, leave stock +pressure_advance_smooth_time: 0.040 + +## E0 on MOTOR6 +## Make sure to update below for your relevant driver (2208 or 2209) +[tmc2209 extruder] +uart_pin: nhk:gpio0 +#tx_pin: nhk:gpio1 +interpolate: false +run_current: 0.5 +sense_resistor: 0.110 #previously 0.110 +stealthchop_threshold: 0 + + +##################################################################### +# Bed Heater +##################################################################### + +[heater_bed] +## SSR Pin - HE1 +## Thermistor - TB +heater_pin: PA3 +## Check what thermistor type you have. See https://www.klipper3d.org/Config_Reference.html#common-thermistors for common thermistor types. +## Use "Generic 3950" for Keenovo heaters +sensor_type: Generic 3950 +sensor_pin: PF3 +## Adjust Max Power so your heater doesn't warp your bed. Rule of thumb is 0.4 watts / cm^2 . +max_power: 0.9 +min_temp: 0 +max_temp: 130 +#control: pid +#pid_kp: 58.437 +#pid_ki: 2.347 +#pid_kd: 363.769 + +##################################################################### +# Probe +##################################################################### + +[probe] +## Inductive Probe +## This probe is not used for Z height, only Quad Gantry Leveling + +# Select the probe port by type: +## For the PROBE port. Will not work with Diode. May need pull-up resistor from signal to 24V. +#pin: ~!PB7 +## For the DIAG_7 port. NEEDS BAT85 DIODE! Change to !PG15 if probe is NO. +pin: nhk:gpio10 +## For Octopus Pro Probe port; NPN and PNP proximity switch types can be set by jumper +#pin: ~!PC5 + + +#------------------------------------------------------------------ This was all voron tap specific + +#activate_gcode: +# {% set PROBE_TEMP = 150 %} +# {% set MAX_TEMP = PROBE_TEMP + 5 %} +# {% set ACTUAL_TEMP = printer.extruder.temperature %} +# {% set TARGET_TEMP = printer.extruder.target %} + +# {% if TARGET_TEMP > PROBE_TEMP %} +# { action_respond_info('Extruder temperature target of %.1fC is too high, lowering to %.1fC' % (TARGET_TEMP, PROBE_TEMP)) } +# M109 S{ PROBE_TEMP } +# {% else %} +# # Temperature target is already low enough, but nozzle may still be too hot. +# {% if ACTUAL_TEMP > MAX_TEMP %} +# { action_respond_info('Extruder temperature %.1fC is still too high, waiting until below %.1fC' % (ACTUAL_TEMP, MAX_TEMP)) } +# TEMPERATURE_WAIT SENSOR=extruder MAXIMUM={ MAX_TEMP } +# {% endif %} +# {% endif %} + + +#-------------------------------------------------------------------- + +x_offset: 0 +y_offset: 0 +#z_offset: 0 +speed: 10.0 +samples: 3 +samples_result: median +sample_retract_dist: 3.0 +samples_tolerance: 0.05 +samples_tolerance_retries: 3 + +##################################################################### +# Fan Control +##################################################################### + +[fan] +## Print Cooling Fan - FAN0 +pin: PA8 # Output pin controlling the fan. This parameter must be provided. +max_power: 0.4 +# This should be set to 0.8 on most motherboards to give full range of control to your slicer. +# Anything above 80% duty cycle will be full power on this particular brushless driver. +# To fine-tune the max_power parameter for your particular motherboard, set max_power to 1.0, go into the Klipper dashboard, and increase fan speed 1% at a time until the actual fan speed stops increasing as you increase the fan speed. Divide the fan speed at this point by 100 and enter it into the max_power parameter. +# This parameter defines the maximum power (expressed as a value from 0.0 to 1.0) that the pin may be set to. +# The value 1.0 allows the pin to be set fully enabled for extended periods, while a value of 0.5 would allow the pin to be enabled for no more than half the time. +# This setting may be used to limit the total power output (over extended periods) to the fan. +# If this value is less than 1.0, then fan speed requests will be scaled between zero and max_power (for example, if max_power is 0.9 and a fan speed of 80% is requested, then the fan power will be set to 72%). +shutdown_speed: 0 +# The desired fan speed (expressed as a value from 0.0 to 1.0) if +# The microcontroller software enters an error state. +# The default is 0. +cycle_time: 0.010 #0.005 Example config value +# The amount of time (in seconds) for each PWM power cycle to the fan. +# It is recommended this be 10 milliseconds or greater when using software-based PWM. +# The default is 0.010 seconds. +hardware_pwm: False +# Enable this to use hardware PWM instead of software PWM. +# Most fans do not work well with hardware PWM, so it is not recommended to enable this unless there is an electrical requirement to switch at very high speeds. +# When using hardware PWM, the actual cycle time is constrained by the implementation and may be significantly different than the requested cycle_time. +# The default is False. +kick_start_time: 0.100 +# Time (in seconds) to run the fan at full speed when either first enabling or increasing it by more than 50% (helps get the fan spinning). +# The default is 0.100 seconds. +off_below: 0.1 +# The blower will not spin with the included brushless driver when the duty cycle is below 8%. When scaled with Max_power at 0.8, the off_below parameter should be set to 0.1. +# To calibrate this setting, gradually lower the fan speed to determine the lowest input speed that reliably drives the fan without stalls. +# Set off_below to the duty cycle corresponding to this value (for example, 8% -> 0.08/Max_power -> 0.08/0.8 -> 0.1) or slightly higher. +# This parameter is the minimum input speed that will power the fan (expressed as a value from 0.0 to 1.0). +# When a speed lower than off_below is requested, the fan will instead be turned off. +# This setting may be used to prevent fan stalls and to ensure effective kick starts. +# To calibrate this setting, start with off_below set to 0.0 and the fan spinning. +# Gradually lower the fan speed to determine the lowest input speed that reliably drives the fan without stalls. +# Set off_below to the duty cycle corresponding to this value (for example, 12% -> 0.12) or slightly higher. +#Tachometer_pin: +# Tachometer input pin for monitoring fan speed. A pullup is generally required. +# This parameter is optional. +#Tachometer_ppr: 1 +# When tachometer_pin is specified, this is the number of pulses per revolution of the tachometer signal. +#Tachometer_poll_interval: 0.0005 +# When tachometer_pin is specified, this is the polling period of the tachometer pin, in seconds. +# The default is 0.0015, which is fast enough for fans below 10,000 RPM at 2 PPR. +# This must be smaller than 30/(tachometer_ppr*rpm), with some margin, where rpm is the +# maximum speed (in RPM) of the fan. + +[heater_fan hotend_fan] +## Hotend Fan - FAN1 +pin: nhk:gpio5 +max_power: 1.0 +kick_start_time: 0.5 +heater: extruder +heater_temp: 50.0 +## If you are experiencing back flow, you can reduce fan_speed +#fan_speed: 1.0 + +[multi_pin my_enable_pin] +pins: PD15, PD14 + +[controller_fan controller_fan] +## Controller fan - FAN2 +pin: multi_pin:my_enable_pin +kick_start_time: 0.5 +heater: heater_bed +max_power: 0.5 +shutdown_speed: 0 + +[temperature_sensor chamber] +sensor_type: Generic 3950 +sensor_pin: PF5 +min_temp: 0 +max_temp: 100 +gcode_id: C + +[heater_fan exhaust_fan] +# Exhaust fan - FAN3 +pin: PD12 +max_power: 1.0 +shutdown_speed: 0.0 +kick_start_time: 5.0 +heater: heater_bed +heater_temp: 60 +off_below: 0.10 + +#[fan_generic test_fan] +## Exhaust fan - FAN3 +#pin: PD12 +#max_power: 1.0 +#shutdown_speed: 0.0 +#kick_start_time: 5.0 +#off_below: 0.10 + + +##################################################################### +# LED Control +##################################################################### + +#[output_pin caselight] +# Chamber Lighting - HE2 Connector (Optional) +#pin: PB10 +#pwm:true +#shutdown_value: 0 +#value:1 +#cycle_time: 0.01 + +##################################################################### +# Homing and Gantry Adjustment Routines +##################################################################### + +[idle_timeout] +timeout: 1800 + +#[safe_z_home] +### XY Location of the Z Endstop Switch +### Update -10,-10 to the XY coordinates of your endstop pin +### (such as 157,305) after going through Z Endstop Pin +### Location Definition step. +#home_xy_position: 175,175 +#speed:100 +#z_hop:10 + +[z_tilt] +## Use Z_TILT_ADJUST to level the bed . +## z_positions: Location of toolhead + +##-------------------------------------------------------------------- +## Uncomment below for 250mm build +#z_positions: +# -50, 18 +# 125, 298 +# 300, 18 +#points: +# 30, 5 +# 125, 195 +# 220, 5 + +## Uncomment below for 300mm build +#z_positions: +# -50, 18 +# 150, 348 +# 350, 18 +#points: +# 30, 5 +# 150, 245 +# 270, 5 + +## Uncomment below for 350mm build +z_positions: + -50, 18 + 175, 398 + 400, 18 +points: + 30, 5 + 175, 295 + 320, 5 + + +##-------------------------------------------------------------------- + +speed: 200 +horizontal_move_z: 10 +retries: 5 +retry_tolerance: 0.0075 + +######################################## +# EXP1 / EXP2 (display) pins +######################################## + +[board_pins] +aliases: + # EXP1 header + EXP1_1=PE8, EXP1_2=PE7, + EXP1_3=PE9, EXP1_4=PE10, + EXP1_5=PE12, EXP1_6=PE13, # Slot in the socket on this side + EXP1_7=PE14, EXP1_8=PE15, + EXP1_9=, EXP1_10=<5V>, + + # EXP2 header + EXP2_1=PA6, EXP2_2=PA5, + EXP2_3=PB1, EXP2_4=PA4, + EXP2_5=PB2, EXP2_6=PA7, # Slot in the socket on this side + EXP2_7=PC15, EXP2_8=, + EXP2_9=, EXP2_10=<5V> + +##################################################################### +# Displays +##################################################################### + +## Uncomment the display that you have +#-------------------------------------------------------------------- + +#[display] +## RepRapDiscount 128x64 Full Graphic Smart Controller +#lcd_type: st7920 +#cs_pin: EXP1_4 +#sclk_pin: EXP1_5 +#sid_pin: EXP1_3 +#menu_timeout: 40 +#encoder_pins: ^EXP2_5, ^EXP2_3 +#click_pin: ^!EXP1_2 + +#[output_pin beeper] +#pin: EXP1_1 + +#-------------------------------------------------------------------- + +[display] +# mini12864 LCD Display +lcd_type: uc1701 +cs_pin: EXP1_3 +a0_pin: EXP1_4 +rst_pin: EXP1_5 +encoder_pins: ^EXP2_5, ^EXP2_3 +click_pin: ^!EXP1_2 +contrast: 63 +spi_software_miso_pin: EXP2_1 +spi_software_mosi_pin: EXP2_6 +spi_software_sclk_pin: EXP2_2 + +#[neopixel btt_mini12864] +## To control Neopixel RGB in mini12864 display +#pin: EXP1_6 +#chain_count: 3 +#initial_RED: 0.1 +#initial_GREEN: 0.5 +#initial_BLUE: 0.0 +#color_order: RGB + +## Set RGB values on boot up for each Neopixel. +## Index 1 = display, Index 2 and 3 = Knob +#[delayed_gcode setdisplayneopixel] +#initial_duration: 1 +#gcode: +# SET_LED LED=btt_mini12864 RED=1 GREEN=1 BLUE=1 INDEX=1 TRANSMIT=0 +# SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=2 TRANSMIT=0 +# SET_LED LED=btt_mini12864 RED=1 GREEN=0 BLUE=0 INDEX=3 + +#-------------------------------------------------------------------- + +##################################################################### +# Accelerometer +##################################################################### +[adxl345] +cs_pin: nhk:gpio27 +spi_software_sclk_pin: nhk:gpio18 +spi_software_mosi_pin: nhk:gpio20 +spi_software_miso_pin: nhk:gpio19 + +[resonance_tester] +accel_chip: adxl345 +probe_points: + 175, 175, 20 # an example + +[input_shaper] +shaper_freq_x: 59.4 +shaper_type_x: mzv +shaper_freq_y: 41.6 +shaper_type_y: mzv + +[gcode_shell_command plot_graph] +command: bash /home/miguel/printer_data/config/scripts/plot_graphs.sh +timeout: 500.0 +verbose: True + +[firmware_retraction] +retract_length: 0.35 +# The length of filament (in mm) to retract when G10 is activated, +# and to unretract when G11 is activated (but see +# unretract_extra_length below). The default is 0 mm. +retract_speed: 25 +# The speed of retraction, in mm/s. The default is 20 mm/s. +unretract_extra_length: 0 +# The length (in mm) of *additional* filament to add when +# unretracting. +unretract_speed: 25 +# The speed of unretraction, in mm/s. The default is 10 mm/s. + +##################################################################### +# Macros +##################################################################### + +# in the print_handling.cfg + +#*# <---------------------- SAVE_CONFIG ----------------------> +#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. +#*# +#*# [heater_bed] +#*# control = pid +#*# pid_kp = 53.742 +#*# pid_ki = 2.437 +#*# pid_kd = 296.252 +#*# +#*# [probe] +#*# z_offset = 6.420 +#*# +#*# [extruder] +#*# control = pid +#*# pid_kp = 36.178 +#*# pid_ki = 4.231 +#*# pid_kd = 77.330 +#*# +#*# [bed_mesh default] +#*# version = 1 +#*# points = +#*# -0.060000, -0.048125, -0.089375, -0.036250, 0.028750 +#*# 0.026875, -0.020625, -0.086875, -0.027500, 0.046250 +#*# 0.041250, 0.006250, -0.073750, -0.011250, 0.113125 +#*# 0.008750, -0.004375, -0.015625, -0.038750, 0.081250 +#*# 0.030625, 0.009375, -0.070000, -0.054375, 0.061250 +#*# x_count = 5 +#*# y_count = 5 +#*# mesh_x_pps = 2 +#*# mesh_y_pps = 2 +#*# algo = lagrange +#*# tension = 0.2 +#*# min_x = 57.34 +#*# max_x = 292.58 +#*# min_y = 57.5 +#*# max_y = 292.46 diff --git a/printer_data/config/purge.cfg b/printer_data/config/purge.cfg new file mode 100644 index 0000000..3a16c77 --- /dev/null +++ b/printer_data/config/purge.cfg @@ -0,0 +1,28 @@ +[gcode_macro CLEAN_NOZZLE] +variable_start_x: 0 +variable_start_y: 115 +variable_start_z: 10 +variable_wipe_dist: -50 +variable_wipe_qty: 10 +variable_wipe_spd: 200 +variable_raise_distance: 20 + +gcode: + STATUS_CLEANING + {% if "xyz" not in printer.toolhead.homed_axes %} + G28 + {% endif %} + + G90 ; absolute positioning + ## Move nozzle to start position + G1 X{start_x} Y{start_y} F6000 + G1 Z{start_z} F1500 + + ## Wipe nozzle + {% for wipes in range(1, (wipe_qty + 1)) %} + G1 Y{start_y + wipe_dist} F{wipe_spd * 60} + G1 Y{start_y} F{wipe_spd * 60} + {% endfor %} + + ## Raise nozzle + G1 Z{raise_distance} \ No newline at end of file diff --git a/printer_data/config/scripts/graph_vibrations.py b/printer_data/config/scripts/graph_vibrations.py new file mode 100644 index 0000000..915d661 --- /dev/null +++ b/printer_data/config/scripts/graph_vibrations.py @@ -0,0 +1,255 @@ +#!/usr/bin/env python3 + +################################################## +###### SPEED AND VIBRATIONS PLOTTING SCRIPT ###### +################################################## +# Written by Frix_x#0161 # +# @version: 1.2 + +# CHANGELOG: +# v1.2: fixed a bug that could happen when username is not "pi" (thanks @spikeygg) +# v1.1: better graph formatting +# v1.0: first version of the script + + +# Be sure to make this script executable using SSH: type 'chmod +x ./graph_vibrations.py' when in the folder ! + +##################################################################### +################ !!! DO NOT EDIT BELOW THIS LINE !!! ################ +##################################################################### + +import optparse, matplotlib, re, sys, importlib, os, operator +from collections import OrderedDict +import numpy as np +import matplotlib.pyplot, matplotlib.dates, matplotlib.font_manager +import matplotlib.ticker + +matplotlib.use('Agg') + + +###################################################################### +# Computation +###################################################################### + +def calc_freq_response(data): + # Use Klipper standard input shaper objects to do the computation + helper = shaper_calibrate.ShaperCalibrate(printer=None) + return helper.process_accelerometer_data(data) + + +def calc_psd(datas, group, max_freq): + psd_list = [] + first_freqs = None + signal_axes = ['x', 'y', 'z', 'all'] + + for i in range(0, len(datas), group): + + # Round up to the nearest power of 2 for faster FFT + N = datas[i].shape[0] + T = datas[i][-1,0] - datas[i][0,0] + M = 1 << int((N/T) * 0.5 - 1).bit_length() + if N <= M: + # If there is not enough lines in the array to be able to round up to the + # nearest power of 2, we need to pad some zeros at the end of the array to + # avoid entering a blocking state from Klipper shaper_calibrate.py + datas[i] = np.pad(datas[i], [(0, (M-N)+1), (0, 0)], mode='constant', constant_values=0) + + freqrsp = calc_freq_response(datas[i]) + for n in range(group - 1): + data = datas[i + n + 1] + + # Round up to the nearest power of 2 for faster FFT + N = data.shape[0] + T = data[-1,0] - data[0,0] + M = 1 << int((N/T) * 0.5 - 1).bit_length() + if N <= M: + # If there is not enough lines in the array to be able to round up to the + # nearest power of 2, we need to pad some zeros at the end of the array to + # avoid entering a blocking state from Klipper shaper_calibrate.py + data = np.pad(data, [(0, (M-N)+1), (0, 0)], mode='constant', constant_values=0) + + freqrsp.add_data(calc_freq_response(data)) + + if not psd_list: + # First group, just put it in the result list + first_freqs = freqrsp.freq_bins + psd = freqrsp.psd_sum[first_freqs <= max_freq] + px = freqrsp.psd_x[first_freqs <= max_freq] + py = freqrsp.psd_y[first_freqs <= max_freq] + pz = freqrsp.psd_z[first_freqs <= max_freq] + psd_list.append([psd, px, py, pz]) + else: + # Not the first group, we need to interpolate every new signals + # to the first one to equalize the frequency_bins between them + signal_normalized = dict() + freqs = freqrsp.freq_bins + for axe in signal_axes: + signal = freqrsp.get_psd(axe) + signal_normalized[axe] = np.interp(first_freqs, freqs, signal) + + # Remove data above max_freq on all axes and add to the result list + psd = signal_normalized['all'][first_freqs <= max_freq] + px = signal_normalized['x'][first_freqs <= max_freq] + py = signal_normalized['y'][first_freqs <= max_freq] + pz = signal_normalized['z'][first_freqs <= max_freq] + psd_list.append([psd, px, py, pz]) + + return first_freqs[first_freqs <= max_freq], psd_list + + +def calc_powertot(psd_list, freqs): + pwrtot_sum = [] + pwrtot_x = [] + pwrtot_y = [] + pwrtot_z = [] + + for psd in psd_list: + pwrtot_sum.append(np.trapz(psd[0], freqs)) + pwrtot_x.append(np.trapz(psd[1], freqs)) + pwrtot_y.append(np.trapz(psd[2], freqs)) + pwrtot_z.append(np.trapz(psd[3], freqs)) + + return [pwrtot_sum, pwrtot_x, pwrtot_y, pwrtot_z] + + +###################################################################### +# Graphing +###################################################################### + +def plot_total_power(ax, speeds, power_total): + ax.set_title('Vibrations decomposition') + ax.set_xlabel('Speed (mm/s)') + ax.set_ylabel('Energy') + + ax.plot(speeds, power_total[0], label="X+Y+Z", alpha=0.6) + ax.plot(speeds, power_total[1], label="X", alpha=0.6) + ax.plot(speeds, power_total[2], label="Y", alpha=0.6) + ax.plot(speeds, power_total[3], label="Z", alpha=0.6) + + ax.xaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) + ax.yaxis.set_minor_locator(matplotlib.ticker.AutoMinorLocator()) + ax.grid(which='major', color='grey') + ax.grid(which='minor', color='lightgrey') + fontP = matplotlib.font_manager.FontProperties() + fontP.set_size('medium') + ax.legend(loc='best', prop=fontP) + + return + + +def plot_spectrogram(ax, speeds, freqs, power_spectral_densities, max_freq): + spectrum = np.empty([len(freqs), len(speeds)]) + + for i in range(len(speeds)): + for j in range(len(freqs)): + spectrum[j, i] = power_spectral_densities[i][0][j] + + ax.set_title("Summed vibrations spectrogram") + ax.pcolormesh(speeds, freqs, spectrum, norm=matplotlib.colors.LogNorm(), + cmap='inferno', shading='gouraud') + ax.set_ylim([0., max_freq]) + ax.set_ylabel('Frequency (hz)') + ax.set_xlabel('Speed (mm/s)') + + return + + +###################################################################### +# Startup and main routines +###################################################################### + +def parse_log(logname, opts): + with open(logname) as f: + for header in f: + if not header.startswith('#'): + break + if not header.startswith('freq,psd_x,psd_y,psd_z,psd_xyz'): + # Raw accelerometer data + return np.loadtxt(logname, comments='#', delimiter=',') + # Power spectral density data or shaper calibration data + opts.error("File %s does not contain raw accelerometer data and therefore " + "is not supported by graph_vibrations.py script. Please use " + "calibrate_shaper.py script to process it instead." % (logname,)) + + +def extract_speed(logname, opts): + try: + speed = re.search('sp(.+?)n', os.path.basename(logname)).group(1) + except AttributeError: + opts.error("File %s does not contain speed in its name and therefore " + "is not supported by graph_vibrations.py script." % (logname,)) + return int(speed) + + +def sort_and_slice(raw_speeds, raw_datas, remove): + # Sort to get the speeds and their datas aligned and in ascending order + raw_speeds, raw_datas = zip(*sorted(zip(raw_speeds, raw_datas), key=operator.itemgetter(0))) + + # Remove beginning and end of the datas for each file to get only + # constant speed data and remove the start/stop phase of the movements + datas = [] + for data in raw_datas: + sliced = round((len(data) * remove / 100) / 2) + datas.append(data[sliced:len(data)-sliced]) + + return raw_speeds, datas + + +def setup_klipper_import(kdir): + global shaper_calibrate + sys.path.append(os.path.join(kdir, 'klippy')) + shaper_calibrate = importlib.import_module('.shaper_calibrate', 'extras') + + +def main(): + # Parse command-line arguments + usage = "%prog [options] " + opts = optparse.OptionParser(usage) + opts.add_option("-o", "--output", type="string", dest="output", + default=None, help="filename of output graph") + opts.add_option("-a", "--axis", type="string", dest="axisname", + default=None, help="axis name to be shown on the side of the graph") + opts.add_option("-f", "--max_freq", type="float", default=1000., + help="maximum frequency to graph") + opts.add_option("-r", "--remove", type="int", default=0, + help="percentage of data removed at start/end of each files") + opts.add_option("-k", "--klipper_dir", type="string", dest="klipperdir", + default="/home/pi/klipper", help="main klipper directory") + options, args = opts.parse_args() + if len(args) < 1: + opts.error("No CSV file(s) to analyse") + if options.output is None: + opts.error("You must specify an output file.png to use the script (option -o)") + if options.remove > 50 or options.remove < 0: + opts.error("You must specify a correct percentage (option -r) in the 0-50 range") + + setup_klipper_import(options.klipperdir) + + # Parse the raw data and get them ready for analysis + raw_datas = [parse_log(filename, opts) for filename in args] + raw_speeds = [extract_speed(filename, opts) for filename in args] + speeds, datas = sort_and_slice(raw_speeds, raw_datas, options.remove) + + # As we assume that we have the same number of file for each speeds. We can group + # the PSD results by this number (to combine vibrations at given speed on all movements) + group_by = speeds.count(speeds[0]) + # Compute psd and total power of the signal + freqs, power_spectral_densities = calc_psd(datas, group_by, options.max_freq) + power_total = calc_powertot(power_spectral_densities, freqs) + + fig, axs = matplotlib.pyplot.subplots(2, 1, sharex=True) + fig.suptitle("Machine vibrations - " + options.axisname + " moves", fontsize=16) + + # Remove speeds duplicates and graph the processed datas + speeds = list(OrderedDict((x, True) for x in speeds).keys()) + plot_total_power(axs[0], speeds, power_total) + plot_spectrogram(axs[1], speeds, freqs, power_spectral_densities, options.max_freq) + + fig.set_size_inches(10, 10) + fig.tight_layout() + fig.subplots_adjust(top=0.92) + + fig.savefig(options.output) + +if __name__ == '__main__': + main() diff --git a/printer_data/config/scripts/plot_graphs.sh b/printer_data/config/scripts/plot_graphs.sh new file mode 100644 index 0000000..c1bb8c3 --- /dev/null +++ b/printer_data/config/scripts/plot_graphs.sh @@ -0,0 +1,220 @@ +#!/usr/bin/env bash +################################### +###### GRAPH PLOTTING SCRIPT ###### +################################### +# Written by Frix_x#0161 # +# @version: 1.6 + +# CHANGELOG: +# v1.6: - updated the handling of shaper graph files to be able to optionnaly account for added positions in the filenames and remove them +# - fixed a bug in the belt graph on slow SD card or Pi clones (Klipper was still writing in the file while we were already reading it) +# v1.5: fixed klipper unnexpected fail at the end of the execution, even if graphs were correctly generated (unicode decode error fixed) +# v1.4: added the ~/klipper dir parameter to the call of graph_vibrations.py for a better user handling (in case user is not "pi") +# v1.3: some documentation improvement regarding the line endings that needs to be LF for this file +# v1.2: added the movement name to be transfered to the Python script in vibration calibration (to print it on the result graphs) +# v1.1: multiple fixes and tweaks (mainly to avoid having empty files read by the python scripts after the mv command) +# v1.0: first version of the script based on a Zellneralex script + +# Installation: +# 1. Copy this file somewhere in your config folder and edit the parameters below if needed +# Note: If using Windows to do the copy/paste, be careful with the line endings for this file: LF (or \n) is mandatory !!! No \r should be +# present in the file as it could lead to some errors like "\r : unknown command" when running the script. If you're not confident +# regarding your text editor behavior, the best way is to directly download the file on the pi by using for example wget: +# type 'wget -P ~/printer_data/config/scripts https://raw.githubusercontent.com/Frix-x/klippain/main/scripts/plot_graphs.sh' +# 2. Make it executable using SSH: type 'chmod +x ~/printer_data/config/scripts/plot_graphs.sh' (adjust the path if needed). +# 3. Be sure to have the gcode_shell_command.py Klipper extension installed (easiest way to install it is to use KIAUH in the Advanced section) +# 4. Create a gcode_shell_command to be able to start it from a macro (see my shell_commands.cfg file) + +# Usage: +# This script was designed to be used with gcode_shell_commands. Use it to call it. +# Parameters availables: +# SHAPER - To generate input shaper diagrams after calling the Klipper TEST_RESONANCES AXIS=X/Y +# BELTS - To generate belts diagrams after calling the Klipper TEST_RESONANCES AXIS=1,(-)1 OUTPUT=raw_data +# VIBRATIONS - To generate vibration diagram after calling the custom (Frix_x#0161) VIBRATIONS_CALIBRATION macro + + +################################################################################################################# +RESULTS_FOLDER=/home/miguel/printer_data/config/shaper_results # Path to the folder where storing the results files +SCRIPTS_FOLDER=~/printer_data/config/scripts # Path to the folder where the graph_vibrations.py is located +KLIPPER_FOLDER=~/klipper # Path of the klipper main folder +STORE_RESULTS=3 # Number of results to keep (older files are automatically cleaned). 0 to keep them indefinitely +################################################################################################################# + + +##################################################################### +################ !!! DO NOT EDIT BELOW THIS LINE !!! ################ +##################################################################### + +export LC_ALL=C + +function is_fopen() { + filepath=$(realpath "$1") + for pid in $(ls /proc | grep -E '^[0-9]+$'); do + if [ -d "/proc/$pid/fd" ]; then + for fd in /proc/$pid/fd/*; do + if [ -L "$fd" ] && [ "$(readlink -f "$fd")" == "$filepath" ]; then + return 0 + fi + done + fi + done + return 1 +} + +function plot_shaper_graph { + local generator filename newfilename date axis + generator="${KLIPPER_FOLDER}/scripts/calibrate_shaper.py" + + # For each file + while read filename; do + # Wait for the file handler to be released by Klipper + while is_fopen "${filename}"; do + sleep 3 + done + + # We remove the /tmp in front of the filename + newfilename="$(echo ${filename} | sed -e "s/\\/tmp\///")" + + # We check if there is the position added by Klipper and remove it + if [[ ${newfilename} =~ ^resonances_[[:alpha:]]_([0-9]*\.)+[0-9]*_ ]]; then + newfilename="$(echo ${newfilename} | sed -E 's/(^resonances_[[:alpha:]])_(([0-9]*\.)+[0-9]*_)+/\1_/')" + fi + + # We extract the date and axis name from the filename + date="$(basename "${newfilename}" | cut -d '.' -f1 | awk -F'_' '{print $3"_"$4}')" + axis="$(basename "${newfilename}" | cut -d '_' -f2)" + + # Then we move the file to the result folder + mv "${filename}" "${isf}"/inputshaper/"${newfilename}" + sync && sleep 2 + + # Finally we compute the shaper graphs + "${generator}" "${isf}"/inputshaper/"${newfilename}" -o "${isf}"/inputshaper/resonances_"${axis}"_"${date}".png + done <<< "$(find /tmp -type f -name "resonances_*.csv" 2>&1 | grep -v "Permission")" +} + +function plot_belts_graph { + local date_ext generator filename belt + date_ext="$(date +%Y%m%d_%H%M%S)" + generator="${KLIPPER_FOLDER}/scripts/graph_accelerometer.py" + + # For each file + while read filename; do + # Wait for the file handler to be released by Klipper + while is_fopen "${filename}"; do + sleep 3 + done + + # We extract the belt tested from the filename + belt="$(basename "${filename}" | cut -d '_' -f4 | cut -d '.' -f1 | sed -e 's/\(.*\)/\U\1/')" + + # And we move it to the result folder while injecting the date and belt inside the filename + mv "${filename}" "${isf}"/belts/belt_"${date_ext}"_"${belt}".csv + done <<< "$(find /tmp -type f -name "raw_data_axis*.csv" 2>&1 | grep -v "Permission")" + sync && sleep 2 + + # Finally we compute the belts graph + "${generator}" -c "${isf}"/belts/belt_"${date_ext}"_*.csv -o "${isf}"/belts/belts_"${date_ext}".png +} + +function plot_vibr_graph { + local date_ext generator filename newfilename + date_ext="$(date +%Y%m%d_%H%M%S)" + generator="${SCRIPTS_FOLDER}/graph_vibrations.py" + + # For each file + while read filename; do + # Wait for the file handler to be released by Klipper + while is_fopen "${filename}"; do + sleep 3 + done + + # Cleanup of the filename and moving it in the result folder + newfilename="$(echo ${filename} | sed -e "s/\\/tmp\/adxl345/vibr_${date_ext}/")" + mv "${filename}" "${isf}"/vibrations/"${newfilename}" + done <<< "$(find /tmp -type f -name "adxl345-*.csv" 2>&1 | grep -v "Permission")" + sync && sleep 2 + + # We compute the vibration graphs using all the csv files + "${generator}" "${isf}"/vibrations/vibr_"${date_ext}"*.csv -o "${isf}"/vibrations/vibrations_"${date_ext}".png -a "$1" -k "${KLIPPER_FOLDER}" + + # Finally we cleanup the folder by moving the csv files in an archive + tar cfz "${isf}"/vibrations/vibrations_"${date_ext}".tar.gz "${isf}"/vibrations/vibr_"${date_ext}"*.csv + rm "${isf}"/vibrations/vibr_"${date_ext}"*.csv +} + +function clean_files { + local filename keep1 keep2 old csv date + keep1=$(( ${STORE_RESULTS} + 1 )) + keep2=$(( ${STORE_RESULTS} * 2 + 1)) + + while read filename; do + if [ ! -z "${filename}" ]; then + old+=("${filename}") + csv="$(basename "${filename}" | cut -d '.' -f1)" + old+=("${isf}"/inputshaper/"${csv}".csv) + fi + done <<< "$(find "${isf}"/inputshaper/ -type f -name '*.png' -printf '%T@ %p\n' | sort -k 1 -n -r | sed 's/^[^ ]* //' | tail -n +"${keep2}")" + + while read filename; do + if [ ! -z "${filename}" ]; then + old+=("${filename}") + date="$(basename "${filename}" | cut -d '.' -f1 | awk -F'_' '{print $2"_"$3}')" + old+=("${isf}"/belts/belt_"${date}"_A.csv) + old+=("${isf}"/belts/belt_"${date}"_B.csv) + fi + done <<< "$(find "${isf}"/belts/ -type f -name '*.png' -printf '%T@ %p\n' | sort -k 1 -n -r | sed 's/^[^ ]* //' | tail -n +"${keep1}")" + + while read filename; do + if [ ! -z "${filename}" ]; then + old+=("${filename}") + csv="$(basename "${filename}" | cut -d '.' -f1)" + old+=("${isf}"/vibrations/"${csv}".tar.gz) + fi + done <<< "$(find "${isf}"/vibrations/ -type f -name '*.png' -printf '%T@ %p\n' | sort -k 1 -n -r | sed 's/^[^ ]* //' | tail -n +"${keep1}")" + + if [ "${#old[@]}" -ne 0 -a "${STORE_RESULTS}" -ne 0 ]; then + for rmv in "${old[@]}"; do + rm "${rmv}" + done + fi +} + +############################# +### MAIN #################### +############################# + +if [ ! -d "${RESULTS_FOLDER}/inputshaper" ]; then + mkdir -p "${RESULTS_FOLDER}/inputshaper" +fi +if [ ! -d "${RESULTS_FOLDER}/belts" ]; then + mkdir -p "${RESULTS_FOLDER}/belts" +fi +if [ ! -d "${RESULTS_FOLDER}/vibrations" ]; then + mkdir -p "${RESULTS_FOLDER}/vibrations" +fi + +isf="${RESULTS_FOLDER//\~/${HOME}}" + +case ${1} in + SHAPER|shaper) + plot_shaper_graph + ;; + BELTS|belts) + plot_belts_graph + ;; + VIBRATIONS|vibrations) + plot_vibr_graph ${2} + ;; + *) + echo -e "\nUsage:" + echo -e "\t${0} SHAPER, BELTS or VIBRATIONS" + echo -e "\t\tSHAPER\tGenerate input shaper diagram" + echo -e "\t\tBELT\tGenerate belt tension diagram" + echo -e "\t\tVIBRATIONS axis-name\tGenerate vibration response diagram\n" + exit 1 +esac + +clean_files + +echo "Graphs created. You will find the results in ${isf}" diff --git a/printer_data/config/shaper_results/belts/belts_20230804_022159.png b/printer_data/config/shaper_results/belts/belts_20230804_022159.png new file mode 100644 index 0000000..638988d Binary files /dev/null and b/printer_data/config/shaper_results/belts/belts_20230804_022159.png differ diff --git a/printer_data/config/shaper_results/belts/belts_20230804_023440.png b/printer_data/config/shaper_results/belts/belts_20230804_023440.png new file mode 100644 index 0000000..6256e21 Binary files /dev/null and b/printer_data/config/shaper_results/belts/belts_20230804_023440.png differ diff --git a/printer_data/config/shaper_results/belts/belts_20230804_171549.png b/printer_data/config/shaper_results/belts/belts_20230804_171549.png new file mode 100644 index 0000000..0c1a396 Binary files /dev/null and b/printer_data/config/shaper_results/belts/belts_20230804_171549.png differ diff --git a/printer_data/config/shaper_results/inputshaper/resonances_x_20230804_024924.png b/printer_data/config/shaper_results/inputshaper/resonances_x_20230804_024924.png new file mode 100644 index 0000000..981c0a6 Binary files /dev/null and b/printer_data/config/shaper_results/inputshaper/resonances_x_20230804_024924.png differ diff --git a/printer_data/config/shaper_results/inputshaper/resonances_x_20230804_171806.png b/printer_data/config/shaper_results/inputshaper/resonances_x_20230804_171806.png new file mode 100644 index 0000000..41734d1 Binary files /dev/null and b/printer_data/config/shaper_results/inputshaper/resonances_x_20230804_171806.png differ diff --git a/printer_data/config/shaper_results/inputshaper/resonances_x_20250901_215128.png b/printer_data/config/shaper_results/inputshaper/resonances_x_20250901_215128.png new file mode 100644 index 0000000..29e9143 Binary files /dev/null and b/printer_data/config/shaper_results/inputshaper/resonances_x_20250901_215128.png differ diff --git a/printer_data/config/shaper_results/inputshaper/resonances_y_20230804_025137.png b/printer_data/config/shaper_results/inputshaper/resonances_y_20230804_025137.png new file mode 100644 index 0000000..00fac2b Binary files /dev/null and b/printer_data/config/shaper_results/inputshaper/resonances_y_20230804_025137.png differ diff --git a/printer_data/config/shaper_results/inputshaper/resonances_y_20230804_172019.png b/printer_data/config/shaper_results/inputshaper/resonances_y_20230804_172019.png new file mode 100644 index 0000000..f4d5bf6 Binary files /dev/null and b/printer_data/config/shaper_results/inputshaper/resonances_y_20230804_172019.png differ diff --git a/printer_data/config/shaper_results/inputshaper/resonances_y_20250901_215342.png b/printer_data/config/shaper_results/inputshaper/resonances_y_20250901_215342.png new file mode 100644 index 0000000..7f3f230 Binary files /dev/null and b/printer_data/config/shaper_results/inputshaper/resonances_y_20250901_215342.png differ diff --git a/printer_data/config/shell_command.cfg b/printer_data/config/shell_command.cfg new file mode 100644 index 0000000..e241aaf --- /dev/null +++ b/printer_data/config/shell_command.cfg @@ -0,0 +1,18 @@ +[gcode_macro update_git] +gcode: + {% set message = params.MESSAGE|default() %} + {% if message %} + RUN_SHELL_COMMAND CMD=update_git_script_message PARAMS="'{params.MESSAGE}'" + {% else %} + RUN_SHELL_COMMAND CMD=update_git_script + {% endif %} + +[gcode_shell_command update_git_script] +command: bash -c "bash $HOME/klipper-backup/script.sh" +timeout: 90.0 +verbose: True + +[gcode_shell_command update_git_script_message] +command: bash -c "bash $HOME/klipper-backup/script.sh -c \"$0\"" +timeout: 90.0 +verbose: True \ No newline at end of file diff --git a/printer_data/config/sonar.conf b/printer_data/config/sonar.conf new file mode 100644 index 0000000..0c71ab1 --- /dev/null +++ b/printer_data/config/sonar.conf @@ -0,0 +1,17 @@ +#### Sonar - A WiFi Keepalive daemon +#### +#### Written by Stephan Wendel aka KwadFan +#### Copyright 2022 +#### https://github.com/mainsail-crew/sonar +#### +#### This File is distributed under GPLv3 +#### + +[sonar] +enable: false # false to disable till next reboot (will stop again if not set to true) +debug_log: false # if set to true, sonar will log ever ping with triptime and date/time +persistant_log: false # If true logs in /var/log/sonar.log, false logs to systemd +target: auto # IP Address, URL or auto as ping target +count: 3 # How often should be pinged? +interval: 60 # Ping again after X seconds +restart_treshold: 10 # If failed, restart WiFi after X seconds diff --git a/printer_data/config/stealthburner_leds.cfg b/printer_data/config/stealthburner_leds.cfg new file mode 100644 index 0000000..28d423c --- /dev/null +++ b/printer_data/config/stealthburner_leds.cfg @@ -0,0 +1,342 @@ +# Macros for setting the status leds on the Voron StealthBurner toolhead (or for any neopixel-type leds). +# +# You will need to configure a neopixel (or other addressable led, such as dotstar). See +# https://www.klipper3d.org/Config_Reference.html#neopixel for configuration details. + + +##################################### +# INSTRUCTIONS # +##################################### +# How to use all this stuff: +# +# 1. Copy this .cfg file into your Klipper config directory and then add [include stealthburner_leds.cfg] +# to the top of your printer.cfg in order for register the LEDs and macros with Klipper. +# 2. Define your LEDs by editing [neopixel sb_leds] below and entering the data pin from your control board +# as well as the color order. +# +# Note: RGB and RGBW are different and must be defined explicitly. RGB and RGBW are also not able to +# be mix-and-matched in the same chain. A separate data line would be needed for proper functioning. +# +# RGBW LEDs will have a visible yellow-ish phosphor section to the chip. If your LEDs do not have +# this yellow portion, you have RGB LEDs. +# +# 3. Save your config and restart Klipper. +# +# Note: We set RED and BLUE to 1.0 to make it easier for users and supporters to detect +# misconfigurations or miswiring. The default color format is for Neopixels with a dedicated +# white LED. On startup, all three SB LEDs should light up. +# +# If you get random colors across your LEDs, change the color_order to GRB and restart. Then +# omit the W for each suggested color_order in the next paragraph. +# +# If you get MAGENTA, your color order is correct. If you get CYAN, you need to use RGBW. If +# you get YELLOW, you need to use BRGW (note that BRG is only supported in the latest Klipper +# version). +# +# 4. Once you have confirmed that the LEDs are set up correctly, you must now decide where you want +# these macros called up...which means adding them to your existing gcode macros. NOTHING will happen +# unless you add the STATUS_????? macros to your existing gcode macros. +# +# Example: add STATUS_LEVELING to the beginning of your QGL gcode macro, and then add STATUS_READY +# to the end of it to set the logo LED and nozzle LEDs back to the `ready` state. +# +# Example: add STATUS_CLEANING to the beginning of your nozzle-cleaning macro, and then STATUS_READY +# to the end of it to return the LEDs back to `ready` state. +# +# 5. Feel free to change colors of each macro, create new ones if you have a need to. The macros provided below +# are just an example of what is possible. If you want to try some more complex animations, you will most +# likely have to use WLED with Moonraker and a small micro-controller (please see the LED thread for help inside +# of the stealthburner_beta channel on Discord). +# +##################################### +# END INSTRUCTRUCTIONS # +##################################### + +[neopixel sb_leds] +pin: nhk:gpio7 +# The pin connected to the neopixel. This parameter must be provided. +chain_count: 10 +# The number of Neopixel chips that are "daisy chained" to the +# provided pin. The default is 1 (which indicates only a single +# Neopixel is connected to the pin). +color_order: GRB, GRB, GRB, GRB, GRB, GRB, GRB, GRB, GRBW, GRBW +# Set the pixel order required by the LED hardware. Options are GRB, +# RGB, GRBW, or RGBW. The default is GRB. +initial_RED: 1.0 +initial_GREEN: 0.0 +initial_BLUE: 1.0 +initial_WHITE: 0.0 +# Sets the initial LED color of the Neopixel. Each value should be +# between 0.0 and 1.0. The WHITE option is only available on RGBW +# LEDs. The default for each color is 0.# + + +########################## +# LED Effects Animations # +########################## + +################## +## logo effects ## +################## + +[led_effect sb_logo_busy] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + breathing 3 1 top (1,0,0) + +[led_effect sb_logo_cleaning] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + breathing 3 1 top (0.0, 0.02, 0.5) + +[led_effect sb_logo_calibrating_z] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + breathing 3 1 top (0.0, 0.0, 0.35) + +[led_effect sb_logo_heating] +leds: + neopixel:sb_leds (1,3,7,8,6,2) +autostart: false +frame_rate: 24 +layers: + comet 0.3 0 add (1, 0.18, 0) + +[led_effect sb_logo_cooling] +leds: + neopixel:sb_leds (1,3,7,8,6,2) +autostart: false +frame_rate: 24 +layers: + comet 0.3 0 add (0, 0, 1) + +[led_effect sb_logo_homing] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + breathing 3 1 top (0.0, 0.6, 0.2) + +[led_effect sb_logo_leveling] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + breathing 3 1 top (0.5, 0.1, 0.4) + +[led_effect sb_logo_meshing] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + breathing 3 1 top (0.2, 1.0, 0.0) + +[led_effect sb_logo_printing] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + gradient 0.3 1 add (0.3, 0.0, 0.0),(0.3, 0.3, 0.0),(0.3, 0.1, 0.0) + +[led_effect sb_logo_standby] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + breathing 3 1 top (0.01, 0.01, 0.01) + +[led_effect sb_logo_part_ready] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (1-8) +layers: + breathing 3 1 top (0.0, 1.0, 0.0) + +#################### +## nozzle effects ## +#################### + +[led_effect sb_nozzle_heating] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (9,10) +layers: + breathing 3 1 top (1.0, 0.18, 0.0, 0.0) + +[led_effect sb_nozzle_cooling] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (9,10) +layers: + breathing 3 1 top (0.0, 0.0, 1.0, 0.1) + +[led_effect sb_nozzle_standby] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (9,10) +layers: + breathing 3 1 top (0.6, 0.0, 0.0, 0.0) + +[led_effect sb_nozzle_part_ready] +autostart: false +frame_rate: 24 +leds: + neopixel:sb_leds (9,10) +layers: + breathing 3 1 top (0.6, 1.0, 0.0, 0.1) + + +##################### +## all led effects ## +##################### + +[led_effect sb_critical_error] +leds: + neopixel:sb_leds +layers: + strobe 1 1.5 add (1.0, 1.0, 1.0) + breathing 2 0 difference (0.95, 0.0, 0.0) + static 1 0 top (1.0, 0.0, 0.0) +autostart: false +frame_rate: 24 +run_on_error: true + + +[led_effect rainbow] +leds: + neopixel:sb_leds +autostart: true +frame_rate: 24 +layers: + gradient 0.3 1 add (0.3, 0.0, 0.0),(0.0, 0.3, 0.0),(0.0, 0.0, 0.3) + + +####################### +# LED Effects Statics # +####################### + +[led_effect set_nozzle_leds] +leds: + neopixel:sb_leds (9,10) + #neopixel:caselight +autostart: false +frame_rate: 24 +layers: + static 0 0 top (0.0, 0.0, 0.0, 1.0) + +[led_effect set_logo_leds] +leds: + neopixel:sb_leds (1,2,3,4,5,6,7,8) + #neopixel:caselight +autostart: false +frame_rate: 24 +layers: + static 0 0 top (1.0, 1.0, 1.0) + +############## +# The Macros # +############## + +[gcode_macro set_logo_leds_off] +gcode: + SET_LED_EFFECT EFFECT=set_logo_leds STOP=1 + +[gcode_macro set_logo_leds_on] +gcode: + SET_LED_EFFECT EFFECT=set_logo_leds + +[gcode_macro set_nozzle_leds_on] +gcode: + SET_LED_EFFECT EFFECT=set_nozzle_leds + +[gcode_macro set_nozzle_leds_off] +gcode: + SET_LED_EFFECT EFFECT=set_nozzle_leds STOP=1 + +[gcode_macro status_off] +gcode: + STOP_LED_EFFECTS + +[gcode_macro status_ready] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=rainbow + +[gcode_macro status_part_ready] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_nozzle_part_ready + SET_LED_EFFECT EFFECT=sb_logo_part_ready + +[gcode_macro status_busy] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_busy + set_nozzle_leds_on + +[gcode_macro status_heating] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_heating + SET_LED_EFFECT EFFECT=sb_nozzle_heating + +[gcode_macro status_cooling] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_cooling + SET_LED_EFFECT EFFECT=sb_nozzle_cooling + + +[gcode_macro status_leveling] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_leveling + set_nozzle_leds_on + +[gcode_macro status_homing] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_homing + set_nozzle_leds_on + +[gcode_macro status_cleaning] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_cleaning + set_nozzle_leds_on + +[gcode_macro status_meshing] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_meshing + set_nozzle_leds_on + +[gcode_macro status_calibrating_z] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_calibrating_z + set_nozzle_leds_on + +[gcode_macro status_printing] +gcode: + STOP_LED_EFFECTS + SET_LED_EFFECT EFFECT=sb_logo_printing + set_nozzle_leds_on \ No newline at end of file