Filament ramming and z improvements #1760
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR combines a fix for #1095 and #1748 due to space requirements (FIY this PR will also make room for PR #1759 and #1758). Please let me know if you whish to split this further.
First, we replace the filament unloading procedure with the mmu_filament_ramming() code to fix #1095.
If ramming is good enough for the mmu2, well, it must be good enough for plain unloading ;).
I didn't touch the custom filament unload procedure which is triggered by the filament runout, because that sequence could be triggered also by a clogged extruder and ramming the clog might not be a good idea. Ramming will thus be done for the Menu -> unload filament, for M702 and M600. I tested all cases with PLA and PETG.
I introduce a new function, raise_z_above to move Z carefully when the current position is potentially unknown, using stallguard. The following conditions will now use raise_z_above:
during filament loading/unloading, for blob clearance. This was already done during loading, but now it's also done while unloading, since the ramming will extrude a little bit.
extruder spacing when preheating. This is done to avoid buildplate marks on the PEI sheet, which is something I have, as I often preheat from the menu and sometimes come back late.
before homing to avoid scratching the build plate. Again, this was already done, but badly (see Z raised above maximum when issuing "G28" (autohome) or filament autoload from maximum height #1748).
In the original sequence, G28 will raise, home XY, then raise again unconditionally. If the printer was already at max height, then reset, then a G28 is issued, the carriage is essentially crashed twice against the Z tops.
We now use raise_z_above before homing XY, and during home Z. raise_z_above is a no-op if the position is already above the target, which means that no move is ever issued if current position is already beyond the target. This results in G28 in a single raising move, which is faster to booth. If Z was already raised by a preheat or filament loading sequence, then there won't be any Z movement.
As a plus, stallguard is used when the position is unknown, making raise_z_above useful in all cases when Z is unknown (basically, all the above). raise_z_above will move the axis carefully and set the current position to max_height if the endpoint is hit. This will effectively prevent/fix #1748.
Note that #1748 will happen during regular printing too: if a tall print is completed and leaves the extruder at maximum height, a G28 issued by a subsequent print will currently crash the axis. A simple check is not enough: if the printer is reset while the extruder is at maximum height, then both homing and filament unloading will crash the axis.