Feat: Replace custom KNCM with official Open-Elegoo-Community version

Replaced our custom nozzle cleaning macros with the official
Klipper Nozzle Clean Macro (KNCM) from Open-Elegoo-Community.

Changes:
- Added KNCM/nozzle_clean.cfg (official macro code)
- Updated KNCM_settings.cfg with official variable-based config
- Updated KNCM/KNCM_settings.cfg (copy for include path)
- Removed custom CLEAN_NOZZLE, SMART_PARK, LINE_PURGE macros

Benefits of official KNCM:
- Proper wiper position calculation (not hardcoded X0 Y0!)
- Variable-based configuration (easy to customize)
- Filament-specific cleaning temperatures
- Sinusoidal wiping pattern for better cleaning
- PurgeShake to remove strings before wiping
- Actively maintained by Open-Elegoo-Community

Neptune 4 Plus specific settings:
- printer_bed_y_max: 330
- wiping_axis: Y (bed moves)
- cleaning_height: 30 (CALIBRATE THIS!)
- bed_corner_to_wiper_offset: 40.5 (MEASURE THIS!)

Reference: https://github.com/Open-Elegoo-Community/klipper-nozzle-clean-macro
This commit is contained in:
root 2026-03-13 16:38:54 +00:00
parent 9624c1fb74
commit e22df9b5ab
3 changed files with 673 additions and 112 deletions

View file

@ -1,114 +1,108 @@
# ============================================================================
# KNCM - Nozzle Cleaning Macros
# Simplified nozzle cleaning for reliable prints
# ============================================================================
#############################################################################
# NOZZLE CLEAN SETTINGS - Neptune 4 Plus
#############################################################################
# Original: https://github.com/Open-Elegoo-Community/klipper-nozzle-clean-macro
# Adapted for Neptune 4 Plus with corner wiper holder
#
# INSTALLATION:
# 1. Install wiper holder: https://www.printables.com/model/1221208-neptune-4-plus-corner-guide-with-wiper
# 2. Measure your wiper position and adjust variables below
# 3. Calibrate cleaning_height carefully!
#############################################################################
# ----------------------------------------------------------------------------
# SDCARD_RESET_FILE - Fix for Klipper SD card reset error
# ----------------------------------------------------------------------------
[gcode_macro SDCARD_RESET_FILE]
description: Reset SD card file (placeholder to prevent errors)
[include KNCM/nozzle_clean.cfg]
[gcode_macro _KNCM_SETTINGS]
description: "Nozzle cleaning settings for Neptune 4 Plus"
# ------------------------------------------------------------------------
# BASIC CLEANING CONFIGURATION
# ------------------------------------------------------------------------
# Set nozzle height for cleaning at the brush
# ⚠️ IMPORTANT: Calibrate this value! Start high (35) and work down
# Too low = damages wiper, Too high = doesn't clean
variable_cleaning_height: 30
# Specifies the axis that will move during wiping (X or Y)
# Y = Bed moves (Neptune 4 series)
# X = Nozzle moves (most CoreXY printers)
variable_wiping_axis: 'Y'
# Set maximum Y value of the usable bed area (not the nozzle max travel)
# Neptune 4: 229, Neptune 4 Plus: 330, Neptune 4 Max: 430
variable_printer_bed_y_max: 330
# Number of times the cleaning motions are executed
# 1 loop = 3 passes (first, second, third pass)
variable_cleaning_loops: 1
# Disable (0) / Enable (1) PurgeShake motion before cleaning
# Shakes off filament strings before wiping
variable_purge_shake: 1
# Disable (0) / Enable (1) Wait for nozzle temp restore after cleaning
variable_wait_nozzle_temp_restore: 1
# Disable (0) / Enable (1) debug messages in console
variable_debug: 0
# ------------------------------------------------------------------------
# ACCELERATION (mm/s²) & SPEED SETTINGS (mm/s)
# ------------------------------------------------------------------------
# Acceleration (0 = use printer default acceleration)
variable_acceleration: 0
# Travel speed (fast non-cleaning moves)
variable_travel_speed: 350
# Speed for slow cleaning moves (deep cleaning)
variable_slow_speed: 250
# Speed for fast cleaning moves (final wipe)
variable_fast_speed: 500
# ------------------------------------------------------------------------
# FILAMENT CLEANING TEMPERATURES
# ------------------------------------------------------------------------
# Cleaning temperatures by filament type (lower than print temp)
# Prevents oozing during cleaning
variable_cleaning_temperatures: {
"PLA":140,
"PETG":160,
"TPU":180,
"ABS":190,
"ASA":190
}
# ------------------------------------------------------------------------
# WIPER SETUP (brush geometry and offsets) - NEPTUNE 4 PLUS
# ------------------------------------------------------------------------
# ⚠️ MEASURE THESE VALUES for your specific wiper installation!
# ------------------------------------------------------------------------
# Wiper width (X-axis space used by the brush in mm)
variable_wiper_width: 8
# Wiper length (Y-axis space used by the brush in mm)
variable_wiper_length: 37
# Thickness of the wiper holder wall (distance from bed to silicone start)
# Usually 0 if silicone starts at wall edge
variable_wiper_walloffset: 0
# Distance from bed origin (X=0) to start of silicone brush area
# ⚠️ MEASURE THIS: From X=0 to where silicone begins
# Neptune 4 Plus typical: 40.5mm (adjust for your setup!)
variable_bed_corner_to_wiper_offset: 40.5
# Number of sinusoidal waves during cleaning motion
# More waves = more thorough cleaning, but slower
variable_waves: 2
# ------------------------------------------------------------------------
# !!! DO NOT EDIT BELOW !!!
# ------------------------------------------------------------------------
gcode:
# Placeholder - SD card operations handled by Klipper
RESPOND MSG="SD card reset acknowledged"
# ----------------------------------------------------------------------------
# PRINTER VARIABLES - Neptune 4 Plus
# ----------------------------------------------------------------------------
# Adjust these values in your user_settings.cfg if needed!
# ----------------------------------------------------------------------------
# Bed dimensions (not nozzle travel, but usable bed area)
# N4=229, N4Plus=330, N4Max=430
# This is set via mesh_max in [bed_mesh] section
# ----------------------------------------------------------------------------
# CLEAN_NOZZLE - Wipe nozzle on brush/cloth
# ----------------------------------------------------------------------------
[gcode_macro CLEAN_NOZZLE]
description: Clean nozzle on brush or cloth
gcode:
{% set FILAMENT_TYPE = params.FILAMENT_TYPE|default("PLA")|upper %}
{% set CLEAN_X = params.CLEAN_X|default(0)|int %}
{% set CLEAN_Y = params.CLEAN_Y|default(0)|int %}
{% set CLEAN_Z = params.CLEAN_Z|default(0.5)|float %}
{% set PASSES = params.PASSES|default(3)|int %}
RESPOND MSG="Cleaning nozzle..."
# Move to clean position
G1 X{CLEAN_X} Y{CLEAN_Y} Z{CLEAN_Z} F3000
# Wipe passes
{% for i in range(PASSES) %}
G1 X{CLEAN_X + 10} F1800
G1 X{CLEAN_X} F1800
{% endfor %}
# Lift Z
G1 Z10 F600
RESPOND MSG="Nozzle clean complete!"
# ----------------------------------------------------------------------------
# SMART_PARK - Park near front for easy access
# ----------------------------------------------------------------------------
[gcode_macro SMART_PARK]
description: Park nozzle at front of bed for easy access
gcode:
{% set PARK_X = params.PARK_X|default(165)|int %}
{% set PARK_Y = params.PARK_Y|default(10)|int %}
{% set PARK_Z = params.PARK_Z|default(50)|int %}
G1 X{PARK_X} Y{PARK_Y} Z{PARK_Z} F6000
RESPOND MSG="Printer parked at front"
# ----------------------------------------------------------------------------
# LINE_PURGE - Print purge line at start of bed
# ----------------------------------------------------------------------------
[gcode_macro LINE_PURGE]
description: Print purge line at start of bed
gcode:
{% set PURGE_START_X = params.START_X|default(10)|int %}
{% set PURGE_END_X = params.END_X|default(300)|int %}
{% set PURGE_Y = params.Y|default(10)|int %}
{% set PURGE_Z = params.Z|default(0.2)|float %}
{% set PURGE_AMOUNT = params.AMOUNT|default(30)|int %}
# Move to purge start
G1 X{PURGE_START_X} Y{PURGE_Y} Z{PURGE_Z} F3000
# Extrude purge line
G1 X{PURGE_END_X} E{PURGE_AMOUNT} F600
# Lift Z
G1 Z2 F600
RESPOND MSG="Purge line printed"
# ----------------------------------------------------------------------------
# Frame Light Control (Neptune 4 Plus)
# ----------------------------------------------------------------------------
[gcode_macro Frame_Light_ON]
description: Turn on frame LED lights
gcode:
SET_PIN PIN=frame_light VALUE=1
[gcode_macro Frame_Light_OFF]
description: Turn off frame LED lights
gcode:
SET_PIN PIN=frame_light VALUE=0
# ----------------------------------------------------------------------------
# Part Light Control (Neptune 4 Plus)
# ----------------------------------------------------------------------------
[gcode_macro Part_Light_ON]
description: Turn on part cooling fan light
gcode:
SET_PIN PIN=part_light VALUE=1
[gcode_macro Part_Light_OFF]
description: Turn off part cooling fan light
gcode:
SET_PIN PIN=part_light VALUE=0
# This macro only stores shared variables, no actual commands
{action_respond_info("Running KNCM_SETTINGS does nothing - it stores settings only")}