Fix unit test load_fail_FINDA_resolve_btnM

- If FINDA was not pressed, filament load state should be
AtPulley
- When a user presses the middle button, the pulley motor should be enabled =>feeding started
pull/249/head
Guðni Már Gilbert 2022-12-11 15:08:26 +00:00
parent 26be20e9aa
commit 7e2528d675
2 changed files with 8 additions and 4 deletions

View File

@ -53,7 +53,6 @@ bool FeedToFinda::Step() {
// one move has already been planned above, this is the second one
mpu::pulley.PlanMove(config::maximumFeedToFinda, config::pulleySlowFeedrate);
}
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
mui::userInput.Clear(); // remove all buffered events if any just before we wait for some input
}
return false;
@ -77,7 +76,9 @@ bool FeedToFinda::Step() {
if (mf::finda.Pressed() || mui::userInput.AnyEvent()) {
mm::motion.AbortPlannedMoves(haltAtEnd); // stop pushing filament
// FINDA triggered - that means it works and detected the filament tip
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
if (mf::finda.Pressed()) {
mg::globals.SetFilamentLoaded(mg::globals.ActiveSlot(), mg::FilamentLoadState::InSelector);
}
dbg_logic_P(PSTR("Feed to Finda --> Idler disengaged"));
dbg_logic_fP(PSTR("Pulley end steps %u"), mpu::pulley.CurrentPosition_mm());
state = mui::userInput.AnyEvent() ? Stopped : OK;

View File

@ -207,7 +207,7 @@ void ToolChangeFailLoadToFinda(logic::ToolChange &tc, uint8_t fromSlot, uint8_t
REQUIRE(WhileTopState(tc, ProgressCode::FeedingToFinda, 50000UL));
// should end up in error disengage idler
REQUIRE(VerifyState(tc, mg::FilamentLoadState::InSelector, toSlot, toSlot, false, true, ml::off, ml::blink0, ErrorCode::RUNNING, ProgressCode::ERRDisengagingIdler));
REQUIRE(VerifyState(tc, mg::FilamentLoadState::AtPulley, toSlot, toSlot, false, true, ml::off, ml::blink0, ErrorCode::RUNNING, ProgressCode::ERRDisengagingIdler));
SimulateErrDisengagingIdler(tc, ErrorCode::FINDA_DIDNT_SWITCH_ON);
}
@ -242,13 +242,16 @@ void ToolChangeFailLoadToFindaLeftBtn(logic::ToolChange &tc, uint8_t toSlot) {
void ToolChangeFailLoadToFindaMiddleBtn(logic::ToolChange &tc, uint8_t toSlot) {
// now waiting for user input
REQUIRE_FALSE(mui::userInput.AnyEvent());
REQUIRE(VerifyState(tc, mg::FilamentLoadState::AtPulley, mi::idler.IdleSlotIndex(), toSlot, false, false, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRWaitingForUser));
PressButtonAndDebounce(tc, mb::Middle, true);
REQUIRE_FALSE(mi::idler.HomingValid());
REQUIRE_FALSE(ms::selector.HomingValid());
SimulateIdlerAndSelectorHoming(tc); // failed load to FINDA = nothing blocking the selector - it can rehome
REQUIRE(VerifyState(tc, mg::FilamentLoadState::AtPulley, mi::Idler::IdleSlotIndex(), toSlot, false, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToFinda));
REQUIRE(VerifyState(tc, mg::FilamentLoadState::AtPulley, mi::Idler::IdleSlotIndex(), toSlot, false, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToFinda));
ClearButtons(tc);