Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
* add description
* nix the confusing "expected"/"actual" nomenclature in favor of "configured"/"sliced" and
* use the nomenclature correctly in the error message
  • Loading branch information
mmirate authored Mar 19, 2022
1 parent 0a4490e commit 6cd377b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions macros.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,13 @@ gcode:
G0 X{safe_x} Y{y} F{speed}

[gcode_macro ASSERT_NOZZLE_DIAMETER]
description: Raises an error unless the configured nozzle diameter is the same as the diameter passed in.
gcode:
{% set expected_diameter = params.NOZZLE_DIAMETER|float %}
{% set actual_diameter = printer.configfile.config.extruder.nozzle_diameter|float %}
{% if expected_diameter != actual_diameter %}
{% set configured_diameter = printer.configfile.config.extruder.nozzle_diameter|float %}
{% set sliced_diameter = params.NOZZLE_DIAMETER|float %}
{% if configured_diameter != sliced_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)) }
{ action_raise_error("Nozzle-diameter mismatch between printer config (%s mm) and slicer (%s mm)." % (configured_diameter, sliced_diameter)) }
{% endif %}

#####
Expand Down

0 comments on commit 6cd377b

Please sign in to comment.