Macro for calibration prints, I want to share

Hello,

I wrote a handy calibration tool with a lot of help from this forum that I’d like to share with you. The reason for creating this macro was that I didn’t want to reslice and reupload the G-code for my test prints every time I needed to test or calibrate for a new filament. Now, I can do it quickly and easily within the interface.

This macro allows you to print a few parts to determine the print temperature for your filament, the flow rate, the pressure advance value, and a validation pattern for bed leveling (similar to M26 in Marlin).

There are parameters to select what you want to print, set print temperature, fan speed, start and factor for the pressure advance tuning tower, and a built-in calculator used for flow rate and pressure advance calculation.

Screenshot

To add the macro, place the folder “Calibration_Prints” in the same location as your printer.cfg, and include [include Calibration_Prints/*.cfg].

Note:
The test prints are pre-sliced files, have its own start_gcode and are therefore sliced for my specific printer, You will most likely have to reslice, modify, and replace the G-code in their respective .cfg files to make it work for your printer. What needs to be changed is commented inside their respective .cfg files. The STL files I used are included.

I have done my best to provide as much information as I could, and I have commented everything in this macro. If you type “help” in the “TOOL” parameter, you will get a bunch of information about the macro, how to use it, and what’s important to know.

One last warning: don’t simply add this macro and use it right away, or you will most likely have a bad time. Change it accordingly to your printer before use. I am not responsible for any damage to your printer.

UPDATE:

Based on user feedback:

  • Fixed some bugs,
  • Added slicer settings information in the .cfg’s
  • Added a lengthy, in depth redme.txt where (hopefully) everything is explained
  • Removed the validation pattern and instead added a retraction test print.
  • Simplifies START_TUNING_PRINT and END_TUNING_PRINT

UPDATE II:

  • Fixed some more bugs
  • changed the flow calibration print and its .stl, because the first one was flawed
  • added the TUNING_TOWER command to heat- pressure advanced- and retraction-calibration, making it easier when it comes to adjusting the sliced g-code for the prints and gives more flexibility with the parameters.
  • added FLOW parameter.

Note: For the flow parameter to work correctly, slice the g-code for those prints at 100% flow.
In order for the Macro to work correctly, you need to use [firmware retraction]

Calibration_Prints.zip (250.4 KB)

5 Likes

Noice!

But where can one find this macro?

I knew I forgot somethin, thanks :slight_smile:
I added it now.

1 Like

This is a really good idea, if for no other reason than to reduce some of the friction involved in doing filament-specific calibration in the first place. I know every filament is different, sometimes even different batches of the same color from the same manufacturer. Still, whenever a new spool arrives, I think, “I should really print a bunch of calibration prints and dial in this specific filament… Nah, it’s probably the same as [name of last-used filament], I’ll just load it up and make adjustments on the fly.”

I’m sure I’m not the only one.

Do you happen to know the volume of filament that is used in doing all the calibrations?

One side note:

Prints that are executed via a macro can not be cancelled.

1 Like

No volume, but Cura says the:

  • preasure advance tuning_tower uses 7,8m or 23g (PLA)
  • flow test uses 0,6m or 2g (PLA)
  • heat tower uses 1,4m or 4g (PLA)
  • validation pattern uses 0,4m or 2g (PLA) (specific to my print bed)

Correct, those macros/prints can not be canceled. It’s not fancy, it’s not elegant, but in case you need to stop, you always can power cycle the printer or use the emergency stop.

That’s because it’s not a “print,” but rather the macro is executing all of the gcodes as part of the macro, right? If so, could this be worked around with SDCARD_PRINT_FILE? I wouldn’t think that invoking SDCARD_PRINT_FILE from within a macro would block further gcode commands until after the print has completed, but I’ve never tried it.

Hey Duke,

I just spent a couple of hours trying this out and it’s a great concept but it needs a bit of work and a lot more documentation.

My rationale for trying this out was that I wanted to set up the parameters for PETg for my printers and I thought this might be an interesting tool to do it. After a bit of struggling, I did get a fairly decent heat tower printed:

First off, I’ve found a couple of bugs you need to address in the macros:

  1. In “macro_calibration.cfg”, the macro PRESSURE_TEST is invoked, but there isn’t any macro by this name, in “Preasure_Advanced_Print.cfg” it’s PREASURE_TEST.
  2. In “macro_calibration.cfg”, the macro START_TUNING_PRINT executes commands to # Set Bed LEDs White but if you don’t have your LEDs labeled as my_neopixel and 25 of them, things are going to go tilt. Can I suggest that you just delete this code in the package you publish?
  3. In “Heat_Tower_Print.cfg”, looking at what is effectively the example gcode; at z5, you set the extruder temperature at the current but don’t subtract 5 degrees from it beforehand. I know it’s really an example but it should be as correct as possible.

In terms of the macro_calibration menu that comes up, you’re going to need to more fully document it.

  1. I have no real idea what “CALC” does. If it’s not zero, it provides a FLOW_TEST value that’s based on it and 0.4 with a multiplication value of 100 which means that I presume the value is in percentage. Similarly for PRESSURE, I guess it’s the length of the PA tower that looks good but I’m not 10$ sure.
  2. You say that the gcode that is copied into the various macros will have to be generated for a user’s machine but you need to be a lot more explicit on what the user needs to do. For example for the heat tower, you have some instructions but when I sat down and started slicing the .stl I had questions in terms of (please confirm if my values are correct):
    o Gantry speed. In your code you mention that you run things at 100mm/s but I’m not sure if this is required for the test or just how you run things
    o Layer height. My default is 0.15mm, I set it to 0.2mm to match the example
    o Wall width. I ended up setting it to the width of my extruder
    o Infill. Set to 0
    o Top height. I ended up setting this to 0.0mm
    o Base height. I think two layers (0.4mm)
    o I copied in the extruder temperature change statements verbatim (which is why at Z5, I didn’t start reducing the temperature until I hit Z10) - are the “CAZD” statements required? They’re commented out and I believe they are only required for Cura, but I want to confirm

I had two problems with following your example gcode:

  1. I took out the test stripe gcode which also removes any leaking filament before the start of the print.
    As you can see in the image above, I did leave in the skirt, which performed a similar function.
  2. I also took out the end gcode which moves the gantry out of the way and turns off the steppers. After running the test, the gantry was locked at the last point it was printing at (the rear right corner, as you can see in the image above).

So, I’m going to be a bit more maze bright when I try this for a second time and see if leaving in the pre and post gcode resolves these issues.

Honestly, it would be nice if I didn’t have to slice the .stls, edit them and then copy and paste them into the macros. Shouldn’t there be a way of defining the models and slicing them so that you end up with one size fits all? I know this isn’t possible for the bed mesh, but I would think it’s something that should be considered for the other models.

The heat tower you’ve selected is not very helpful. I would have liked to see something with some bridges so I can get a better idea of the print quality at each temperature level.

One last comment and this probably is in conflict with the previous suggestion I just made; every calibration test must run in less than 30 minutes and I’d even recommend having a goal of 15 minutes. As was noted in the other replies, running gcode like this from a macro is a bit unnerving as you can’t interrupt things if there is a problem except by hitting the Big Red Switch.

Sorry for the long post.

Hi Mykepredko,

Thank you for testing it out and providing feedback. I will do my best to correct these bugs and provide more information. :blush:

Allow me to address some of your points:

The START_TUNING_PRINT macro is also specific to my machine, and I have those LEDs. The best way would be to copy your specific START_PRINT and paste it into START_TUNING_PRINT, adjusting the parameters for the macro. Since every machine uses different START_MACROS, I could only provide my own as an example. I should have mentioned this, my apologies. But I am going to remove these lines as you suggested.

About the Flow_TEST, it uses the flow multiplier in %. I only use Cura as a slicer, and it uses percentages for flow. For the PA Tower, I followed Klipper’s documentation and used their recommended slicing settings and calculations to get the pressure advance value.

CALC stands for Calculator and is only used for Flow and Pressure Advance. It works as follows: Let’s say you’ve done a flow calibration test and measured the wall thickness to be, for example, 0.45mm. You can then type “flow” into TOOL and input CALC: 0.45, and you will get your new flow value as a text output. If CALC = 0, the flow test print would start. The same applies to pressure advance.

The CAZD statement is from Cura. I assume it’s used when you are employing the “ChangeatZ” function. If it’s a comment for the user or something Cura uses itself, I don’t know, but for the macro, it can be ignored.

When I think about it, I could use very basic pre and post G-code that should work with every printer. All these calibration prints (except the PA Tower) are designed to have minimal G-code size. The validation pattern could be omitted since Klipper has the bed mesh visualizer.

I wish I could make it so the prints don’t have to be sliced for a specific machine. Unfortunately, my macro skills are very limited. It should be possible to add parameters for providing the XYZ coordinates of the prints and use relative moves to print, but it’s beyond my capabilities. So, it’s easier for me to slice, paste the G-code, and make a few changes.

It’s true that macros cannot be stopped, but in my opinion, it’s not much of an issue. After all, many macros execute moves, such as bed mesh leveling, and they can’t be canceled either.

I hope what I wrote makes sense; my brain is kind of melting, as English isn’t my native language. I’m going to fix those bugs, make some changes to make it more user-friendly, and add a ton of documentation. It will take a while, so please be patient with me. :blush:

1 Like

UPDATE:

Based on user feedback:

  • Fixed some bugs,
  • Added slicer settings information in the .cfg’s
  • Added a lengthy, in depth redme.txt where (hopefully) everything is explained
  • Removed the validation pattern and instead added a retraction test print.
  • Simplifies START_TUNING_PRINT and END_TUNING_PRINT

Calibration_Prints.zip (381.4 KB)

Please put updates always to your newest post.
Scrolling up and down can be quite tedious.
Also: In your newest post, supporters can be sure that the info is new too.

1 Like

Another Update:

So I found out that the TUNING_TOWER command can do more, so I used it on the heat test print and retraction test print too. Giving much more flexibility at the range and at what rate you want to print your test prints. Also, it means much less fiddling around with the g-code to make it work with the macro. And with the help of [firmware retraction], you can now set the retraction test print start value and the factor by which it should be changed for each segment.
I also forgot that you should print the pressure-advanced print after figuring out your correct flow. So now I added a FLOW parameter using the M221 command. As long as the g-code gets sliced with 100% flow, it should work fine.

UPDATE II:

  • Fixed some more bugs
  • changed the flow calibration print and its .stl, because the first one was flawed
  • added the TUNING_TOWER command to heat- pressure advanced- and retraction-calibration, making it easier when it comes to adjusting the sliced g-code for the prints and gives more flexibility with the parameters.
  • added FLOW parameter.

Note: For the flow parameter to work correctly, slice the g-code for those prints at 100% flow.
In order for the Macro to work correctly, you need to use [firmware retraction]

Calibration_Prints.zip (250.4 KB)