From 490654b00d43b71fafb4cae23ba6e86c0fd97a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Boisselier?= Date: Sun, 16 Apr 2023 12:23:52 +0200 Subject: [PATCH] modified the CALIBRATE macro to accept multiple bed sizes automatically --- macros/calibration/calibrate.cfg | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/macros/calibration/calibrate.cfg b/macros/calibration/calibrate.cfg index 700eaed80..ac8ff925f 100644 --- a/macros/calibration/calibrate.cfg +++ b/macros/calibration/calibrate.cfg @@ -3,22 +3,30 @@ description: Calibrate the printer flow or pressure advance gcode: # Type of calibration {% set TYPE = params.TYPE|default("")|string|lower %} - # Define vars with safe default values for ABS (main material I'm using) + + # Define print vars with safe default values {% set BED_TEMP = params.BED_TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_bed_temp)|float %} {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_extruder_temp)|float %} {% set MATERIAL = params.MATERIAL|default("ABS")|string %} + + {% set center_x = printer.toolhead.axis_maximum.x|float / 2 %} + {% set center_y = printer.toolhead.axis_maximum.y|float / 2 %} {% if TYPE=="flow" %} + # No bed mesh needed for this one as it's a small center print so we compute the size manually (default flow size is 40mm) + {% set computed_size = (center_x - 20)|string + '_' + (center_y - 20)|string + '_' + (center_x + 20)|string + '_' + (center_y + 20)|string %} + # Call the standard START_PRINT with almost no soaking time and no chamber temp requirement (we want to go fast!) - # Also no bed mesh needed for this one as it's a small center print - START_PRINT EXTRUDER_TEMP={EXTRUDER_TEMP} BED_TEMP={BED_TEMP} MATERIAL={MATERIAL} SOAK=1 SIZE=130_130_170_170 + START_PRINT EXTRUDER_TEMP={EXTRUDER_TEMP} BED_TEMP={BED_TEMP} MATERIAL={MATERIAL} SOAK=1 SIZE={computed_size} FLOW_MULTIPLIER_CALIBRATION EXTRUSION_WIDTH=0.471 END_PRINT FILTER_TIME=0 {% elif TYPE=="pressure_advance" %} + # A bed mesh is needed for this one as it's a large print so we compute the size manually (default PA size is 120mm) + {% set computed_size = (center_x - 60)|string + '_' + (center_y - 60)|string + '_' + (center_x + 60)|string + '_' + (center_y + 60)|string %} + # Call the standard START_PRINT with almost no soaking time and no chamber temp requirement (we want to go fast!) - # A bed mesh is needed for this one as it's a large print (120mm sized square) - START_PRINT EXTRUDER_TEMP={EXTRUDER_TEMP} BED_TEMP={BED_TEMP} MATERIAL={MATERIAL} SOAK=1 SIZE=90_90_210_210 + START_PRINT EXTRUDER_TEMP={EXTRUDER_TEMP} BED_TEMP={BED_TEMP} MATERIAL={MATERIAL} SOAK=1 SIZE={computed_size} PRESSURE_ADVANCE_CALIBRATION END_PRINT FILTER_TIME=0