Cleanup compiler warnings
parent
151adf810a
commit
6f982e2505
|
|
@ -44,7 +44,7 @@ void CutSlot(logic::CutFilament &cf, uint8_t cutSlot) {
|
||||||
// prepare for simulated finda trigger
|
// prepare for simulated finda trigger
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
cf,
|
cf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if( step == 100 ){ // simulate FINDA trigger - will get pressed in 100 steps (due to debouncing)
|
if( step == 100 ){ // simulate FINDA trigger - will get pressed in 100 steps (due to debouncing)
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ void CutSlot(logic::CutFilament &cf, uint8_t cutSlot) {
|
||||||
// pull it back to the pulley + simulate FINDA depress
|
// pull it back to the pulley + simulate FINDA depress
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
cf,
|
cf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if( step == 100 ){ // simulate FINDA trigger - will get depressed in 100 steps
|
if( step == 100 ){ // simulate FINDA trigger - will get depressed in 100 steps
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,10 +54,10 @@ void FailingIdler(hal::tmc2130::ErrorFlags ef, ErrorCode ec) {
|
||||||
|
|
||||||
REQUIRE(VerifyState(uf, mg::FilamentLoadState::InNozzle, mi::Idler::IdleSlotIndex(), 0, true, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda));
|
REQUIRE(VerifyState(uf, mg::FilamentLoadState::InNozzle, mi::Idler::IdleSlotIndex(), 0, true, true, ml::off, ml::off, ErrorCode::RUNNING, ProgressCode::UnloadingToFinda));
|
||||||
|
|
||||||
int failingStep = 5;
|
uint32_t failingStep = 5;
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
uf,
|
uf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == failingStep){ // on 5th step make the TMC report some error
|
if(step == failingStep){ // on 5th step make the TMC report some error
|
||||||
CauseTMCError(mm::Idler, ef);
|
CauseTMCError(mm::Idler, ef);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ TEST_CASE("feed_to_bondtech::feed_phase_unlimited", "[feed_to_bondtech]") {
|
||||||
// engaging idler
|
// engaging idler
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
fb,
|
fb,
|
||||||
[&](int) { return !mi::idler.Engaged(); },
|
[&](uint32_t) { return !mi::idler.Engaged(); },
|
||||||
5000));
|
5000));
|
||||||
|
|
||||||
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v);
|
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v);
|
||||||
|
|
@ -58,7 +58,7 @@ TEST_CASE("feed_to_bondtech::feed_phase_unlimited", "[feed_to_bondtech]") {
|
||||||
|
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
fb,
|
fb,
|
||||||
[&](int step) {
|
[&](uint32_t step) {
|
||||||
if( step == 1000 ){
|
if( step == 1000 ){
|
||||||
mfs::fsensor.ProcessMessage(true);
|
mfs::fsensor.ProcessMessage(true);
|
||||||
}
|
}
|
||||||
|
|
@ -71,14 +71,14 @@ TEST_CASE("feed_to_bondtech::feed_phase_unlimited", "[feed_to_bondtech]") {
|
||||||
REQUIRE(fb.State() == FeedToBondtech::PushingFilamentIntoNozzle);
|
REQUIRE(fb.State() == FeedToBondtech::PushingFilamentIntoNozzle);
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
fb,
|
fb,
|
||||||
[&](int) { return fb.State() == FeedToBondtech::PushingFilamentIntoNozzle; },
|
[&](uint32_t) { return fb.State() == FeedToBondtech::PushingFilamentIntoNozzle; },
|
||||||
5000));
|
5000));
|
||||||
|
|
||||||
// disengaging idler
|
// disengaging idler
|
||||||
REQUIRE(fb.State() == FeedToBondtech::DisengagingIdler);
|
REQUIRE(fb.State() == FeedToBondtech::DisengagingIdler);
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
fb,
|
fb,
|
||||||
[&](int) { return fb.State() == FeedToBondtech::DisengagingIdler; },
|
[&](uint32_t) { return fb.State() == FeedToBondtech::DisengagingIdler; },
|
||||||
5000));
|
5000));
|
||||||
|
|
||||||
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(5).v);
|
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(5).v);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ TEST_CASE("feed_to_finda::feed_phase_unlimited", "[feed_to_finda]") {
|
||||||
// engaging idler
|
// engaging idler
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
ff,
|
ff,
|
||||||
[&](int) { return !mi::idler.Engaged(); },
|
[&](uint32_t) { return !mi::idler.Engaged(); },
|
||||||
5000));
|
5000));
|
||||||
|
|
||||||
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v);
|
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v);
|
||||||
|
|
@ -60,7 +60,7 @@ TEST_CASE("feed_to_finda::feed_phase_unlimited", "[feed_to_finda]") {
|
||||||
|
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
ff,
|
ff,
|
||||||
[&](int) { return ff.State() == FeedToFinda::PushingFilament; },
|
[&](uint32_t) { return ff.State() == FeedToFinda::PushingFilament; },
|
||||||
1500));
|
1500));
|
||||||
// From now on the FINDA is reported as ON
|
// From now on the FINDA is reported as ON
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ TEST_CASE("feed_to_finda::FINDA_failed", "[feed_to_finda]") {
|
||||||
// engaging idler
|
// engaging idler
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
ff,
|
ff,
|
||||||
[&](int) { return !mi::idler.Engaged(); },
|
[&](uint32_t) { return !mi::idler.Engaged(); },
|
||||||
5000));
|
5000));
|
||||||
|
|
||||||
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v);
|
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(0).v);
|
||||||
|
|
@ -127,7 +127,7 @@ TEST_CASE("feed_to_finda::FINDA_failed", "[feed_to_finda]") {
|
||||||
|
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
ff,
|
ff,
|
||||||
[&](int) { return ff.State() == FeedToFinda::PushingFilament; },
|
[&](uint32_t) { return ff.State() == FeedToFinda::PushingFilament; },
|
||||||
5000));
|
5000));
|
||||||
|
|
||||||
// the FINDA didn't trigger, we should be in the Failed state
|
// the FINDA didn't trigger, we should be in the Failed state
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ void LoadFilamentSuccessful(uint8_t slot, logic::LoadFilament &lf) {
|
||||||
// we'll assume the finda is working correctly here
|
// we'll assume the finda is working correctly here
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
lf,
|
lf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 100){ // on 100th step make FINDA trigger
|
if(step == 100){ // on 100th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ void LoadFilamentSuccessful(uint8_t slot, logic::LoadFilament &lf) {
|
||||||
// we'll assume the finda is working correctly here
|
// we'll assume the finda is working correctly here
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
lf,
|
lf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 50){ // on 50th step make FINDA trigger
|
if(step == 50){ // on 50th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
}
|
}
|
||||||
|
|
@ -113,7 +113,7 @@ void FailedLoadToFindaResolveHelpFindaTriggered(uint8_t slot, logic::LoadFilamen
|
||||||
// Stage 5 - move the pulley a bit - simulate FINDA depress
|
// Stage 5 - move the pulley a bit - simulate FINDA depress
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
lf,
|
lf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 100){ // on 100th step make FINDA trigger
|
if(step == 100){ // on 100th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
||||||
}
|
}
|
||||||
|
|
@ -144,7 +144,7 @@ void FailedLoadToFindaResolveManual(uint8_t slot, logic::LoadFilament &lf) {
|
||||||
// we'll assume the finda is working correctly here
|
// we'll assume the finda is working correctly here
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
lf,
|
lf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 50){ // on 50th step make FINDA trigger
|
if(step == 50){ // on 50th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ bool WhileCondition(SM &sm, COND cond, uint32_t maxLoops = 5000) {
|
||||||
template <typename SM>
|
template <typename SM>
|
||||||
bool WhileTopState(SM &sm, ProgressCode state, uint32_t maxLoops = 5000) {
|
bool WhileTopState(SM &sm, ProgressCode state, uint32_t maxLoops = 5000) {
|
||||||
return WhileCondition(
|
return WhileCondition(
|
||||||
sm, [&](int) { return sm.TopLevelState() == state; }, maxLoops);
|
sm, [&](uint32_t) { return sm.TopLevelState() == state; }, maxLoops);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void EnsureActiveSlotIndex(uint8_t slot, modules::globals::FilamentLoadState loadState);
|
extern void EnsureActiveSlotIndex(uint8_t slot, modules::globals::FilamentLoadState loadState);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ void FeedingToFinda(logic::ToolChange &tc, uint8_t toSlot, uint32_t triggerAt =
|
||||||
// feeding to finda
|
// feeding to finda
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
tc,
|
tc,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == triggerAt){ // on specified stepNr make FINDA trigger
|
if(step == triggerAt){ // on specified stepNr make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
||||||
} else if(step >= triggerAt + config::findaDebounceMs + 1){
|
} else if(step >= triggerAt + config::findaDebounceMs + 1){
|
||||||
|
|
@ -40,7 +40,7 @@ void FeedingToBondtech(logic::ToolChange &tc, uint8_t toSlot) {
|
||||||
// james is feeding
|
// james is feeding
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
tc,
|
tc,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 2000){ // on 2000th step make filament sensor trigger
|
if(step == 2000){ // on 2000th step make filament sensor trigger
|
||||||
mfs::fsensor.ProcessMessage(true);
|
mfs::fsensor.ProcessMessage(true);
|
||||||
}
|
}
|
||||||
|
|
@ -65,18 +65,13 @@ void ToolChange(logic::ToolChange &tc, uint8_t fromSlot, uint8_t toSlot) {
|
||||||
|
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
tc,
|
tc,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 2000){ // on 2000th step make FINDA trigger
|
if(step == 2000){ // on 2000th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
}
|
}
|
||||||
return tc.TopLevelState() == ProgressCode::UnloadingFilament; },
|
return tc.TopLevelState() == ProgressCode::UnloadingFilament; },
|
||||||
200000UL));
|
200000UL));
|
||||||
|
|
||||||
auto gf = ml::leds.Mode(fromSlot, ml::green);
|
|
||||||
auto gt = ml::leds.Mode(toSlot, ml::green);
|
|
||||||
auto rf = ml::leds.Mode(fromSlot, ml::red);
|
|
||||||
auto rt = ml::leds.Mode(toSlot, ml::red);
|
|
||||||
|
|
||||||
// REQUIRE(mg::globals.FilamentLoaded() == mg::FilamentLoadState::AtPulley);
|
// REQUIRE(mg::globals.FilamentLoaded() == mg::FilamentLoadState::AtPulley);
|
||||||
REQUIRE(VerifyState2(tc, mg::FilamentLoadState::AtPulley, mi::Idler::IdleSlotIndex(), fromSlot, false, false, toSlot, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToFinda));
|
REQUIRE(VerifyState2(tc, mg::FilamentLoadState::AtPulley, mi::Idler::IdleSlotIndex(), fromSlot, false, false, toSlot, ml::blink0, ml::off, ErrorCode::RUNNING, ProgressCode::FeedingToFinda));
|
||||||
|
|
||||||
|
|
@ -174,7 +169,7 @@ void ToolChangeFailLoadToFinda(logic::ToolChange &tc, uint8_t fromSlot, uint8_t
|
||||||
|
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
tc,
|
tc,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 2000){ // on 2000th step make FINDA trigger
|
if(step == 2000){ // on 2000th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +197,7 @@ void ToolChangeFailLoadToFindaButton0(logic::ToolChange &tc, uint8_t toSlot) {
|
||||||
// try push more, if FINDA triggers, continue loading
|
// try push more, if FINDA triggers, continue loading
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
tc,
|
tc,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 20){ // on 20th step make FINDA trigger
|
if(step == 20){ // on 20th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
|
||||||
}
|
}
|
||||||
|
|
@ -222,7 +217,7 @@ void ToolChangeFailLoadToFindaButton1(logic::ToolChange &tc, uint8_t toSlot) {
|
||||||
|
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
tc,
|
tc,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 2000){ // on 2000th step make FINDA trigger
|
if(step == 2000){ // on 2000th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ void RegularUnloadFromSlot04(uint8_t slot, logic::UnloadFilament &uf) {
|
||||||
// Stage 1 - unloading to FINDA
|
// Stage 1 - unloading to FINDA
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
uf,
|
uf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 100){ // on 100th step make FINDA trigger
|
if(step == 100){ // on 100th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +181,7 @@ void FindaDidntTriggerResolveHelpFindaTriggered(uint8_t slot, logic::UnloadFilam
|
||||||
// Stage 5 - move the pulley a bit - simulate FINDA depress
|
// Stage 5 - move the pulley a bit - simulate FINDA depress
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
uf,
|
uf,
|
||||||
[&](int step) -> bool {
|
[&](uint32_t step) -> bool {
|
||||||
if(step == 100){ // on 100th step make FINDA trigger
|
if(step == 100){ // on 100th step make FINDA trigger
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ TEST_CASE("unload_to_finda::regular_unload", "[unload_to_finda]") {
|
||||||
// engaging idler
|
// engaging idler
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
ff,
|
ff,
|
||||||
[&](int) { return !mi::idler.Engaged(); },
|
[&](uint32_t) { return !mi::idler.Engaged(); },
|
||||||
5000));
|
5000));
|
||||||
CHECK(mm::axes[mm::Pulley].enabled == true);
|
CHECK(mm::axes[mm::Pulley].enabled == true);
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ TEST_CASE("unload_to_finda::regular_unload", "[unload_to_finda]") {
|
||||||
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
ff,
|
ff,
|
||||||
[&](int) { return mf::finda.Pressed(); },
|
[&](uint32_t) { return mf::finda.Pressed(); },
|
||||||
50000));
|
50000));
|
||||||
|
|
||||||
REQUIRE(ff.State() == logic::UnloadToFinda::OK);
|
REQUIRE(ff.State() == logic::UnloadToFinda::OK);
|
||||||
|
|
@ -100,7 +100,7 @@ TEST_CASE("unload_to_finda::unload_without_FINDA_trigger", "[unload_to_finda]")
|
||||||
// engaging idler
|
// engaging idler
|
||||||
REQUIRE(WhileCondition(
|
REQUIRE(WhileCondition(
|
||||||
ff,
|
ff,
|
||||||
[&](int) { return !mi::idler.Engaged(); },
|
[&](uint32_t) { return !mi::idler.Engaged(); },
|
||||||
5000));
|
5000));
|
||||||
|
|
||||||
// now pulling the filament until finda triggers
|
// now pulling the filament until finda triggers
|
||||||
|
|
@ -109,7 +109,7 @@ TEST_CASE("unload_to_finda::unload_without_FINDA_trigger", "[unload_to_finda]")
|
||||||
// no changes to FINDA during unload - we'll pretend it never triggers
|
// no changes to FINDA during unload - we'll pretend it never triggers
|
||||||
REQUIRE_FALSE(WhileCondition(
|
REQUIRE_FALSE(WhileCondition(
|
||||||
ff,
|
ff,
|
||||||
[&](int) { return mf::finda.Pressed(); },
|
[&](uint32_t) { return mf::finda.Pressed(); },
|
||||||
50000));
|
50000));
|
||||||
|
|
||||||
REQUIRE(ff.State() == logic::UnloadToFinda::Failed);
|
REQUIRE(ff.State() == logic::UnloadToFinda::Failed);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue