1212 {% for var, value in printer[" gcode_macro RatOS" ].items() %}
1313 {action_respond_info(var ~ " : " ~ value)}
1414 {% endfor %}
15-
15+
1616[gcode_macro RatOS]
1717description: RatOS variable storage macro, will echo variables to the console when run.
1818# Configuration Defaults
@@ -90,7 +90,7 @@ rename_existing: PAUSE_BASE
9090variable_extrude: 1.5
9191gcode:
9292 SAVE_GCODE_STATE NAME =PAUSE_state
93- # Define park positions
93+ # Define park positions
9494 {% set E = printer[" gcode_macro PAUSE" ].extrude|float %}
9595 {% set speed = printer[" gcode_macro RatOS" ].macro_travel_speed|float * 60 %}
9696 # Calculate safe Z position
@@ -115,7 +115,7 @@ gcode:
115115 _PARK LOCATION ={printer[" gcode_macro RatOS" ].pause_print_park_in} X ={printer[" gcode_macro RatOS" ].pause_print_park_x}
116116 {% else %}
117117 {action_respond_info(" Printer not homed" )}
118- {% endif %}
118+ {% endif %}
119119
120120[gcode_macro RESUME]
121121description: Resumes the print if the printer is paused.
@@ -149,7 +149,7 @@ gcode:
149149 SAVE_GCODE_STATE NAME =prime_line_state
150150 {% set speed = printer[" gcode_macro RatOS" ].macro_travel_speed|float * 60 %}
151151 # Absolute positioning
152- G90
152+ G90
153153 # Absolute extrusion
154154 M82
155155 M117 Priming nozzle with prime line..
@@ -162,7 +162,7 @@ gcode:
162162 G1 Z0.3 F3000
163163 # Reset extrusion distance
164164 G92 E0
165- # Prime nozzle
165+ # Prime nozzle
166166 G1 Y{printer.toolhead.axis_minimum.y + 80} E16 F1200
167167 # Wipe
168168 G1 Y{printer.toolhead.axis_minimum.y + 100} F{speed}
@@ -176,7 +176,7 @@ gcode:
176176 RESPOND MSG =" Priming nozzle with prime blob.."
177177 {% set speed = printer[" gcode_macro RatOS" ].macro_travel_speed|float * 60 %}
178178 # Absolute positioning
179- G90
179+ G90
180180 # Relative extrusion
181181 M83
182182 # Lift 5 mm
@@ -186,11 +186,11 @@ gcode:
186186 # Extrude a blob
187187 G1 F60 E20
188188 # 40% fan
189- M106 S102
189+ M106 S102
190190 # Move the extruder up by 5mm while extruding, breaks away from blob
191- G1 Z5 F100 E5
191+ G1 Z5 F100 E5
192192 # Move to wipe position, but keep extruding so the wipe is attached to blob
193- G1 F200 Y{printer.toolhead.axis_minimum.y + 25} E1
193+ G1 F200 Y{printer.toolhead.axis_minimum.y + 25} E1
194194 # Go down diagonally while extruding
195195 # Broken down in z moves under 2mm as a workaround for a tuning tower test.
196196 # The tuning tower command thinks a new print has been started when z moves over 2mm and aborts.
@@ -201,12 +201,12 @@ gcode:
201201 # 0% fan
202202 M106 S0
203203 # small wipe line
204- G1 F200 Y{printer.toolhead.axis_minimum.y +50} Z0.2 E0.6
204+ G1 F200 Y{printer.toolhead.axis_minimum.y +50} Z0.2 E0.6
205205 # Break away wipe
206206 G1 F{speed} Y{printer.toolhead.axis_minimum.y + 100}
207207 RESTORE_GCODE_STATE NAME =prime_blob_state
208208
209-
209+
210210[gcode_macro _PARK]
211211gcode:
212212 {% set speed = printer[" gcode_macro RatOS" ].macro_travel_speed|float * 60 %}
@@ -230,9 +230,19 @@ gcode:
230230 {% set y = printer.toolhead.axis_maximum.y / 2 %}
231231 {% endif %}
232232 # Absolute positioning
233- G90
233+ G90
234234 # Park
235- G0 X{safe_x} Y{y} F{speed}
235+ G0 X{safe_x} Y{y} F{speed}
236+
237+ [gcode_macro ASSERT_NOZZLE_DIAMETER]
238+ description: Raises an error unless the configured nozzle diameter is the same as the diameter passed in.
239+ gcode:
240+ {% set configured_diameter = printer.configfile.config.extruder.nozzle_diameter|float %}
241+ {% set sliced_diameter = params.NOZZLE_DIAMETER|float %}
242+ {% if configured_diameter != sliced_diameter %}
243+ M117 Aborting print due to nozzle-diameter mismatch between printer config and slicer.
244+ { action_raise_error(" Nozzle-diameter mismatch between printer config (%s mm) and slicer (%s mm)." % (configured_diameter, sliced_diameter)) }
245+ {% endif %}
236246
237247# ####
238248# COLOR CHANGE
@@ -261,15 +271,15 @@ gcode:
261271 TEMPERATURE_WAIT SENSOR =extruder MINIMUM ={params.TEMP|default(220, true)}
262272 {% endif %}
263273 M117 Unloading filament...
264- # Extract filament to cold end area
274+ # Extract filament to cold end area
265275 G0 E-5 F3600
266276 # Wait for three seconds
267277 G4 P3000
268- # Push back the filament to smash any stringing
278+ # Push back the filament to smash any stringing
269279 G0 E5 F3600
270- # Extract back fast in to the cold zone
280+ # Extract back fast in to the cold zone
271281 G0 E-15 F3600
272- # Continue extraction slowly, allow the filament time to cool solid before it reaches the gears
282+ # Continue extraction slowly, allow the filament time to cool solid before it reaches the gears
273283 G0 E-130 F300
274284 M117 Filament unloaded!
275285 RESPOND MSG =" Filament unloaded! Please inspect the tip of the filament before reloading."
@@ -306,7 +316,7 @@ gcode:
306316
307317# ####
308318# START PRINT MACROS
309- # Call this from your slicer (custom g-code).
319+ # Call this from your slicer (custom g-code).
310320# Read more here: https://rat-rig.github.io/V-CoreOS/#/slicers
311321# ####
312322
@@ -318,11 +328,15 @@ gcode:
318328 # Metric values
319329 G21
320330 # Absolute positioning
321- G90
331+ G90
322332 # Set extruder to absolute mode
323333 M82
324334 # Home if needed
325335 MAYBE_HOME
336+ # Check nozzle if told to do so
337+ {% if params.NOZZLE_DIAMETER %}
338+ ASSERT_NOZZLE_DIAMETER NOZZLE_DIAMETER ={params.NOZZLE_DIAMETER}
339+ {% endif %}
326340 M117 Heating bed...
327341 RESPOND MSG =" Heating bed..."
328342 # Wait for bed to heat up
@@ -360,7 +374,7 @@ gcode:
360374 {% if printer[" gcode_macro RatOS" ].preheat_extruder|lower == ' true' %}
361375 M117 Pre-heating extruder...
362376 RESPOND MSG =" Pre-heating extruder..."
363- # Wait for extruder to reach 150 so an inductive probe (if present) is at a predictable temp.
377+ # Wait for extruder to reach 150 so an inductive probe (if present) is at a predictable temp.
364378 # Also allows the bed heat to spread a little, and softens any plastic that might be stuck to the nozzle.
365379 M104 S150
366380 TEMPERATURE_WAIT SENSOR =extruder MINIMUM =150
@@ -393,7 +407,7 @@ gcode:
393407
394408# ####
395409# END PRINT MACROS
396- # Call this from your slicer (custom g-code).
410+ # Call this from your slicer (custom g-code).
397411# Read more here: https://rat-rig.github.io/V-CoreOS/#/slicers
398412# ####
399413
0 commit comments