Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable bowden correction for unload moves #621

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions extras/mmu/mmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -4210,8 +4210,7 @@ def _load_bowden(self, length=None, start_pos=0.):
for i in range(2):
if delta >= self.bowden_allowable_load_delta:
msg = "Correction load move #%d into bowden" % (i+1)
_,_,_,d = self.trace_filament_move(msg, delta, track=True)
delta = d
_,_,_,delta = self.trace_filament_move(msg, delta, track=True)
self.log_debug("Correction load move was necessary, encoder now measures %.1fmm" % self.get_encoder_distance())
else:
self.log_debug("Correction load complete, delta %.1fmm is less than 'bowden_allowable_unload_delta' (%.1fmm)" % (delta, self.bowden_allowable_load_delta))
Expand Down Expand Up @@ -4285,8 +4284,22 @@ def _unload_bowden(self, length=None):
# Encoder based validation test
if self._can_use_encoder() and delta >= self.bowden_allowable_unload_delta and not self.calibrating:
ratio = 0.
# Only a warning because _unload_gate() will deal with it
self.log_info("Warning: Excess slippage was detected in bowden tube unload. Gear moved %.1fmm, Encoder measured %.1fmm" % (length, length - delta))
# Check and attempt correction if bowden_apply_correction is enabled
if self.bowden_apply_correction:
self.log_debug("Checking if correction move is needed on unload bowden")
for i in range(2):
if delta >= self.bowden_allowable_unload_delta:
msg = "Correction unload move #%d from bowden" % (i + 1)
# Move "backwards" by delta since we still haven't offloaded enough
_, _, _, delta = self.trace_filament_move(msg, -delta, track=True)
self.log_debug("Correction unload move was necessary, encoder now measures %.1fmm" % self.get_encoder_distance())
else:
self.log_debug("Correction unload complete, delta %.1fmm is less than 'bowden_allowable_unload_delta' (%.1fmm)" % (delta, self.bowden_allowable_unload_delta))
break
if delta >= self.bowden_allowable_unload_delta:
self.log_info("Warning: Excess slippage was detected in bowden tube unload after correction moves. Gear moved %.1fmm, Encoder measured %.1fmm. See mmu.log for more details" % (length, length - delta))
else:
self.log_info("Warning: Excess slippage was detected in bowden tube unload but 'bowden_apply_correction' is disabled. Gear moved %.1fmm, Encoder measured %.1fmm. See mmu.log for more details" % (length, length - delta))

self._random_failure() # Testing
self.movequeues_wait()
Expand Down