Actually fix retract filament from finda

pull/126/head
Alex Voinea 2021-09-30 21:44:41 +02:00 committed by DRracer
parent 6071257973
commit 0a1290102c
3 changed files with 16 additions and 12 deletions

View File

@ -21,7 +21,7 @@ bool RetractFromFinda::Step() {
if (mi::idler.Engaged()) {
dbg_logic_sprintf_P(PSTR("Pulley start steps %u"), mm::motion.CurPosition(mm::Pulley));
state = UnloadBackToPTFE;
mm::motion.PlanMove<mm::Pulley>(-config::cuttingEdgeToFindaMidpoint, config::pulleyFeedrate);
mm::motion.PlanMove<mm::Pulley>(-(config::cuttingEdgeToFindaMidpoint + config::cuttingEdgeRetract), config::pulleyFeedrate);
}
return false;
case UnloadBackToPTFE:

View File

@ -35,20 +35,22 @@ bool UnloadFilament::StepInner() {
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::red, ml::blink0);
mi::idler.Disengage();
} else {
state = ProgressCode::UnloadingToPulley;
mm::motion.PlanMove<mm::Pulley>(-config::cuttingEdgeToFindaMidpoint, config::pulleyFeedrate);
state = ProgressCode::RetractingFromFinda;
retract.Reset();
}
}
return false;
case ProgressCode::UnloadingToPulley:
if (mm::motion.QueueEmpty()) {
state = ProgressCode::DisengagingIdler;
mi::idler.Disengage();
}
return false;
case ProgressCode::DisengagingIdler:
if (mm::motion.QueueEmpty()) {
state = ProgressCode::FinishingMoves;
case ProgressCode::RetractingFromFinda:
if (retract.Step()) {
if (retract.State() == RetractFromFinda::Failed) {
state = ProgressCode::ERRDisengagingIdler;
error = ErrorCode::FINDA_DIDNT_SWITCH_OFF;
mi::idler.Disengage();
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::green, ml::off);
ml::leds.SetMode(mg::globals.ActiveSlot(), ml::red, ml::blink0); // signal loading error
} else {
state = ProgressCode::FinishingMoves;
}
}
return false;
case ProgressCode::FinishingMoves:

View File

@ -2,6 +2,7 @@
#include <stdint.h>
#include "command_base.h"
#include "unload_to_finda.h"
#include "retract_from_finda.h"
namespace logic {
@ -21,6 +22,7 @@ public:
private:
constexpr static const uint8_t maxRetries = 3;
UnloadToFinda unl;
RetractFromFinda retract;
};
/// The one and only instance of UnloadFilament state machine in the FW