From bf9fec694193761817ff95d134fe06163873ee5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sun, 11 Dec 2022 15:15:16 +0000 Subject: [PATCH] Fix unit test load_fail_FINDA_resolve_btnL If helping the filament triggers FINDA we should set loading state to InSelector --- src/logic/tool_change.cpp | 1 + tests/unit/logic/tool_change/test_tool_change.cpp | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/logic/tool_change.cpp b/src/logic/tool_change.cpp index ba6ad15..f108905 100644 --- a/src/logic/tool_change.cpp +++ b/src/logic/tool_change.cpp @@ -200,6 +200,7 @@ bool ToolChange::StepInner() { // @@TODO helping filament needs improvement - the filament should try to move forward as long as the button is pressed if (mf::finda.Pressed()) { // the help was enough to press the FINDA, we are ok, continue normally + mg::globals.SetFilamentLoaded(plannedSlot, mg::FilamentLoadState::InSelector); GoToFeedingToBondtech(); } else if (mfs::fsensor.Pressed()) { // the help was enough to press the filament sensor, we are ok, continue normally diff --git a/tests/unit/logic/tool_change/test_tool_change.cpp b/tests/unit/logic/tool_change/test_tool_change.cpp index 1eadd30..25cfe93 100644 --- a/tests/unit/logic/tool_change/test_tool_change.cpp +++ b/tests/unit/logic/tool_change/test_tool_change.cpp @@ -215,12 +215,15 @@ void ToolChangeFailLoadToFinda(logic::ToolChange &tc, uint8_t fromSlot, uint8_t void ToolChangeFailLoadToFindaLeftBtn(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::Left, true); REQUIRE(WhileTopState(tc, ProgressCode::ERREngagingIdler, 5000UL)); ClearButtons(tc); - REQUIRE(VerifyState(tc, mg::FilamentLoadState::InSelector, toSlot, toSlot, false, true, ml::off, ml::blink0, ErrorCode::RUNNING, ProgressCode::ERRHelpingFilament)); + REQUIRE(VerifyState(tc, mg::FilamentLoadState::AtPulley, toSlot, toSlot, false, true, ml::off, ml::blink0, ErrorCode::RUNNING, ProgressCode::ERRHelpingFilament)); // try push more, if FINDA triggers, continue loading REQUIRE(WhileCondition(