diff --git a/.moonraker.conf.bkp b/.moonraker.conf.bkp index 6413a3c..806b21d 100644 --- a/.moonraker.conf.bkp +++ b/.moonraker.conf.bkp @@ -66,3 +66,11 @@ managed_services = subscriptions = octoapp. +[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 + diff --git a/KAMP b/KAMP new file mode 120000 index 0000000..a213608 --- /dev/null +++ b/KAMP @@ -0,0 +1 @@ +/home/nixolas/Klipper-Adaptive-Meshing-Purging/Configuration \ No newline at end of file diff --git a/KAMP_Settings.cfg b/KAMP_Settings.cfg new file mode 100644 index 0000000..55435d5 --- /dev/null +++ b/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/macros.cfg b/macros.cfg new file mode 100644 index 0000000..4fdd08d --- /dev/null +++ b/macros.cfg @@ -0,0 +1,185 @@ +# This file provides examples of Klipper G-Code macros. The snippets +# in this file may be copied into the main printer.cfg file and +# customized. + +# See docs/Config_Reference.md for a description of parameters. + + +###################################################################### +# Start Print and End Print +###################################################################### + +# Replace the slicer's custom start and end g-code scripts with +# START_PRINT and END_PRINT. See docs/Slicers.md for more information on using these macros. + +[gcode_macro START_PRINT] +gcode: + {% set BED_TEMP = params.BED_TEMP|default(60)|float %} + {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(190)|float %} + # Start bed heating + M140 S{BED_TEMP} + # Use absolute coordinates + G90 + # Reset the G-Code Z offset (adjust Z offset if needed) + SET_GCODE_OFFSET Z=0.0 + # Home the printer + G28 + # Move the nozzle near the bed + G1 Z5 F3000 + # Move the nozzle very close to the bed + G1 Z0.15 F300 + # Wait for bed to reach temperature + M190 S{BED_TEMP} + # Set and wait for nozzle to reach temperature + M109 S{EXTRUDER_TEMP} + +[gcode_macro END_PRINT] +gcode: + # Turn off bed, extruder, and fan + M140 S0 + M104 S0 + M106 S0 + # Move nozzle away from print while retracting + G91 + G1 X-2 Y-2 E-3 F300 + # Raise nozzle by 10mm + G1 Z10 F3000 + G90 + # Disable steppers + M84 + + + +###################################################################### +# Override M117 command with rawparams +###################################################################### + +# The macro below will override the default M117 command to echo the message. +# +# It uses the rawparams pseudo-variable that contains the full unparsed +# parameters that was passed to the M117 command. +# +# As this can include comments, we are trimming the text when a `;` or `#` is +# found, and escaping any existing `"` + +[gcode_macro M117] +rename_existing: M117.1 +gcode: + {% if rawparams %} + {% set escaped_msg = rawparams.split(';', 1)[0].split('\x23', 1)[0]|replace('"', '\\"') %} + SET_DISPLAY_TEXT MSG="{escaped_msg}" + RESPOND TYPE=command MSG="{escaped_msg}" + {% else %} + SET_DISPLAY_TEXT + {% endif %} + +# SDCard 'looping' (aka Marlin M808 commands) support +# +# Support SDCard looping +[sdcard_loop] + +# 'Marlin' style M808 compatibility macro for SDCard looping +[gcode_macro M808] +gcode: + {% if params.K is not defined and params.L is defined %}SDCARD_LOOP_BEGIN COUNT={params.L|int}{% endif %} + {% if params.K is not defined and params.L is not defined %}SDCARD_LOOP_END{% endif %} + {% if params.K is defined and params.L is not defined %}SDCARD_LOOP_DESIST{% endif %} + +# Cancel object (aka Marlin/RRF M486 commands) support +# +# Enable object exclusion +[exclude_object] + +[gcode_macro M486] +gcode: + # Parameters known to M486 are as follows: + # [C] Cancel the current object + # [P] Cancel the object with the given index + # [S] Set the index of the current object. + # If the object with the given index has been canceled, this will cause + # the firmware to skip to the next object. The value -1 is used to + # indicate something that isn’t an object and shouldn’t be skipped. + # [T] Reset the state and set the number of objects + # [U] Un-cancel the object with the given index. This command will be + # ignored if the object has already been skipped + + {% if 'exclude_object' not in printer %} + {action_raise_error("[exclude_object] is not enabled")} + {% endif %} + + {% if 'T' in params %} + EXCLUDE_OBJECT RESET=1 + + {% for i in range(params.T | int) %} + EXCLUDE_OBJECT_DEFINE NAME={i} + {% endfor %} + {% endif %} + + {% if 'C' in params %} + EXCLUDE_OBJECT CURRENT=1 + {% endif %} + + {% if 'P' in params %} + EXCLUDE_OBJECT NAME={params.P} + {% endif %} + + {% if 'S' in params %} + {% if params.S == '-1' %} + {% if printer.exclude_object.current_object %} + EXCLUDE_OBJECT_END NAME={printer.exclude_object.current_object} + {% endif %} + {% else %} + EXCLUDE_OBJECT_START NAME={params.S} + {% endif %} + {% endif %} + + {% if 'U' in params %} + EXCLUDE_OBJECT RESET=1 NAME={params.U} + {% endif %} + +###################################################################### +# G130: Set digital potentiometer value +###################################################################### + +# The macro below uses the MCP4018 SET_DIGIPOT command to implement +# a `G130` as used on classic Mightyboard-based printers such as +# The Makerbot Replicator 2/2X. +# +# The `G130` command can be used to lower the stepper current +# during preheating and raise the current again prior to starting +# the print. This is necessary for printers with smaller power +# supplies that needed all the power to heat the bed. +# +# This macro requires one or more [mcp4018] configuration sections: +# (x_axis_pot, y_axis_pot, z_axis_pot, a_axis_pot, b_axis_pot) +# +# Example: G130 X20 Y20 Z20 A20 B20 ; Lower stepper Vrefs while heating + +[gcode_macro G130] +gcode: + M400 + {% if ('X' in params) and ('mcp4018 x_axis_pot' in printer.configfile.config) %} + {% set x_value = params['X']|float %} + {% set x_axis_pot_scale = printer.configfile.config["mcp4018 x_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=x_axis_pot WIPER={ x_axis_pot_scale * (x_value / 127.0)} + {% endif %} + {% if ('Y' in params) and ('mcp4018 y_axis_pot' in printer.configfile.config) %} + {% set y_value = params['Y']|float %} + {% set y_axis_pot_scale = printer.configfile.config["mcp4018 y_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=y_axis_pot WIPER={ y_axis_pot_scale * (y_value / 127.0)} + {% endif %} + {% if ('Z' in params) and ('mcp4018 z_axis_pot' in printer.configfile.config) %} + {% set z_value = params['Z']|float %} + {% set z_axis_pot_scale = printer.configfile.config["mcp4018 z_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=z_axis_pot WIPER={ z_axis_pot_scale * (z_value / 127.0)} + {% endif %} + {% if ('A' in params) and ('mcp4018 a_axis_pot' in printer.configfile.config) %} + {% set a_value = params['A']|float %} + {% set a_axis_pot_scale = printer.configfile.config["mcp4018 a_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=a_axis_pot WIPER={ a_axis_pot_scale * (a_value / 127.0)} + {% endif %} + {% if ('B' in params) and ('mcp4018 b_axis_pot' in printer.configfile.config) %} + {% set b_value = params['B']|float %} + {% set b_axis_pot_scale = printer.configfile.config["mcp4018 b_axis_pot"].scale|float %} + SET_DIGIPOT DIGIPOT=b_axis_pot WIPER={ b_axis_pot_scale * (b_value / 127.0)} + {% endif %} \ No newline at end of file diff --git a/moonraker-sql.db b/moonraker-sql.db index 56f3a17..54fe20f 100644 Binary files a/moonraker-sql.db and b/moonraker-sql.db differ diff --git a/moonraker.conf b/moonraker.conf index f62fc4a..aafab8b 100644 --- a/moonraker.conf +++ b/moonraker.conf @@ -53,3 +53,11 @@ managed_services: crowsnest install_script: tools/pkglist.sh [include octoapp-system.cfg] + +[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 diff --git a/printer.cfg b/printer.cfg index d7d28db..54779b5 100644 --- a/printer.cfg +++ b/printer.cfg @@ -11,6 +11,11 @@ on_error_gcode: CANCEL_PRINT # [include adxlmcu.cfg] [include config_backup.cfg] +[include KAMP_Settings.cfg] + +[include macros.cfg] + + # This file contains common pin mappings for MKS Robin Nano V2 # boards. To use this config, the firmware should be compiled for the # STM32F103. When running "make menuconfig", enable "extra low-level @@ -28,9 +33,6 @@ on_error_gcode: CANCEL_PRINT # See docs/Config_Reference.md for a description of parameters. -[pause_resume] - -[display_status] [printer] @@ -246,6 +248,12 @@ retries: 10 retry_tolerance: 0.02 +[exclude_object] + +[pause_resume] + +[display_status] + [respond] #*# <---------------------- SAVE_CONFIG ---------------------->