Cleanup compiler warnings

pull/138/head
D.R.racer 2021-11-10 08:24:51 +01:00 committed by DRracer
parent 151adf810a
commit 6f982e2505
9 changed files with 29 additions and 34 deletions

View File

@ -44,7 +44,7 @@ void CutSlot(logic::CutFilament &cf, uint8_t cutSlot) {
// prepare for simulated finda trigger
REQUIRE(WhileCondition(
cf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if( step == 100 ){ // simulate FINDA trigger - will get pressed in 100 steps (due to debouncing)
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
REQUIRE(WhileCondition(
cf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if( step == 100 ){ // simulate FINDA trigger - will get depressed in 100 steps
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
}

View File

@ -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));
int failingStep = 5;
uint32_t failingStep = 5;
REQUIRE(WhileCondition(
uf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == failingStep){ // on 5th step make the TMC report some error
CauseTMCError(mm::Idler, ef);
}

View File

@ -44,7 +44,7 @@ TEST_CASE("feed_to_bondtech::feed_phase_unlimited", "[feed_to_bondtech]") {
// engaging idler
REQUIRE(WhileCondition(
fb,
[&](int) { return !mi::idler.Engaged(); },
[&](uint32_t) { return !mi::idler.Engaged(); },
5000));
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(
fb,
[&](int step) {
[&](uint32_t step) {
if( step == 1000 ){
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(WhileCondition(
fb,
[&](int) { return fb.State() == FeedToBondtech::PushingFilamentIntoNozzle; },
[&](uint32_t) { return fb.State() == FeedToBondtech::PushingFilamentIntoNozzle; },
5000));
// disengaging idler
REQUIRE(fb.State() == FeedToBondtech::DisengagingIdler);
REQUIRE(WhileCondition(
fb,
[&](int) { return fb.State() == FeedToBondtech::DisengagingIdler; },
[&](uint32_t) { return fb.State() == FeedToBondtech::DisengagingIdler; },
5000));
CHECK(mm::axes[mm::Idler].pos == mi::Idler::SlotPosition(5).v);

View File

@ -43,7 +43,7 @@ TEST_CASE("feed_to_finda::feed_phase_unlimited", "[feed_to_finda]") {
// engaging idler
REQUIRE(WhileCondition(
ff,
[&](int) { return !mi::idler.Engaged(); },
[&](uint32_t) { return !mi::idler.Engaged(); },
5000));
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(
ff,
[&](int) { return ff.State() == FeedToFinda::PushingFilament; },
[&](uint32_t) { return ff.State() == FeedToFinda::PushingFilament; },
1500));
// 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
REQUIRE(WhileCondition(
ff,
[&](int) { return !mi::idler.Engaged(); },
[&](uint32_t) { return !mi::idler.Engaged(); },
5000));
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(
ff,
[&](int) { return ff.State() == FeedToFinda::PushingFilament; },
[&](uint32_t) { return ff.State() == FeedToFinda::PushingFilament; },
5000));
// the FINDA didn't trigger, we should be in the Failed state

View File

@ -47,7 +47,7 @@ void LoadFilamentSuccessful(uint8_t slot, logic::LoadFilament &lf) {
// we'll assume the finda is working correctly here
REQUIRE(WhileCondition(
lf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 100){ // on 100th step make FINDA trigger
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
REQUIRE(WhileCondition(
lf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 50){ // on 50th step make FINDA trigger
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
REQUIRE(WhileCondition(
lf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 100){ // on 100th step make FINDA trigger
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
REQUIRE(WhileCondition(
lf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 50){ // on 50th step make FINDA trigger
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
}

View File

@ -19,7 +19,7 @@ bool WhileCondition(SM &sm, COND cond, uint32_t maxLoops = 5000) {
template <typename SM>
bool WhileTopState(SM &sm, ProgressCode state, uint32_t maxLoops = 5000) {
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);

View File

@ -25,7 +25,7 @@ void FeedingToFinda(logic::ToolChange &tc, uint8_t toSlot, uint32_t triggerAt =
// feeding to finda
REQUIRE(WhileCondition(
tc,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == triggerAt){ // on specified stepNr make FINDA trigger
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
} else if(step >= triggerAt + config::findaDebounceMs + 1){
@ -40,7 +40,7 @@ void FeedingToBondtech(logic::ToolChange &tc, uint8_t toSlot) {
// james is feeding
REQUIRE(WhileCondition(
tc,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 2000){ // on 2000th step make filament sensor trigger
mfs::fsensor.ProcessMessage(true);
}
@ -65,18 +65,13 @@ void ToolChange(logic::ToolChange &tc, uint8_t fromSlot, uint8_t toSlot) {
REQUIRE(WhileCondition(
tc,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 2000){ // on 2000th step make FINDA trigger
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
}
return tc.TopLevelState() == ProgressCode::UnloadingFilament; },
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(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(
tc,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 2000){ // on 2000th step make FINDA trigger
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
REQUIRE(WhileCondition(
tc,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 20){ // on 20th step make FINDA trigger
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::high);
}
@ -222,7 +217,7 @@ void ToolChangeFailLoadToFindaButton1(logic::ToolChange &tc, uint8_t toSlot) {
REQUIRE(WhileCondition(
tc,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 2000){ // on 2000th step make FINDA trigger
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
}

View File

@ -52,7 +52,7 @@ void RegularUnloadFromSlot04(uint8_t slot, logic::UnloadFilament &uf) {
// Stage 1 - unloading to FINDA
REQUIRE(WhileCondition(
uf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 100){ // on 100th step make FINDA trigger
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
REQUIRE(WhileCondition(
uf,
[&](int step) -> bool {
[&](uint32_t step) -> bool {
if(step == 100){ // on 100th step make FINDA trigger
hal::gpio::WritePin(FINDA_PIN, hal::gpio::Level::low);
}

View File

@ -45,7 +45,7 @@ TEST_CASE("unload_to_finda::regular_unload", "[unload_to_finda]") {
// engaging idler
REQUIRE(WhileCondition(
ff,
[&](int) { return !mi::idler.Engaged(); },
[&](uint32_t) { return !mi::idler.Engaged(); },
5000));
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);
REQUIRE(WhileCondition(
ff,
[&](int) { return mf::finda.Pressed(); },
[&](uint32_t) { return mf::finda.Pressed(); },
50000));
REQUIRE(ff.State() == logic::UnloadToFinda::OK);
@ -100,7 +100,7 @@ TEST_CASE("unload_to_finda::unload_without_FINDA_trigger", "[unload_to_finda]")
// engaging idler
REQUIRE(WhileCondition(
ff,
[&](int) { return !mi::idler.Engaged(); },
[&](uint32_t) { return !mi::idler.Engaged(); },
5000));
// 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
REQUIRE_FALSE(WhileCondition(
ff,
[&](int) { return mf::finda.Pressed(); },
[&](uint32_t) { return mf::finda.Pressed(); },
50000));
REQUIRE(ff.State() == logic::UnloadToFinda::Failed);