Removal of Filament Diameter Check#7250
Conversation
Recently, nozzles thicker than the standard filament diameter (1.75 mm) have become available and are being used. The diameter check causes issues where the printer cannot print when a thicker nozzle is installed.
|
Thank you for your contribution to Klipper. Unfortunately, a reviewer has not assigned themselves to this GitHub Pull Request. All Pull Requests are reviewed before merging, and a reviewer will need to volunteer. Further information is available at: https://www.klipper3d.org/CONTRIBUTING.html There are some steps that you can take now:
Unfortunately, if a reviewer does not assign themselves to this GitHub Pull Request then it will be automatically closed. If this happens, then it is a good idea to move further discussion to the Klipper Discourse server. Reviewers can reach out on that forum to let you know if they are interested and when they are available. Best regards, PS: I'm just an automated script, not a human being. |
dewi-ny-je
left a comment
There was a problem hiding this comment.
The change makes sense given modern nozzles, surely better than hacking the filament diameter in the config to make them work.
Main issue — unguarded division by zero / negative area
With no constraint, filament_diameter can now be 0 or negative. Look at what consumes it immediately after:
self.filament_area = math.pi * (filament_diameter * .5)**2 # → 0.0 if diameter is 0
def_max_extrude_ratio = def_max_cross_section / self.filament_area # ZeroDivisionError
...
self.max_extrude_ratio = max_cross_section / self.filament_area # ZeroDivisionErrorfilament_diameter = 0→filament_area = 0→ZeroDivisionErrorat startup with an opaque traceback instead of a clean config error.- A negative value → squared away into a positive area silently, masking a typo.
The old minval=self.nozzle_diameter implicitly guaranteed a positive diameter (since nozzle_diameter is already above=0.). Removing it drops that protection too.
Recommended change
Keep a lower bound that prevents the degenerate cases but allows nozzle > filament:
filament_diameter = config.getfloat('filament_diameter', above=0.)This preserves the author's intent (no longer tied to nozzle diameter) while keeping Klipper's usual "clean config error, not a Python traceback" behavior.
Secondary observations
- Lost typo protection. The original check also caught the common mistake of swapping the
nozzle_diameterandfilament_diametervalues. That safety net is gone. Acceptable given the goal, but worth a one-line note;above=0.at least catches the worst cases. - No documentation update. If
docs/Config_Reference.md(or config examples) documents this constraint, it should be updated to match. - Commit/PR hygiene. Single focused commit, clear title — good. Klipper requires a
Signed-off-byline per its contribution guidelines; confirm that's present.
|
Thank you for your review. I agree with your point, so I’ve made the correction. |
Have you added the Signed-off line with real name and email? |
|
Is this necessary? Where and how do I add it? |
I think that editing the first post of this discussion is enough. Someone proposed relaxing the requirement "real name" so if it's a problem for you you can wait. |
|
I've added my name to the first comment. Thank you for your cooperation. |
Recently, nozzles thicker(2.0mm etc) than the standard filament diameter (1.75 mm) have become available and are being used. The diameter check causes issues where the printer cannot print when a thicker nozzle is installed.
https://shop.kaika-tecdia.com/blog/2021/12/24/134114
Signed-off-by: Noriaki Tambo gear2nd.droid@gmail.com