Fix+verify Cut filament unit test

it now finished ok, but future tweaks and improvements are expected
pull/26/head
D.R.racer 2021-06-18 09:42:56 +02:00 committed by DRracer
parent ede475c5a6
commit 1f8934c2c1
3 changed files with 12 additions and 4 deletions

View File

@ -15,10 +15,11 @@ bool Idler::Disengage() {
if (state == Moving) if (state == Moving)
return false; return false;
plannedEngage = false;
if (!Engaged()) if (!Engaged())
return true; return true;
plannedEngage = false;
mm::motion.InitAxis(mm::Idler); mm::motion.InitAxis(mm::Idler);
// plan move to idle position // plan move to idle position
// mm::motion.PlanMove(0, idle_position, 0, 1000, 0, 0); // @@TODO // mm::motion.PlanMove(0, idle_position, 0, 1000, 0, 0); // @@TODO
@ -30,11 +31,12 @@ bool Idler::Engage(uint8_t slot) {
if (state == Moving) if (state == Moving)
return false; return false;
plannedSlot = slot;
plannedEngage = true;
if (Engaged()) if (Engaged())
return true; return true;
plannedSlot = slot;
plannedEngage = true;
mm::motion.InitAxis(mm::Idler); mm::motion.InitAxis(mm::Idler);
// mm::motion.PlanMove(0, slotPositions[slot], 0, 1000, 0, 0); // @@TODO // mm::motion.PlanMove(0, slotPositions[slot], 0, 1000, 0, 0); // @@TODO
state = Moving; state = Moving;

View File

@ -15,10 +15,11 @@ bool Selector::MoveToSlot(uint8_t slot) {
if (state == Moving) if (state == Moving)
return false; return false;
plannedSlot = slot;
if (currentSlot == slot) if (currentSlot == slot)
return true; return true;
plannedSlot = slot;
mm::motion.InitAxis(mm::Selector); mm::motion.InitAxis(mm::Selector);
// mm::motion.PlanMove(1, slotPositions[slot], 0, 1000, 0, 0); // @@TODO // mm::motion.PlanMove(1, slotPositions[slot], 0, 1000, 0, 0); // @@TODO
state = Moving; state = Moving;

View File

@ -49,10 +49,15 @@ TEST_CASE("cut_filament::cut0", "[cut_filament]") {
// idler and selector reached their target positions and the CF automaton will start feeding to FINDA as the next step // idler and selector reached their target positions and the CF automaton will start feeding to FINDA as the next step
REQUIRE(cf.State() == ProgressCode::FeedingToFinda); REQUIRE(cf.State() == ProgressCode::FeedingToFinda);
// prepare for simulated finda trigger
hal::adc::ReinitADC(1, hal::adc::TADCData({ 0, 0, 0, 0, 600, 700, 800, 900 }), 10);
REQUIRE(WhileCondition([&]() { return cf.State() == ProgressCode::FeedingToFinda; }, 50000)); REQUIRE(WhileCondition([&]() { return cf.State() == ProgressCode::FeedingToFinda; }, 50000));
// filament fed into FINDA, cutting... // filament fed into FINDA, cutting...
REQUIRE(cf.State() == ProgressCode::PreparingBlade); REQUIRE(cf.State() == ProgressCode::PreparingBlade);
REQUIRE(WhileCondition([&]() { return cf.State() == ProgressCode::PreparingBlade; }, 5000));
REQUIRE(cf.State() == ProgressCode::EngagingIdler);
REQUIRE(WhileCondition([&]() { return cf.State() == ProgressCode::EngagingIdler; }, 5000)); REQUIRE(WhileCondition([&]() { return cf.State() == ProgressCode::EngagingIdler; }, 5000));
// the idler should be at the active slot @@TODO // the idler should be at the active slot @@TODO