Perform up to maximumBowdenLength while unloading to FINDA

+ update unit tests to match the changed implementation
pull/290/head
D.R.racer 2023-08-10 09:10:02 +02:00 committed by DRracer
parent 19aa7ce2c7
commit 0419bdefd7
3 changed files with 14 additions and 7 deletions

View File

@ -91,13 +91,13 @@ static constexpr U_mm cuttingEdgeToFindaMidpoint = 22.85_mm; /// Cutting edge to
static constexpr U_mm findaToCoupler = 12.0_mm; /// FINDA Coupler side to coupler screw.
static constexpr U_mm couplerToBowden = 3.5_mm; /// FINDA Coupler screw to bowden mmu2s side (in coupling).
// @@TODO this is very tricky - the same MMU, same PTFE,
// just another piece of PLA (probably having more resistance in the tubes)
// and we are at least 40mm off! It looks like this really depends on the exact position
// We'll probably need to check for StallGuard while pushing the filament to avoid ginding the filament
// Min, max and default bowden length setup
static constexpr U_mm defaultBowdenLength = 360.0_mm; /// ~360.0_mm - Default Bowden length.
static constexpr U_mm minimumBowdenLength = 341.0_mm; /// ~341.0_mm - Minimum bowden length.
static constexpr U_mm maximumBowdenLength = 792.0_mm; /// ~792.0_mm - Maximum bowden length.
static_assert(minimumBowdenLength.v <= defaultBowdenLength.v);
static_assert(maximumBowdenLength.v > defaultBowdenLength.v);
static constexpr U_mm feedToFinda = cuttingEdgeToFindaMidpoint + filamentMinLoadedToMMU;
static constexpr U_mm maximumFeedToFinda = feedToFinda + 20.0_mm; ///< allow for some safety margin to load to FINDA
static constexpr U_mm pulleyHelperMove = 10.0_mm; ///< Helper move for Load/Unload error states - when the MMU should slowly move the filament a bit

View File

@ -39,7 +39,13 @@ bool UnloadToFinda::Step() {
state = WaitingForFINDA;
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
unloadStart_mm = mpu::pulley.CurrentPosition_mm();
mpu::pulley.PlanMove(-config::defaultBowdenLength - config::feedToFinda - config::filamentMinLoadedToMMU, mg::globals.PulleyUnloadFeedrate_mm_s());
// We can always plan the unload move for the maximum allowed bowden length,
// it should be even more reliable than doing just the specified bowden length:
// - if the filament is slipping for some reason, planning a longer move will not stop in the middle of the bowden tube
// - a faster unload (shorter than the specified bowden length) will be interrupted by FINDA turning off
// - if FINDA is misaligned or faulty, the only issue will be, that the filament will be thrown behind the pulley
// which could have happened with the previous implementation as well, because default bowden length was set to 42cm
mpu::pulley.PlanMove(-config::maximumBowdenLength - config::feedToFinda - config::filamentMinLoadedToMMU, mg::globals.PulleyUnloadFeedrate_mm_s());
}
return false;
case WaitingForFINDA: {

View File

@ -111,7 +111,8 @@ TEST_CASE("unload_to_finda::unload_without_FINDA_trigger", "[unload_to_finda]")
// no changes to FINDA during unload - we'll pretend it never triggers
// but set FSensor correctly
REQUIRE_FALSE(WhileCondition(ff, std::bind(SimulateUnloadToFINDA, _1, 10, 150000), 50000));
uint32_t unlSteps = 10 + mm::unitToSteps<mm::P_pos_t>(config::maximumBowdenLength + config::feedToFinda + config::filamentMinLoadedToMMU);
REQUIRE_FALSE(WhileCondition(ff, std::bind(SimulateUnloadToFINDA, _1, 10, 150000), unlSteps));
REQUIRE(ff.State() == logic::UnloadToFinda::FailedFINDA);
REQUIRE(mg::globals.FilamentLoaded() == mg::FilamentLoadState::InSelector);
@ -195,7 +196,7 @@ TEST_CASE("unload_to_finda::unload_repeated", "[unload_to_finda]") {
// but set FSensor correctly
// In this case it is vital to correctly compute the amount of steps
// to make the unload state machine restart after the 1st attempt
uint32_t unlSteps = 1 + mm::unitToSteps<mm::P_pos_t>(config::defaultBowdenLength + config::feedToFinda + config::filamentMinLoadedToMMU);
uint32_t unlSteps = 1 + mm::unitToSteps<mm::P_pos_t>(config::maximumBowdenLength + config::feedToFinda + config::filamentMinLoadedToMMU);
REQUIRE_FALSE(WhileCondition(ff, std::bind(SimulateUnloadToFINDA, _1, 10, 150000), unlSteps));
main_loop();