Use constants
parent
64bd2bb894
commit
afe732d3ff
|
|
@ -23,14 +23,19 @@ void UnloadToFinda::Reset(uint8_t maxTries) {
|
||||||
bool UnloadToFinda::Step() {
|
bool UnloadToFinda::Step() {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case EngagingIdler:
|
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()) {
|
if (mi::idler.Engaged()) {
|
||||||
state = WaitingForFINDA;
|
state = WaitingForFINDA;
|
||||||
int unloadSteps = mps::BowdenLength::get() + 1100;
|
int unloadSteps = mps::BowdenLength::get() + 1100;
|
||||||
const int second_point = unloadSteps - 1300;
|
const int second_point = unloadSteps - 1300;
|
||||||
mm::motion.PlanMove(mm::Pulley, -1400, 6000); // @@TODO constants
|
mm::motion.PlanMove<mm::Pulley>(-config::DefaultBowdenLength -config::FeedToFINDA -config::FilamentMinLoadedToMMU, config::pulleyFeedrate); // @@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);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
case WaitingForFINDA:
|
case WaitingForFINDA:
|
||||||
|
|
@ -38,6 +43,7 @@ bool UnloadToFinda::Step() {
|
||||||
// detected end of filament
|
// detected end of filament
|
||||||
state = OK;
|
state = OK;
|
||||||
mm::motion.AbortPlannedMoves(); // stop rotating the pulley
|
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()) {
|
} else if (/*tmc2130_read_gstat() &&*/ mm::motion.QueueEmpty()) {
|
||||||
// we reached the end of move queue, but the FINDA didn't switch off
|
// we reached the end of move queue, but the FINDA didn't switch off
|
||||||
// two possible causes - grinded filament or malfunctioning FINDA
|
// two possible causes - grinded filament or malfunctioning FINDA
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue