open4neptune-new/calibration/test_patterns.cfg
root 01dc889fd8 Fix: FLOW_TEST_CUBE - print sections at same Z height, not stacked
- Previous: Sections stacked vertically (20mm each, 100mm total!)
- Fixed: All sections print at Z=0.2-1.0mm (4 layers × 0.2mm)
- Much more practical for flow calibration
- Added info message showing actual print height
2026-03-14 13:19:39 +00:00

341 lines
12 KiB
INI

# ============================================================================
# CALIBRATION TEST PATTERNS
# Actual printable G-code patterns for calibration tests
# ============================================================================
# ----------------------------------------------------------------------------
# PRESSURE ADVANCE TEST PATTERN
# Prints squares with varying PA values
# ----------------------------------------------------------------------------
[gcode_macro PA_TEST_PATTERN]
description: Print Pressure Advance test pattern (Neptune 4 Plus optimized)
gcode:
{% set START_PA = params.START|default(0.01)|float %}
{% set END_PA = params.END|default(0.05)|float %}
{% set STEPS = params.STEPS|default(10)|int %}
{% set TEMP = params.TEMP|default(205)|int %}
# Neptune 4 Plus bed dimensions
{% set BED_CENTER_X = 150 %}
{% set BED_CENTER_Y = 165 %}
# Heat up
M104 S{TEMP}
M190 S60
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={TEMP-5}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM=55
# Home
G28
G1 Z10 F600
# Settings
G90 ; Absolute positioning
M83 ; Relative extrusion
G92 E0
{% set step_size = (END_PA - START_PA) / STEPS %}
{% set square_size = 25 %}
{% set spacing = 10 %}
{% set squares_per_row = 5 %}
# Calculate starting position to center the pattern
{% set pattern_width = (squares_per_row * (square_size + spacing)) - spacing %}
{% set start_x = BED_CENTER_X - (pattern_width / 2) %}
{% set start_y = BED_CENTER_Y - (pattern_width / 2) %}
RESPOND MSG="Printing {STEPS} squares with PA from {START_PA} to {END_PA}"
RESPOND MSG="Pattern centered at X{BED_CENTER_X} Y{BED_CENTER_Y}"
{% for step in range(STEPS) %}
{% set current_pa = START_PA + (step * step_size) %}
{% set col = step % squares_per_row %}
{% set row = (step // squares_per_row)|int %}
{% set x_pos = start_x + col * (square_size + spacing) %}
{% set y_pos = start_y + row * (square_size + spacing) %}
RESPOND MSG="Square {step + 1}/{STEPS}: PA={current_pa} at X{x_pos} Y{y_pos}"
SET_PRESSURE_ADVANCE ADVANCE={current_pa}
# Move to position
G1 X{x_pos} Y{y_pos} Z0.2 F3000
# Print square (counter-clockwise)
G1 X{x_pos + square_size} E{square_size * 0.04} F1800
G1 Y{y_pos + square_size} E{square_size * 0.04} F1800
G1 X{x_pos} E{square_size * 0.04} F1800
G1 Y{y_pos} E{square_size * 0.04} F1800
# Lift Z and travel to next
G1 Z5 F600
{% endfor %}
# Park at front
G1 X{BED_CENTER_X} Y{20} Z50 F6000
RESPOND MSG="PA Test Pattern complete!"
RESPOND MSG="Examine squares and find best corner quality"
# ----------------------------------------------------------------------------
# FLOW RATE TEST CUBE
# Prints cube with varying flow rates - Neptune 4 Plus optimized
# ----------------------------------------------------------------------------
[gcode_macro FLOW_TEST_CUBE]
description: Print flow rate calibration cube (centered on bed)
gcode:
{% set START_FLOW = params.START|default(0.90)|float %}
{% set END_FLOW = params.END|default(1.10)|float %}
{% set STEPS = params.STEPS|default(5)|int %}
{% set TEMP = params.TEMP|default(205)|int %}
# Neptune 4 Plus bed center
{% set BED_CENTER_X = 150 %}
{% set BED_CENTER_Y = 165 %}
{% set CUBE_SIZE = 20 %}
# Heat up
M104 S{TEMP}
M190 S60
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={TEMP-5}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM=55
# Home
G28
G1 Z10 F600
# Settings
G90 ; Absolute positioning
M83 ; Relative extrusion
G92 E0
{% set step_size = (END_FLOW - START_FLOW) / STEPS %}
{% set layers_per_section = 4 %}
{% set layer_height = 0.2 %}
{% set wall_thickness = 0.4 %}
# Calculate cube corner positions (centered)
{% set cube_x_min = BED_CENTER_X - (CUBE_SIZE / 2) %}
{% set cube_y_min = BED_CENTER_Y - (CUBE_SIZE / 2) %}
{% set cube_x_max = BED_CENTER_X + (CUBE_SIZE / 2) %}
{% set cube_y_max = BED_CENTER_Y + (CUBE_SIZE / 2) %}
RESPOND MSG="Printing flow cube with {STEPS} sections"
RESPOND MSG="Flow range: {START_FLOW} to {END_FLOW}"
RESPOND MSG="Cube centered at X{BED_CENTER_X} Y{BED_CENTER_Y}"
RESPOND MSG="Each section: {layers_per_section} layers at Z0.2-{layers_per_section * layer_height}mm"
# Print all sections at same Z height (not stacked!)
{% for step in range(STEPS) %}
{% set current_flow = START_FLOW + (step * step_size) %}
RESPOND MSG="Section {step + 1}/{STEPS}: Flow={current_flow}"
# Set flow rate (via extrusion multiplier simulation)
{% set flow_multiplier = current_flow %}
# Print walls for this section (all at same Z levels)
{% for layer in range(layers_per_section) %}
{% set z_height = 0.2 + (layer * layer_height) %}
G1 Z{z_height} F600
# Wall 1 (front)
G1 X{cube_x_min} Y{cube_y_min} F3000
G1 X{cube_x_max} E{CUBE_SIZE * 0.04 * flow_multiplier} F1800
# Wall 2 (right)
G1 Y{cube_y_max} E{CUBE_SIZE * 0.04 * flow_multiplier} F1800
# Wall 3 (back)
G1 X{cube_x_min} E{CUBE_SIZE * 0.04 * flow_multiplier} F1800
# Wall 4 (left)
G1 Y{cube_y_min} E{CUBE_SIZE * 0.04 * flow_multiplier} F1800
{% endfor %}
{% endfor %}
# Lift Z and park
G1 Z50 F600
G1 X{BED_CENTER_X} Y{20} F6000
RESPOND MSG="Flow Test Cube complete!"
RESPOND MSG="Measure walls with calipers and calculate optimal flow"
# ----------------------------------------------------------------------------
# RETRACTION TEST PATTERN
# Prints towers with varying retraction lengths - Neptune 4 Plus optimized
# ----------------------------------------------------------------------------
[gcode_macro RETRACT_TEST_PATTERN]
description: Print retraction test pattern (centered on bed)
gcode:
{% set START_RETRACT = params.START|default(1.0)|float %}
{% set END_RETRACT = params.END|default(4.0)|float %}
{% set STEPS = params.STEPS|default(8)|int %}
{% set TEMP = params.TEMP|default(205)|int %}
# Neptune 4 Plus bed center
{% set BED_CENTER_X = 150 %}
{% set BED_CENTER_Y = 165 %}
# Heat up
M104 S{TEMP}
M190 S60
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={TEMP-5}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM=55
# Home
G28
G1 Z10 F600
# Settings
G90 ; Absolute positioning
M83 ; Relative extrusion
{% set step_size = (END_RETRACT - START_RETRACT) / STEPS %}
{% set tower_height = 15 %}
{% set layers_per_tower = 75 %}
{% set tower_size = 10 %}
{% set tower_spacing = 30 %}
{% set towers_per_row = 4 %}
# Calculate starting position to center the pattern
{% set pattern_width = ((towers_per_row - 1) * tower_spacing) %}
{% set start_x = BED_CENTER_X - (pattern_width / 2) %}
{% set start_y = BED_CENTER_Y - (pattern_width / 4) %}
RESPOND MSG="Printing retraction test with {STEPS} towers"
RESPOND MSG="Retraction range: {START_RETRACT}mm to {END_RETRACT}mm"
RESPOND MSG="Pattern centered at X{BED_CENTER_X} Y{BED_CENTER_Y}"
{% for step in range(STEPS) %}
{% set current_retract = START_RETRACT + (step * step_size) %}
{% set col = step % towers_per_row %}
{% set row = (step // towers_per_row)|int %}
{% set x_pos = start_x + col * tower_spacing %}
{% set y_pos = start_y + row * tower_spacing %}
RESPOND MSG="Tower {step + 1}/{STEPS}: Retract={current_retract}mm at X{x_pos} Y{y_pos}"
# Print tower
{% for layer in range(layers_per_tower) %}
{% set z_height = layer * 0.2 %}
G1 Z{z_height} F600
# Move to tower position
G1 X{x_pos} Y{y_pos} F3000
# Retract
G1 E-{current_retract} F2100
# Travel to next tower position (simulates stringing test)
{% if step < STEPS - 1 %}
{% set next_col = (step + 1) % towers_per_row %}
{% set next_row = ((step + 1) // towers_per_row)|int %}
{% set next_x = start_x + next_col * tower_spacing %}
{% set next_y = start_y + next_row * tower_spacing %}
G1 X{next_x} Y{next_y} F3000
# De-retract
G1 E{current_retract} F2100
{% endif %}
# Small square for this layer
G1 X{x_pos + tower_size} E{tower_size * 0.04} F1800
G1 Y{y_pos + tower_size} E{tower_size * 0.04} F1800
G1 X{x_pos} E{tower_size * 0.04} F1800
G1 Y{y_pos} E{tower_size * 0.04} F1800
{% endfor %}
# Lift Z
G1 Z20 F600
{% endfor %}
# Park at front
G1 X{BED_CENTER_X} Y{20} Z50 F6000
RESPOND MSG="Retraction Test Pattern complete!"
RESPOND MSG="Find tower with least stringing"
# ----------------------------------------------------------------------------
# TEMPERATURE TOWER
# Prints tower with varying temperatures - Neptune 4 Plus optimized
# ----------------------------------------------------------------------------
[gcode_macro TEMP_TOWER]
description: Print temperature tower (centered on bed)
gcode:
{% set START_TEMP = params.START|default(195)|int %}
{% set END_TEMP = params.END|default(225)|int %}
{% set STEP = params.STEP|default(5)|int %}
{% set BED_TEMP = params.BED|default(60)|int %}
# Neptune 4 Plus bed center
{% set BED_CENTER_X = 150 %}
{% set BED_CENTER_Y = 165 %}
{% set TOWER_SIZE = 20 %}
# Calculate tower corner positions (centered)
{% set tower_x_min = BED_CENTER_X - (TOWER_SIZE / 2) %}
{% set tower_y_min = BED_CENTER_Y - (TOWER_SIZE / 2) %}
{% set tower_x_max = BED_CENTER_X + (TOWER_SIZE / 2) %}
{% set tower_y_max = BED_CENTER_Y + (TOWER_SIZE / 2) %}
# Heat bed
M190 S{BED_TEMP}
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={BED_TEMP-5}
# Home
G28
G1 Z10 F600
# Settings
G90 ; Absolute positioning
M83 ; Relative extrusion
G92 E0
{% set sections = ((END_TEMP - START_TEMP) / STEP)|int + 1 %}
{% set section_height = 10 %}
{% set layers_per_section = 50 %}
RESPOND MSG="Printing temperature tower"
RESPOND MSG="Temp range: {START_TEMP}°C to {END_TEMP}°C"
RESPOND MSG="Sections: {sections}"
RESPOND MSG="Tower centered at X{BED_CENTER_X} Y{BED_CENTER_Y}"
{% for section in range(sections) %}
{% set current_temp = START_TEMP + (section * STEP) %}
{% set z_start = section * section_height %}
RESPOND MSG="Section {section + 1}/{sections}: {current_temp}°C"
# Set temperature
M104 S{current_temp}
# Wait for temp to stabilize
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={current_temp-2} MAXIMUM={current_temp+2}
G4 P3000 ; Extra wait for stabilization
# Print section
{% for layer in range(layers_per_section) %}
{% set z_height = z_start + (layer * 0.2) %}
G1 Z{z_height} F600
# Print square (centered)
G1 X{tower_x_min} Y{tower_y_min} F3000
G1 X{tower_x_max} E{TOWER_SIZE * 0.04} F1800
G1 Y{tower_y_max} E{TOWER_SIZE * 0.04} F1800
G1 X{tower_x_min} E{TOWER_SIZE * 0.04} F1800
G1 Y{tower_y_min} E{TOWER_SIZE * 0.04} F1800
# Bridging test every 10 layers
{% if layer % 10 == 0 and layer > 0 %}
G1 X{BED_CENTER_X} Y{BED_CENTER_Y} E{TOWER_SIZE * 0.015} F2000 ; Bridge
{% endif %}
{% endfor %}
{% endfor %}
# Cool down and park
M104 S0
G1 Z50 F600
G1 X{BED_CENTER_X} Y{20} F6000
RESPOND MSG="Temperature Tower complete!"
RESPOND MSG="Examine sections for best quality"