Hi *,
I’m sure I missed something very basic. But maybe you can help to see what I don’t see.
I’m currently implementing material profiles for Klipper. The profiles allowing a fast change of many settings depending on material type and vendor. It already supports many settings special menus and everything that is tested working great.
But I have one Problem:
I want to set max extrusion per second, with following constrains:
The limitation should not affect travel moves. (So just set velocity is no option)
I should be a limit not a scaling.
It could be nice if the limit does not influence retraction. (optional)
Eg: If i set a limitation of 12 mm³/s and a move should extrude with 15 mm³/s - x, y, z move will slow down to match the limitation of 12 mm³/s. Moves that are not extruding or that are extruding with ≤ 12 mm³/s should not be modified.
I don’t care much about units, I think I can convert them to or from whatever. Just really don’t know how to do and possibly missing the right wording for google.
Ofc: I could rewrite g0 and g1 for respecting this. But most likely it is totally unnecessary ^^
Ok, I’m not sure if I miss something but if as far I understand this issue, the wanted feature is not going to be implemented:
An extruder velocity limit would be sufficient in case. As the maximum velocity could be calculated by the maximum mm³/s and nozzle width. I can change it for retraction. But the only thing I find is extrude_only_velocity what not does what I want as far I understand.
So there is upcoming question:
If I change velocity for the complete move inside G0 and G1 will this have unwanted side effects? As far I understand this should be fine because velocity changes are quite normal… But I’m not aware of all constrains I think.
Not sure I completely understand your intention: Are you looking at implementing a maximum volumetric flow for each material and would like Klipper to respect these values and tune down speed if exceeded?
If so, there is no way to do this in Klipper currently to my knowledge. Klipper is only monitoring if extrusion stays within sane limits.
IMO this is also rather a slicer task than a printer firmware task
And of course you are right. But my profiles supports the most important features that should be changed if the material is changed. I think this is last one I really need to address. If this is done no reslicing for other materials are necessary any longer.
Maybe it will not reach the same quality as reslicing would do, but quit close to it. The slices do not do that much magic. (maybe this is depending on the material in some cases)
Do you know, if there are any constrains that will break the quality or the print if I’m going to modify G0, G1?
I think I would not touch the existing volumetric flow function instead I would do something like this (klipper orientated pseudocode):
[gcode_macro G1]
rename_existing: G1.1
if (E in params)
travel_distance = calc_travel_distance(X|default(0),Y|default(0),Z|default(0))
max_allowed_speed = calc_max_speed(max_flow, travel_distance)
if(params.F|default(printer.g_code_move.speed) > max_speed)
new_F = max_allowed_speed
else
new_F = F
endif
new_params = rewrite_params(X, Y, Z, E, new_F)
save_speed()
G1.1 new_params
restore_speed()
else
G1.1 rawparams
endif
This would at least not be called for every single line of code, but instead only if G1/G0 is called. The calculations have a sqare_root, but I think this should not be a problem in terms of speed.
Uhh this is a nice idea for a hack It could be possible to set the nozzle diameter mega small too have this limits. At least if the monitoring will lower the speed instead of exit with an error.
Can you point out the source code file, so I can read how it is implemented?
It is really a top performance to answer on that many requests. Thanks for all your effort Sineos!
Thanks for your help, I could solve the issue by implement the missing functionality directly into klipper. It was really important to know and understand the current state. So your answer was really helpfully as they are often!
For all that searching for a solution, here it is, but I really hope that the pull request will be accepted, so it possibly to contribute more code depending on it without having a custom version of Klipper:
I triple checked everything I could and tested as much as it was possible on a single printer, so it seems safe. But if you also test it please leave a message here or on GitHub and tell me and others how it goes. A message like: “tested and printing fine” seems to be enough for a positive result. You can set a very small limit while printing and see if the printer slows down.
E.g.:
SET_MAX_EXTRUDER_VELOCITY EXTRUDER=extruder EXTRUDER_VELOCITY=1
Details can be found here:
I’m using this patch now for one year on three printers, without issues.
Personally I consider the patch as stable, and I think it is safe to use. I update the fork to the latest version from time to time to the latest version.