Makro with variables
-
Not sure if this is possible at all and how much sense it makes. When I calibrate my Z so that at 0.00 the nozzle touches the bed, this gives me a fairly reliable fixpoint. So now i know for example, that with Fillamentum PLA i want an offset of 0.04mm and with PETG even some more. I can just do makros for the materials and put g31 Z2.64 or whatever, so i got a macro for pla, one for petg and maybe for other materials or printsheets.
However, i would like the Z value which in CaribouDuet is being saved in the config.override, to remain unchanged after calibrating it to touch the bed at 0.00
Is there a way to make a makro which sets the offset to the saved G31 Z height plus or minus a fix material value? So in the case of PLA "set height to G31 plus 0.04mm for the next print". Kind of like an automated babysteps. And can I then call this macro in Prusaslicer in the custom gcode for the filament?
-
-
@suntoxx one option would be to use the M290 command to set babystepping.
-
What you want is possible, but I'm a bit confused why you would not just set a different first layer height in your slicer's filament profile for each type?
The nozzle offset is more or less a constant, so in my mind should represent the true value. -
@schild0r said in Makro with variables:
@suntoxx I am not 100% sure if I understood everything correctly but you could just use the filament logic of RRF to set for example z offsets on a per filament basis in the config.g file of the respective filament (see filaments) and then put M703 in your start gcode before homing
That looks interesting. So I would just put the offset into that empty filament config.g. That is nice and easy. But that would limit me to one offset per material type, right?
Isn't that a bit too little? I haven't tried that many filaments yet, so I do not know for sure. But is the optimal offset for all PLAs the same? Regular PLA, matte, silk, PLA that prints at 195°C and PLA that prints at 230°?
@dc42 said in Makro with variables:
@suntoxx one option would be to use the M290 command to set babystepping.
That would work, but seems to have some disadvantages. Whenever I load an older project file into the slicer, I would have to make sure I don't forget to revert the filament custom gcode to the new standard. And it also saves the offset right into the compiled gcode. So all future .gcode files have it imprinted, even if I changed my mind about the offset by then. It seems calling a macro could be more practical. Plus if I want to change a value, I have to do so for each corresponding material in each slicer. I would probably make a mess this way.
@owend said in Makro with variables:
What you want is possible, but I'm a bit confused why you would not just set a different first layer height in your slicer's filament profile for each type?
The nozzle offset is more or less a constant, so in my mind should represent the true value.I think a macro would be more comfortable. If I change an offset value for a material, I could do so in one central place and it affacts all the profiles i want and in all slicers. Plus it would also affect already compiled .gcode files, as long as they already call for that macro. At least in theory, that looks good to me.
What's the best way to do this? I can create a macro for each material, which calls for the M290 command that dc42 suggested and then add a line of custom gcode to every filament profile, that calls for the corresponding macro? Or could i even do this with a single macro and else if statements, so that the desired offset gets chosen automatically, depending on the name of the filament profile that was active while slicing?
-
@suntoxx you can create as many filament configs as you want, they just need different names (e.g. pla, blue_pla, red_pla, red_pla_brand_B etc).
-
@suntoxx said in Makro with variables:
Isn't that a bit too little? I haven't tried that many filaments yet, so I do not know for sure. But is the optimal offset for all PLAs the same? Regular PLA, matte, silk, PLA that prints at 195°C and PLA that prints at 230°?
I am using one single z offset globaly and this works fine for me... but as engikeneer said, you could just create a filament profile for every roll of filament you buy.
@suntoxx said in Makro with variables:
I think a macro would be more comfortable. If I change an offset value for a material, I could do so in one central place and it affacts all the profiles i want and in all slicers. Plus it would also affect already compiled .gcode files, as long as they already call for that macro. At least in theory, that looks good to me.
What's the best way to do this?Just put the offset (whether it is babystepping or just the trigger offset of your probe/endstop) into the config file of each filament. As long as you then call M703 somewhere in your start gcode, the firmware will always run the config file of the filament that (it thinks) is loaded.
e.G. That way you could also put your printing temperatures in the config file of the filament and just use a single "default" filament in your slicer with generic temperature values. Then when your print starts and calls M703, the filament config with your offset and temperatures (and PID tunes and fan curves and and pressure advance tunes .etc for that filament) will be loaded.
-
I would have to create those filament configs on the printer and create new materials in the slicers, so that i can select the according filament in the slicer that calls for the according config?
-
It would select the filament config profile, according to the selected option in the "Filament Type" drop down menu in Prusaslicer in the active Filament profile, for example?
-
So i would have to have, eg pla_silk or pla_blue or whatever, as an option in that filament type drop down menu, in the filament profiles in Prusaslicer?
-
@suntoxx you select the filament that you have loaded with a dropdown in DWC. That way it is not at all embedded in the gcode file s9 you can use the same file for multiple different filaments
-
@engikeneer said in Makro with variables:
@suntoxx you select the filament that you have loaded with a dropdown in DWC. That way it is not at all embedded in the gcode file s9 you can use the same file for multiple different filaments
...the same * Slicer Filament Setting * for multiple different filaments.
As long as you set everything (temperatures, fan speeds, offsets,...) in the RRF filament config. You only need to call M703 for that to apply (regardless of the filament that is being loaded)
@sunToxx you can edit a comment btw
-
@engikeneer said in Makro with variables:
@suntoxx you select the filament that you have loaded with a dropdown in DWC. That way it is not at all embedded in the gcode file s9 you can use the same file for multiple different filaments
Where do I find this dropdown menu in duet web control? I only know the one in Prusaslicer Filament settings, as part of the selected filament profile. In dwc I only have a filament section, where i can edit the configs it seems. Do i need a different version or a plugin? This setting would override any slicer selected filament type selection?
@schild0r said in Makro with variables:
@engikeneer said in Makro with variables:
@suntoxx you select the filament that you have loaded with a dropdown in DWC. That way it is not at all embedded in the gcode file s9 you can use the same file for multiple different filaments
...the same * Slicer Filament Setting * for multiple different filaments.
As long as you set everything (temperatures, fan speeds, offsets,...) in the RRF filament config. You only need to call M703 for that to apply (regardless of the filament that is being loaded)
@sunToxx you can edit a comment btw
Sorry, will do
This is a bit confusing for a beginner. M703 says it applies the configuration of the currently loaded (as far as the printer knows) filament. So off course it doenst matter which filament is currently in the extruder, but it does matter what filament is loaded according to the software and it applies the config of the according filament that is listed in the filaments section of dwc? So I don't quite understand why you say "regardless of the filament being loaded".
-
@suntoxx it is in the dashboard right below the name of the tool. There should be a button "load filament" and if you click it, it should give you a selection of all the filaments you have created in the firmware.
So not in the left toolbar but where you would change your tool temperature manually at any time
For me it says PLA because it is currently loaded.
You can also load/unload filaments via gcodes M701 S"filamentname" and M702 and it will update this in DWC as well -
@schild0r Oh, I missed that one, thanks! This seems to trigger a macro, which is not in my macro folder. That must be the filament specific macro in the load.g and unload.g files of the filament.
So I have to trigger the unload/change filament in DWC and can then continue the process on the printer display, or type for example
M702 and then M701 S"Pla_Silk"
directly into the printer display?So if I always use this method to change my filaments, it always knows what filament is active (also after power off) and it will always override all slicer settings that might collide with the filament settings in the filament's config.g?
This is nice!
So I could also create macros in the main macro folder with for example, M702, M701 S"Pla" or M701 S"PETG" to quickly change between my most used filaments, without using dwc or typing gcodes? As it appears that the first 4 of them are displayed on the duet display.
I can just put the M703 command at the end of the regular custom Caribou Start gcode script for prusaslicer?
-
@schild0r I have tried it out and it seems to work, except for the fact that he applies the M290 Z0.08 i entered into the PETG config.g two times. Once shortly after he starts, before he probes the middle and then once more after creating the heightmap, right when he starts doing the first layer. So he ends up with an 0.16 offset instead of 0.08.
Any idea what's going on there? I removed the m290 custom gcode from the filament section in prusaslicer and sliced the file again. I checked the sliced gcode, there are no m290 commands in there. The m703 command is in there 2 times, once at the start and once in the prusaslicer config section at the end.
I just use half the value for now, but that is probably not the way to go.
-
@suntoxx said in Makro with variables:
I have tried it out and it seems to work, except for the fact that he applies the M290 Z0.08 i entered into the PETG config.g two times. Once shortly after he starts, before he probes the middle and then once more after creating the heightmap, right when he starts doing the first layer. So he ends up with an 0.16 offset instead of 0.08.
Use the R0 parameter in the M290 command to set absolute instead of relative babystepping.
-
@dc42 said in Makro with variables:
Use the R0 parameter in the M290 command to set absolute instead of relative babystepping.
I already printed with half the value, but this is much better and makes it perfect, thanks!
Thanks for the help @everyone, this is exactly what I have been looking for!
Could someone maybe post the code of a well filled filament config.g so i can look at it? I am specifically wondering how to set first layer and other layers temperature in a way that all slicers understand, as they seem to utilize differently named variables. That's already more than I aimed for, but I like the idea of having all my filament configuration in one place on the printer, a lot.