Introduce checking for enabled/disabled Pulley axis in unit tests

pull/126/head
D.R.racer 2021-09-29 08:17:19 +02:00 committed by DRracer
parent f18ff63cf7
commit 5cf4a496e3
17 changed files with 71 additions and 50 deletions

View File

@ -24,6 +24,7 @@ bool FeedToBondtech::Step() {
if (mi::idler.Engaged()) { if (mi::idler.Engaged()) {
dbg_logic_sprintf_P(PSTR("\nPulley start steps %u\n\n"), mm::motion.CurPosition(mm::Pulley)); dbg_logic_sprintf_P(PSTR("\nPulley start steps %u\n\n"), mm::motion.CurPosition(mm::Pulley));
state = PushingFilament; state = PushingFilament;
mm::motion.InitAxis(mm::Pulley);
mm::motion.PlanMove<mm::Pulley>(config::defaultBowdenLength, config::pulleyFeedrate); //@@TODO constants - there was some strange acceleration sequence in the original FW, mm::motion.PlanMove<mm::Pulley>(config::defaultBowdenLength, config::pulleyFeedrate); //@@TODO constants - there was some strange acceleration sequence in the original FW,
// we can probably hand over some array of constants for hand-tuned acceleration + leverage some smoothing in the stepper as well // we can probably hand over some array of constants for hand-tuned acceleration + leverage some smoothing in the stepper as well
} }
@ -45,6 +46,7 @@ bool FeedToBondtech::Step() {
dbg_logic_P(PSTR("\nFeed to Bondtech --> DisengagingIdler\n\n")); dbg_logic_P(PSTR("\nFeed to Bondtech --> DisengagingIdler\n\n"));
if (!mi::idler.Engaged()) { if (!mi::idler.Engaged()) {
state = OK; state = OK;
mm::motion.Disable(mm::Pulley);
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on);
} }
return false; return false;

View File

@ -7,6 +7,7 @@ namespace logic {
/// ///
/// Continuously feed filament until the printer detects the filament in its filament sensor. /// Continuously feed filament until the printer detects the filament in its filament sensor.
/// Disengages the Idler after finishing the feed. /// Disengages the Idler after finishing the feed.
/// Disables the Pulley axis after disengaging the idler.
struct FeedToBondtech { struct FeedToBondtech {
/// internal states of the state machine /// internal states of the state machine
enum { enum {

View File

@ -24,6 +24,7 @@ bool FeedToFinda::Step() {
case EngagingIdler: case EngagingIdler:
if (mi::idler.Engaged() && ms::selector.Slot() == mg::globals.ActiveSlot()) { if (mi::idler.Engaged() && ms::selector.Slot() == mg::globals.ActiveSlot()) {
state = PushingFilament; state = PushingFilament;
mm::motion.InitAxis(mm::Pulley);
mm::motion.PlanMove<mm::Pulley>(config::feedToFinda, config::pulleyFeedrate); mm::motion.PlanMove<mm::Pulley>(config::feedToFinda, config::pulleyFeedrate);
mui::userInput.Clear(); // remove all buffered events if any just before we wait for some input mui::userInput.Clear(); // remove all buffered events if any just before we wait for some input
} }

View File

@ -8,6 +8,7 @@ namespace logic {
/// Continuously feed filament until FINDA is not switched ON /// Continuously feed filament until FINDA is not switched ON
/// and than retract to align filament 600 steps away from FINDA. /// and than retract to align filament 600 steps away from FINDA.
/// Leaves the Idler engaged for chaining potential next operations. /// Leaves the Idler engaged for chaining potential next operations.
/// Leaves the Pulley axis enabled for chaining potential next operations
struct FeedToFinda { struct FeedToFinda {
/// internal states of the state machine /// internal states of the state machine
enum { enum {

View File

@ -70,6 +70,7 @@ bool LoadFilament::StepInner() {
error = ErrorCode::OK; error = ErrorCode::OK;
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::red, ml::off); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::red, ml::off);
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::on);
mm::motion.Disable(mm::Pulley);
mg::globals.SetFilamentLoaded(true); mg::globals.SetFilamentLoaded(true);
} }
break; break;

View File

@ -25,6 +25,7 @@ bool UnloadToFinda::Step() {
case EngagingIdler: case EngagingIdler:
if (mg::globals.FilamentLoaded()) { if (mg::globals.FilamentLoaded()) {
state = UnloadingToFinda; state = UnloadingToFinda;
mm::motion.InitAxis(mm::Pulley);
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::blink0); ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::blink0);
} else { } else {
state = Failed; state = Failed;

View File

@ -25,7 +25,7 @@ void CutSlot(logic::CutFilament &cf, uint8_t cutSlot) {
ForceReinitAllAutomata(); ForceReinitAllAutomata();
REQUIRE(VerifyEnvironmentState(false, mi::Idler::IdleSlotIndex(), 0, false, ml::off, ml::off)); REQUIRE(VerifyEnvironmentState(false, mi::Idler::IdleSlotIndex(), 0, false, false, ml::off, ml::off));
EnsureActiveSlotIndex(cutSlot); EnsureActiveSlotIndex(cutSlot);
@ -33,14 +33,14 @@ void CutSlot(logic::CutFilament &cf, uint8_t cutSlot) {
cf.Reset(cutSlot); cf.Reset(cutSlot);
// check initial conditions // check initial conditions
REQUIRE(VerifyState(cf, false, mi::Idler::IdleSlotIndex(), cutSlot, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::SelectingFilamentSlot)); REQUIRE(VerifyState(cf, false, mi::Idler::IdleSlotIndex(), cutSlot, false, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::SelectingFilamentSlot));
// now cycle at most some number of cycles (to be determined yet) and then verify, that the idler and selector reached their target positions // now cycle at most some number of cycles (to be determined yet) and then verify, that the idler and selector reached their target positions
// Beware - with the real positions of the selector, the number of steps needed to finish some states grows, so the ~40K steps here has a reason // Beware - with the real positions of the selector, the number of steps needed to finish some states grows, so the ~40K steps here has a reason
REQUIRE(WhileTopState(cf, ProgressCode::SelectingFilamentSlot, selectorMoveMaxSteps)); REQUIRE(WhileTopState(cf, ProgressCode::SelectingFilamentSlot, selectorMoveMaxSteps));
// 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(VerifyState(cf, false, cutSlot, cutSlot, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToFinda)); REQUIRE(VerifyState(cf, false, cutSlot, cutSlot, false, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToFinda));
// prepare for simulated finda trigger // prepare for simulated finda trigger
REQUIRE(WhileCondition( REQUIRE(WhileCondition(
@ -54,7 +54,7 @@ void CutSlot(logic::CutFilament &cf, uint8_t cutSlot) {
// filament fed to FINDA // filament fed to FINDA
//@@TODO filament loaded flag - decide whether the filament loaded flag means really loaded into the printer or just a piece of filament //@@TODO filament loaded flag - decide whether the filament loaded flag means really loaded into the printer or just a piece of filament
// stuck out of the pulley to prevent movement of the selector // stuck out of the pulley to prevent movement of the selector
REQUIRE(VerifyState(cf, /*true*/ false, cutSlot, cutSlot, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToPulley)); REQUIRE(VerifyState(cf, /*true*/ false, cutSlot, cutSlot, true, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToPulley));
// pull it back to the pulley + simulate FINDA depress // pull it back to the pulley + simulate FINDA depress
REQUIRE(WhileCondition( REQUIRE(WhileCondition(
@ -65,23 +65,23 @@ void CutSlot(logic::CutFilament &cf, uint8_t cutSlot) {
} }
return cf.TopLevelState() == ProgressCode::UnloadingToPulley; }, 5000)); return cf.TopLevelState() == ProgressCode::UnloadingToPulley; }, 5000));
REQUIRE(VerifyState(cf, /*true*/ false, cutSlot, cutSlot, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::PreparingBlade)); REQUIRE(VerifyState(cf, /*true*/ false, cutSlot, cutSlot, false, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::PreparingBlade));
// now move the selector aside, prepare for cutting // now move the selector aside, prepare for cutting
REQUIRE(WhileTopState(cf, ProgressCode::PreparingBlade, 5000)); REQUIRE(WhileTopState(cf, ProgressCode::PreparingBlade, 5000));
REQUIRE(VerifyState2(cf, /*true*/ false, cutSlot, cutSlot + 1, false, cutSlot, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::PushingFilament)); REQUIRE(VerifyState2(cf, /*true*/ false, cutSlot, cutSlot + 1, false, true, cutSlot, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::PushingFilament));
// pushing filament a bit for a cut // pushing filament a bit for a cut
REQUIRE(WhileTopState(cf, ProgressCode::PushingFilament, 5000)); REQUIRE(WhileTopState(cf, ProgressCode::PushingFilament, 5000));
REQUIRE(VerifyState2(cf, /*true*/ false, cutSlot, cutSlot + 1, false, cutSlot, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::PerformingCut)); REQUIRE(VerifyState2(cf, /*true*/ false, cutSlot, cutSlot + 1, false, true, cutSlot, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::PerformingCut));
// cutting // cutting
REQUIRE(WhileTopState(cf, ProgressCode::PerformingCut, selectorMoveMaxSteps)); REQUIRE(WhileTopState(cf, ProgressCode::PerformingCut, selectorMoveMaxSteps));
REQUIRE(VerifyState2(cf, /*true*/ false, cutSlot, 0, false, cutSlot, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::ReturningSelector)); REQUIRE(VerifyState2(cf, /*true*/ false, cutSlot, 0, false, true, cutSlot, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::ReturningSelector));
// moving selector to the other end of its axis // moving selector to the other end of its axis
REQUIRE(WhileTopState(cf, ProgressCode::ReturningSelector, selectorMoveMaxSteps)); REQUIRE(WhileTopState(cf, ProgressCode::ReturningSelector, selectorMoveMaxSteps));
REQUIRE(VerifyState2(cf, /*true*/ false, cutSlot, ms::Selector::IdleSlotIndex(), false, cutSlot, ml::blink0, ml::off, ErrorCode::OK, ProgressCode::OK)); REQUIRE(VerifyState2(cf, /*true*/ false, cutSlot, ms::Selector::IdleSlotIndex(), false, true, cutSlot, ml::blink0, ml::off, ErrorCode::OK, ProgressCode::OK));
} }
TEST_CASE("cut_filament::cut0", "[cut_filament]") { TEST_CASE("cut_filament::cut0", "[cut_filament]") {

View File

@ -49,12 +49,12 @@ void FailingIdler(hal::tmc2130::ErrorFlags ef, ErrorCode ec) {
logic::UnloadFilament uf; logic::UnloadFilament uf;
// verify startup conditions // verify startup conditions
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), 0, true, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), 0, true, false, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK));
// UnloadFilament starts by engaging the idler (through the UnloadToFinda state machine) // UnloadFilament starts by engaging the idler (through the UnloadToFinda state machine)
uf.Reset(0); uf.Reset(0);
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), 0, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), 0, true, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda));
int failingStep = 5; int failingStep = 5;
REQUIRE(WhileCondition( REQUIRE(WhileCondition(

View File

@ -48,6 +48,7 @@ TEST_CASE("feed_to_bondtech::feed_phase_unlimited", "[feed_to_bondtech]") {
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v); CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v);
CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v); CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v);
CHECK(mm::axes[mm::Pulley].enabled);
// idler engaged, selector in position, we'll start pushing filament // idler engaged, selector in position, we'll start pushing filament
REQUIRE(fb.State() == FeedToBondtech::PushingFilament); REQUIRE(fb.State() == FeedToBondtech::PushingFilament);
@ -74,6 +75,7 @@ TEST_CASE("feed_to_bondtech::feed_phase_unlimited", "[feed_to_bondtech]") {
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(5).v); CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(5).v);
CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v); CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v);
CHECK_FALSE(mm::axes[mm::Pulley].enabled);
// state machine finished ok, the green LED should be on // state machine finished ok, the green LED should be on
REQUIRE(fb.State() == FeedToBondtech::OK); REQUIRE(fb.State() == FeedToBondtech::OK);

View File

@ -38,7 +38,6 @@ TEST_CASE("feed_to_finda::feed_phase_unlimited", "[feed_to_finda]") {
// check if the idler and selector have the right command // check if the idler and selector have the right command
CHECK(mm::axes[mm::Idler].targetPos == mi::Idler::SlotPosition(0).v); CHECK(mm::axes[mm::Idler].targetPos == mi::Idler::SlotPosition(0).v);
CHECK(mm::axes[mm::Selector].targetPos == ms::Selector::SlotPosition(0).v); CHECK(mm::axes[mm::Selector].targetPos == ms::Selector::SlotPosition(0).v);
CHECK(mm::axes[mm::Idler].enabled == true);
// engaging idler // engaging idler
REQUIRE(WhileCondition( REQUIRE(WhileCondition(
@ -48,6 +47,7 @@ TEST_CASE("feed_to_finda::feed_phase_unlimited", "[feed_to_finda]") {
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v); CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v);
CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v); CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v);
CHECK(mm::axes[mm::Pulley].enabled == true);
// idler engaged, selector in position, we'll start pushing filament // idler engaged, selector in position, we'll start pushing filament
REQUIRE(ff.State() == FeedToFinda::PushingFilament); REQUIRE(ff.State() == FeedToFinda::PushingFilament);
@ -79,6 +79,7 @@ TEST_CASE("feed_to_finda::feed_phase_unlimited", "[feed_to_finda]") {
// CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(5).v); // @@TODO constants // CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(5).v); // @@TODO constants
CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v); CHECK(mm::axes[mm::Selector].pos == ms::Selector::SlotPosition(0).v);
CHECK(mm::axes[mm::Pulley].enabled == true);
// state machine finished ok, the green LED should be blinking // state machine finished ok, the green LED should be blinking
REQUIRE(ff.State() == FeedToFinda::OK); REQUIRE(ff.State() == FeedToFinda::OK);

View File

@ -1,5 +1,5 @@
bool VerifyEnvironmentState(bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t selectorSlotIndex, bool VerifyEnvironmentState(bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t selectorSlotIndex,
bool findaPressed, ml::Mode greenLEDMode, ml::Mode redLEDMode) { bool findaPressed, bool pulleyEnabled, ml::Mode greenLEDMode, ml::Mode redLEDMode) {
CHECKED_ELSE(mg::globals.FilamentLoaded() == filamentLoaded) { CHECKED_ELSE(mg::globals.FilamentLoaded() == filamentLoaded) {
return false; return false;
} }
@ -18,6 +18,9 @@ bool VerifyEnvironmentState(bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t
CHECKED_ELSE(mf::finda.Pressed() == findaPressed) { CHECKED_ELSE(mf::finda.Pressed() == findaPressed) {
return false; return false;
} }
CHECKED_ELSE(mm::PulleyEnabled() == pulleyEnabled){
return false;
}
for(uint8_t ledIndex = 0; ledIndex < config::toolCount; ++ledIndex){ for(uint8_t ledIndex = 0; ledIndex < config::toolCount; ++ledIndex){
if( ledIndex != selectorSlotIndex ){ if( ledIndex != selectorSlotIndex ){
@ -43,9 +46,9 @@ bool VerifyEnvironmentState(bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t
// LED checked at selector's index // LED checked at selector's index
template<typename SM> template<typename SM>
bool VerifyState(SM &uf, bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t selectorSlotIndex, bool VerifyState(SM &uf, bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t selectorSlotIndex,
bool findaPressed, ml::Mode greenLEDMode, ml::Mode redLEDMode, ErrorCode err, ProgressCode topLevelProgress) { bool findaPressed, bool pulleyEnabled, ml::Mode greenLEDMode, ml::Mode redLEDMode, ErrorCode err, ProgressCode topLevelProgress) {
VerifyEnvironmentState(filamentLoaded, idlerSlotIndex, selectorSlotIndex, findaPressed, greenLEDMode, redLEDMode); VerifyEnvironmentState(filamentLoaded, idlerSlotIndex, selectorSlotIndex, findaPressed, pulleyEnabled, greenLEDMode, redLEDMode);
CHECKED_ELSE(uf.Error() == err) { CHECKED_ELSE(uf.Error() == err) {
return false; return false;
@ -59,7 +62,7 @@ bool VerifyState(SM &uf, bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t se
// LED checked at their own ledCheckIndex index // LED checked at their own ledCheckIndex index
template<typename SM> template<typename SM>
bool VerifyState2(SM &uf, bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t selectorSlotIndex, bool VerifyState2(SM &uf, bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t selectorSlotIndex,
bool findaPressed, uint8_t ledCheckIndex, ml::Mode greenLEDMode, ml::Mode redLEDMode, ErrorCode err, ProgressCode topLevelProgress) { bool findaPressed, bool pulleyEnabled, uint8_t ledCheckIndex, ml::Mode greenLEDMode, ml::Mode redLEDMode, ErrorCode err, ProgressCode topLevelProgress) {
CHECKED_ELSE(mg::globals.FilamentLoaded() == filamentLoaded) { CHECKED_ELSE(mg::globals.FilamentLoaded() == filamentLoaded) {
return false; return false;
} }
@ -76,6 +79,9 @@ bool VerifyState2(SM &uf, bool filamentLoaded, uint8_t idlerSlotIndex, uint8_t s
CHECKED_ELSE(mf::finda.Pressed() == findaPressed) { CHECKED_ELSE(mf::finda.Pressed() == findaPressed) {
return false; return false;
} }
CHECKED_ELSE(mm::PulleyEnabled() == pulleyEnabled){
return false;
}
for(uint8_t ledIndex = 0; ledIndex < config::toolCount; ++ledIndex){ for(uint8_t ledIndex = 0; ledIndex < config::toolCount; ++ledIndex){
if( ledIndex != ledCheckIndex ){ if( ledIndex != ledCheckIndex ){
@ -111,10 +117,10 @@ template<typename SM>
void InvalidSlot(SM &logicSM, uint8_t activeSlot, uint8_t invSlot){ void InvalidSlot(SM &logicSM, uint8_t activeSlot, uint8_t invSlot){
ForceReinitAllAutomata(); ForceReinitAllAutomata();
REQUIRE(VerifyEnvironmentState(false, mi::Idler::IdleSlotIndex(), 0, false, ml::off, ml::off)); REQUIRE(VerifyEnvironmentState(false, mi::Idler::IdleSlotIndex(), 0, false, false, ml::off, ml::off));
EnsureActiveSlotIndex(activeSlot); EnsureActiveSlotIndex(activeSlot);
logicSM.Reset(invSlot); logicSM.Reset(invSlot);
REQUIRE(VerifyState(logicSM, false, mi::Idler::IdleSlotIndex(), activeSlot, false, ml::off, ml::off, ErrorCode::INVALID_TOOL, ProgressCode::OK)); REQUIRE(VerifyState(logicSM, false, mi::Idler::IdleSlotIndex(), activeSlot, false, false, ml::off, ml::off, ErrorCode::INVALID_TOOL, ProgressCode::OK));
} }

View File

@ -28,7 +28,7 @@ void LoadFilamentCommonSetup(uint8_t slot, logic::LoadFilament &lf) {
EnsureActiveSlotIndex(slot); EnsureActiveSlotIndex(slot);
// verify startup conditions // verify startup conditions
REQUIRE(VerifyState(lf, false, mi::Idler::IdleSlotIndex(), slot, false, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK)); REQUIRE(VerifyState(lf, false, mi::Idler::IdleSlotIndex(), slot, false, false, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK));
// restart the automaton // restart the automaton
lf.Reset(slot); lf.Reset(slot);
@ -39,11 +39,11 @@ void LoadFilamentCommonSetup(uint8_t slot, logic::LoadFilament &lf) {
// no change in selector's position // no change in selector's position
// FINDA off // FINDA off
// green LED should blink, red off // green LED should blink, red off
REQUIRE(VerifyState(lf, false, mi::Idler::IdleSlotIndex(), slot, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::EngagingIdler)); REQUIRE(VerifyState(lf, false, mi::Idler::IdleSlotIndex(), slot, false, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::EngagingIdler));
// Stage 1 - engaging idler // Stage 1 - engaging idler
REQUIRE(WhileTopState(lf, ProgressCode::EngagingIdler, idlerEngageDisengageMaxSteps)); REQUIRE(WhileTopState(lf, ProgressCode::EngagingIdler, idlerEngageDisengageMaxSteps));
REQUIRE(VerifyState(lf, false, slot, slot, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToFinda)); REQUIRE(VerifyState(lf, false, slot, slot, false, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToFinda));
} }
void LoadFilamentSuccessful(uint8_t slot, logic::LoadFilament &lf) { void LoadFilamentSuccessful(uint8_t slot, logic::LoadFilament &lf) {
@ -57,7 +57,7 @@ void LoadFilamentSuccessful(uint8_t slot, logic::LoadFilament &lf) {
} }
return lf.TopLevelState() == ProgressCode::FeedingToFinda; }, return lf.TopLevelState() == ProgressCode::FeedingToFinda; },
5000)); 5000));
REQUIRE(VerifyState(lf, false, slot, slot, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::RetractingFromFinda)); REQUIRE(VerifyState(lf, false, slot, slot, true, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::RetractingFromFinda));
// Stage 3 - retracting from finda // Stage 3 - retracting from finda
// we'll assume the finda is working correctly here // we'll assume the finda is working correctly here
@ -69,11 +69,11 @@ void LoadFilamentSuccessful(uint8_t slot, logic::LoadFilament &lf) {
} }
return lf.TopLevelState() == ProgressCode::RetractingFromFinda; }, return lf.TopLevelState() == ProgressCode::RetractingFromFinda; },
5000)); 5000));
REQUIRE(VerifyState(lf, false, slot, slot, false, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::DisengagingIdler)); REQUIRE(VerifyState(lf, false, slot, slot, false, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::DisengagingIdler));
// Stage 4 - disengaging idler // Stage 4 - disengaging idler
REQUIRE(WhileTopState(lf, ProgressCode::DisengagingIdler, idlerEngageDisengageMaxSteps)); REQUIRE(WhileTopState(lf, ProgressCode::DisengagingIdler, idlerEngageDisengageMaxSteps));
REQUIRE(VerifyState(lf, true, mi::Idler::IdleSlotIndex(), slot, false, ml::on, ml::off, ErrorCode::OK, ProgressCode::OK)); REQUIRE(VerifyState(lf, true, mi::Idler::IdleSlotIndex(), slot, false, false, ml::on, ml::off, ErrorCode::OK, ProgressCode::OK));
} }
TEST_CASE("load_filament::regular_load_to_slot_0-4", "[load_filament]") { TEST_CASE("load_filament::regular_load_to_slot_0-4", "[load_filament]") {
@ -88,11 +88,11 @@ void FailedLoadToFinda(uint8_t slot, logic::LoadFilament &lf) {
// Stage 2 - feeding to finda // Stage 2 - feeding to finda
// we'll assume the finda is defective here and does not trigger // we'll assume the finda is defective here and does not trigger
REQUIRE(WhileTopState(lf, ProgressCode::FeedingToFinda, 5000)); REQUIRE(WhileTopState(lf, ProgressCode::FeedingToFinda, 5000));
REQUIRE(VerifyState(lf, false, slot, slot, false, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRDisengagingIdler)); REQUIRE(VerifyState(lf, false, slot, slot, false, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRDisengagingIdler));
// Stage 3 - disengaging idler in error mode // Stage 3 - disengaging idler in error mode
REQUIRE(WhileTopState(lf, ProgressCode::ERRDisengagingIdler, idlerEngageDisengageMaxSteps)); REQUIRE(WhileTopState(lf, ProgressCode::ERRDisengagingIdler, idlerEngageDisengageMaxSteps));
REQUIRE(VerifyState(lf, false, mi::Idler::IdleSlotIndex(), slot, false, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRWaitingForUser)); REQUIRE(VerifyState(lf, false, mi::Idler::IdleSlotIndex(), slot, false, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRWaitingForUser));
} }
void FailedLoadToFindaResolveHelp(uint8_t slot, logic::LoadFilament &lf) { void FailedLoadToFindaResolveHelp(uint8_t slot, logic::LoadFilament &lf) {
@ -111,12 +111,12 @@ void FailedLoadToFindaResolveHelp(uint8_t slot, logic::LoadFilament &lf) {
lf.Step(); lf.Step();
} }
REQUIRE(VerifyState(lf, false, mi::Idler::IdleSlotIndex(), slot, false, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERREngagingIdler)); REQUIRE(VerifyState(lf, false, mi::Idler::IdleSlotIndex(), slot, false, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERREngagingIdler));
// Stage 4 - engage the idler // Stage 4 - engage the idler
REQUIRE(WhileTopState(lf, ProgressCode::ERREngagingIdler, idlerEngageDisengageMaxSteps)); REQUIRE(WhileTopState(lf, ProgressCode::ERREngagingIdler, idlerEngageDisengageMaxSteps));
REQUIRE(VerifyState(lf, false, slot, slot, false, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRHelpingFilament)); REQUIRE(VerifyState(lf, false, slot, slot, false, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRHelpingFilament));
} }
void FailedLoadToFindaResolveHelpFindaTriggered(uint8_t slot, logic::LoadFilament &lf) { void FailedLoadToFindaResolveHelpFindaTriggered(uint8_t slot, logic::LoadFilament &lf) {
@ -130,14 +130,14 @@ void FailedLoadToFindaResolveHelpFindaTriggered(uint8_t slot, logic::LoadFilamen
return lf.TopLevelState() == ProgressCode::ERRHelpingFilament; }, return lf.TopLevelState() == ProgressCode::ERRHelpingFilament; },
5000)); 5000));
REQUIRE(VerifyState(lf, false, slot, slot, true, ml::off, ml::blink0, ErrorCode::RUNNING, ProgressCode::FeedingToBondtech)); REQUIRE(VerifyState(lf, false, slot, slot, true, true, ml::off, ml::blink0, ErrorCode::RUNNING, ProgressCode::FeedingToBondtech));
} }
void FailedLoadToFindaResolveHelpFindaDidntTrigger(uint8_t slot, logic::LoadFilament &lf) { void FailedLoadToFindaResolveHelpFindaDidntTrigger(uint8_t slot, logic::LoadFilament &lf) {
// Stage 5 - move the pulley a bit - no FINDA change // Stage 5 - move the pulley a bit - no FINDA change
REQUIRE(WhileTopState(lf, ProgressCode::ERRHelpingFilament, 5000)); REQUIRE(WhileTopState(lf, ProgressCode::ERRHelpingFilament, 5000));
REQUIRE(VerifyState(lf, false, slot, slot, false, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRDisengagingIdler)); REQUIRE(VerifyState(lf, false, slot, slot, false, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_ON, ProgressCode::ERRDisengagingIdler));
} }
TEST_CASE("load_filament::failed_load_to_finda_0-4_resolve_help_second_ok", "[load_filament]") { TEST_CASE("load_filament::failed_load_to_finda_0-4_resolve_help_second_ok", "[load_filament]") {

View File

@ -90,6 +90,10 @@ void ReinitMotion() {
false, false, false }); // idler false, false, false }); // idler
} }
bool PulleyEnabled() {
return axes[0].enabled;
}
/// probably higher-level operations knowing the semantic meaning of axes /// probably higher-level operations knowing the semantic meaning of axes
} // namespace motion } // namespace motion

View File

@ -15,6 +15,7 @@ struct AxisSim {
extern AxisSim axes[3]; extern AxisSim axes[3];
extern void ReinitMotion(); extern void ReinitMotion();
bool PulleyEnabled();
} // namespace motion } // namespace motion
} // namespace modules } // namespace modules

View File

@ -31,7 +31,7 @@ void FeedingToFinda(logic::ToolChange &tc, uint8_t toSlot) {
} }
return tc.TopLevelState() == ProgressCode::FeedingToFinda; }, return tc.TopLevelState() == ProgressCode::FeedingToFinda; },
200000UL)); 200000UL));
REQUIRE(VerifyState(tc, false, toSlot, toSlot, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToBondtech)); REQUIRE(VerifyState(tc, false, toSlot, toSlot, true, true, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToBondtech));
} }
void FeedingToBondtech(logic::ToolChange &tc, uint8_t toSlot) { void FeedingToBondtech(logic::ToolChange &tc, uint8_t toSlot) {
@ -44,7 +44,7 @@ void FeedingToBondtech(logic::ToolChange &tc, uint8_t toSlot) {
} }
return tc.TopLevelState() == ProgressCode::FeedingToBondtech; }, return tc.TopLevelState() == ProgressCode::FeedingToBondtech; },
200000UL)); 200000UL));
REQUIRE(VerifyState(tc, true, mi::Idler::IdleSlotIndex(), toSlot, true, ml::on, ml::off, ErrorCode::OK, ProgressCode::OK)); REQUIRE(VerifyState(tc, true, mi::Idler::IdleSlotIndex(), toSlot, true, false, ml::on, ml::off, ErrorCode::OK, ProgressCode::OK));
} }
void ToolChange(logic::ToolChange tc, uint8_t fromSlot, uint8_t toSlot) { void ToolChange(logic::ToolChange tc, uint8_t fromSlot, uint8_t toSlot) {
@ -82,7 +82,7 @@ void NoToolChange(logic::ToolChange tc, uint8_t fromSlot, uint8_t toSlot) {
EnsureActiveSlotIndex(fromSlot); EnsureActiveSlotIndex(fromSlot);
REQUIRE(VerifyEnvironmentState(true, mi::Idler::IdleSlotIndex(), toSlot, false, ml::off, ml::off)); REQUIRE(VerifyEnvironmentState(true, mi::Idler::IdleSlotIndex(), toSlot, false, false, ml::off, ml::off));
// restart the automaton // restart the automaton
tc.Reset(toSlot); tc.Reset(toSlot);
@ -98,7 +98,7 @@ void JustLoadFilament(logic::ToolChange tc, uint8_t slot) {
EnsureActiveSlotIndex(slot); EnsureActiveSlotIndex(slot);
// verify filament NOT loaded // verify filament NOT loaded
REQUIRE(VerifyEnvironmentState(false, mi::Idler::IdleSlotIndex(), slot, false, ml::off, ml::off)); REQUIRE(VerifyEnvironmentState(false, mi::Idler::IdleSlotIndex(), slot, false, false, ml::off, ml::off));
// restart the automaton // restart the automaton
tc.Reset(slot); tc.Reset(slot);

View File

@ -34,7 +34,7 @@ void RegularUnloadFromSlot04Init(uint8_t slot, logic::UnloadFilament &uf) {
SetFINDAStateAndDebounce(true); SetFINDAStateAndDebounce(true);
// verify startup conditions // verify startup conditions
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, false, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK));
// restart the automaton // restart the automaton
uf.Reset(slot); uf.Reset(slot);
@ -47,7 +47,7 @@ void RegularUnloadFromSlot04(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA on // FINDA on
// green LED should blink, red off // green LED should blink, red off
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda));
// run the automaton // run the automaton
// Stage 1 - unloading to FINDA // Stage 1 - unloading to FINDA
@ -65,7 +65,7 @@ void RegularUnloadFromSlot04(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA triggered off // FINDA triggered off
// green LED should be off // green LED should be off
REQUIRE(VerifyState(uf, true, slot, slot, false, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::DisengagingIdler)); REQUIRE(VerifyState(uf, true, slot, slot, false, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::DisengagingIdler));
// Stage 2 - idler was engaged, disengage it // Stage 2 - idler was engaged, disengage it
REQUIRE(WhileTopState(uf, ProgressCode::DisengagingIdler, idlerEngageDisengageMaxSteps)); REQUIRE(WhileTopState(uf, ProgressCode::DisengagingIdler, idlerEngageDisengageMaxSteps));
@ -75,7 +75,7 @@ void RegularUnloadFromSlot04(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA still triggered off // FINDA still triggered off
// green LED should be off // green LED should be off
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, false, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::AvoidingGrind)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, false, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::AvoidingGrind));
// Stage 3 - avoiding grind (whatever is that @@TODO) // Stage 3 - avoiding grind (whatever is that @@TODO)
REQUIRE(WhileTopState(uf, ProgressCode::AvoidingGrind, 5000)); REQUIRE(WhileTopState(uf, ProgressCode::AvoidingGrind, 5000));
@ -85,7 +85,7 @@ void RegularUnloadFromSlot04(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA still triggered off // FINDA still triggered off
// green LED should be off // green LED should be off
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, false, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::FinishingMoves)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, false, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::FinishingMoves));
// Stage 4 - finishing moves and setting global state correctly // Stage 4 - finishing moves and setting global state correctly
REQUIRE(WhileTopState(uf, ProgressCode::FinishingMoves, 5000)); REQUIRE(WhileTopState(uf, ProgressCode::FinishingMoves, 5000));
@ -95,7 +95,7 @@ void RegularUnloadFromSlot04(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA still triggered off // FINDA still triggered off
// green LED should be OFF // green LED should be OFF
REQUIRE(VerifyState(uf, false, mi::Idler::IdleSlotIndex(), slot, false, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK)); REQUIRE(VerifyState(uf, false, mi::Idler::IdleSlotIndex(), slot, false, false, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK));
// Stage 5 - repeated calls to TopLevelState should return "OK" // Stage 5 - repeated calls to TopLevelState should return "OK"
REQUIRE(uf.TopLevelState() == ProgressCode::OK); REQUIRE(uf.TopLevelState() == ProgressCode::OK);
@ -126,7 +126,7 @@ void FindaDidntTriggerCommonSetup(uint8_t slot, logic::UnloadFilament &uf) {
mg::globals.SetFilamentLoaded(true); mg::globals.SetFilamentLoaded(true);
// verify startup conditions // verify startup conditions
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, false, ml::off, ml::off, ErrorCode::OK, ProgressCode::OK));
// restart the automaton // restart the automaton
uf.Reset(slot); uf.Reset(slot);
@ -138,7 +138,7 @@ void FindaDidntTriggerCommonSetup(uint8_t slot, logic::UnloadFilament &uf) {
// FINDA triggered off // FINDA triggered off
// green LED should be off // green LED should be off
// no error so far // no error so far
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda));
// run the automaton // run the automaton
// Stage 1 - unloading to FINDA - do NOT let it trigger - keep it pressed, the automaton should finish all moves with the pulley // Stage 1 - unloading to FINDA - do NOT let it trigger - keep it pressed, the automaton should finish all moves with the pulley
@ -150,7 +150,7 @@ void FindaDidntTriggerCommonSetup(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA still on // FINDA still on
// red LED should blink, green LED should be off // red LED should blink, green LED should be off
REQUIRE(VerifyState(uf, true, slot, slot, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERRDisengagingIdler)); REQUIRE(VerifyState(uf, true, slot, slot, true, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERRDisengagingIdler));
// Stage 2 - idler should get disengaged // Stage 2 - idler should get disengaged
REQUIRE(WhileTopState(uf, ProgressCode::ERRDisengagingIdler, idlerEngageDisengageMaxSteps)); REQUIRE(WhileTopState(uf, ProgressCode::ERRDisengagingIdler, idlerEngageDisengageMaxSteps));
@ -161,7 +161,7 @@ void FindaDidntTriggerCommonSetup(uint8_t slot, logic::UnloadFilament &uf) {
// FINDA still on // FINDA still on
// red LED should blink // red LED should blink
// green LED should be off // green LED should be off
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERRWaitingForUser)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERRWaitingForUser));
} }
void FindaDidntTriggerResolveHelp(uint8_t slot, logic::UnloadFilament &uf) { void FindaDidntTriggerResolveHelp(uint8_t slot, logic::UnloadFilament &uf) {
@ -186,7 +186,7 @@ void FindaDidntTriggerResolveHelp(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA still on // FINDA still on
// red LED should blink, green LED should be off // red LED should blink, green LED should be off
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERREngagingIdler)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERREngagingIdler));
// Stage 4 - engage the idler // Stage 4 - engage the idler
REQUIRE(WhileTopState(uf, ProgressCode::ERREngagingIdler, idlerEngageDisengageMaxSteps)); REQUIRE(WhileTopState(uf, ProgressCode::ERREngagingIdler, idlerEngageDisengageMaxSteps));
@ -196,7 +196,7 @@ void FindaDidntTriggerResolveHelp(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA still on // FINDA still on
// red LED should blink, green LED should be off // red LED should blink, green LED should be off
REQUIRE(VerifyState(uf, true, slot, slot, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERRHelpingFilament)); REQUIRE(VerifyState(uf, true, slot, slot, true, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERRHelpingFilament));
} }
void FindaDidntTriggerResolveHelpFindaTriggered(uint8_t slot, logic::UnloadFilament &uf) { void FindaDidntTriggerResolveHelpFindaTriggered(uint8_t slot, logic::UnloadFilament &uf) {
@ -215,7 +215,7 @@ void FindaDidntTriggerResolveHelpFindaTriggered(uint8_t slot, logic::UnloadFilam
// no change in selector's position // no change in selector's position
// FINDA depressed // FINDA depressed
// red LED should blink, green LED should be off // red LED should blink, green LED should be off
REQUIRE(VerifyState(uf, true, slot, slot, false, ml::off, ml::blink0, ErrorCode::RUNNING, ProgressCode::DisengagingIdler)); REQUIRE(VerifyState(uf, true, slot, slot, false, true, ml::off, ml::blink0, ErrorCode::RUNNING, ProgressCode::DisengagingIdler));
} }
void FindaDidntTriggerResolveHelpFindaDidntTrigger(uint8_t slot, logic::UnloadFilament &uf) { void FindaDidntTriggerResolveHelpFindaDidntTrigger(uint8_t slot, logic::UnloadFilament &uf) {
@ -227,7 +227,7 @@ void FindaDidntTriggerResolveHelpFindaDidntTrigger(uint8_t slot, logic::UnloadFi
// no change in selector's position // no change in selector's position
// FINDA still pressed // FINDA still pressed
// red LED should blink, green LED should be off // red LED should blink, green LED should be off
REQUIRE(VerifyState(uf, true, slot, slot, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERRDisengagingIdler)); REQUIRE(VerifyState(uf, true, slot, slot, true, true, ml::off, ml::blink0, ErrorCode::FINDA_DIDNT_SWITCH_OFF, ProgressCode::ERRDisengagingIdler));
} }
TEST_CASE("unload_filament::finda_didnt_trigger_resolve_help_second_ok", "[unload_filament]") { TEST_CASE("unload_filament::finda_didnt_trigger_resolve_help_second_ok", "[unload_filament]") {
@ -270,7 +270,7 @@ void FindaDidntTriggerResolveTryAgain(uint8_t slot, logic::UnloadFilament &uf) {
// no change in selector's position // no change in selector's position
// FINDA still on // FINDA still on
// red LED should blink, green LED should be off // red LED should blink, green LED should be off
REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda)); REQUIRE(VerifyState(uf, true, mi::Idler::IdleSlotIndex(), slot, true, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda));
} }
TEST_CASE("unload_filament::finda_didnt_trigger_resolve_try_again", "[unload_filament]") { TEST_CASE("unload_filament::finda_didnt_trigger_resolve_try_again", "[unload_filament]") {

View File

@ -40,13 +40,13 @@ TEST_CASE("unload_to_finda::regular_unload", "[unload_to_finda]") {
// check if the idler and selector have the right command // check if the idler and selector have the right command
CHECK(mm::axes[mm::Idler].targetPos == mi::Idler::SlotPosition(0).v); CHECK(mm::axes[mm::Idler].targetPos == mi::Idler::SlotPosition(0).v);
CHECK(mm::axes[mm::Selector].targetPos == ms::Selector::SlotPosition(0).v); CHECK(mm::axes[mm::Selector].targetPos == ms::Selector::SlotPosition(0).v);
CHECK(mm::axes[mm::Idler].enabled == true);
// engaging idler // engaging idler
REQUIRE(WhileCondition( REQUIRE(WhileCondition(
ff, ff,
[&](int) { return !mi::idler.Engaged(); }, [&](int) { return !mi::idler.Engaged(); },
5000)); 5000));
CHECK(mm::axes[mm::Pulley].enabled == true);
// now pulling the filament until finda triggers // now pulling the filament until finda triggers
REQUIRE(ff.State() == logic::UnloadToFinda::WaitingForFINDA); REQUIRE(ff.State() == logic::UnloadToFinda::WaitingForFINDA);