diff --git a/macros.cfg b/macros.cfg index 69de983da..0ab26e837 100644 --- a/macros.cfg +++ b/macros.cfg @@ -175,6 +175,15 @@ gcode: # Park G0 X{safe_x} Y{y} F{speed} +[gcode_macro ASSERT_NOZZLE_DIAMETER] +gcode: + {% set expected_diameter = params.NOZZLE_DIAMETER|float %} + {% set actual_diameter = printer.configfile.config.extruder.nozzle_diameter|float %} + {% if expected_diameter != actual_diameter %} + M117 Aborting print due to nozzle-diameter mismatch between printer config and slicer. + { action_raise_error("Nozzle-diameter mismatch between printer config (%s mm) and slicer (%s mm)." % (expected_diameter, actual_diameter)) } + {% endif %} + ##### # COLOR CHANGE ##### @@ -256,6 +265,10 @@ gcode: M82 # Home G28 + # Check nozzle if told to do so + {% if params.NOZZLE_DIAMETER %} + ASSERT_NOZZLE_DIAMETER NOZZLE_DIAMETER={params.NOZZLE_DIAMETER} + {% endif %} M117 Heating bed... # Wait for bed to heat up M190 S{params.BED_TEMP|default(printer.heater_bed.target, true) }