Use constants

pull/126/head
3d-gussner 2021-09-22 20:24:21 +02:00 committed by DRracer
parent 64bd2bb894
commit afe732d3ff
1 changed files with 10 additions and 4 deletions

View File

@ -23,14 +23,19 @@ void UnloadToFinda::Reset(uint8_t maxTries) {
bool UnloadToFinda::Step() {
switch (state) {
case EngagingIdler:
if (mg::globals.FilamentLoaded()) {
state = UnloadingToFinda;
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::Color::green, ml::Mode::blink0);
} else {
state = Failed;
}
return false;
case UnloadingToFinda:
if (mi::idler.Engaged()) {
state = WaitingForFINDA;
int unloadSteps = mps::BowdenLength::get() + 1100;
const int second_point = unloadSteps - 1300;
mm::motion.PlanMove(mm::Pulley, -1400, 6000); // @@TODO constants
mm::motion.PlanMove(mm::Pulley, -1800 + 1400, 2500); // @@TODO constants 1800-1400 = 400
mm::motion.PlanMove(mm::Pulley, -second_point + 1800, 550); // @@TODO constants
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::blink0);
mm::motion.PlanMove<mm::Pulley>(-config::DefaultBowdenLength -config::FeedToFINDA -config::FilamentMinLoadedToMMU, config::pulleyFeedrate); // @@TODO constants
}
return false;
case WaitingForFINDA:
@ -38,6 +43,7 @@ bool UnloadToFinda::Step() {
// detected end of filament
state = OK;
mm::motion.AbortPlannedMoves(); // stop rotating the pulley
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::Color::green, ml::Mode::off);
} else if (/*tmc2130_read_gstat() &&*/ mm::motion.QueueEmpty()) {
// we reached the end of move queue, but the FINDA didn't switch off
// two possible causes - grinded filament or malfunctioning FINDA