Update eject to use FilamentLoadState NotLoaded
parent
fb97e519aa
commit
63aead0ab8
|
|
@ -7,6 +7,7 @@
|
||||||
#include "../modules/motion.h"
|
#include "../modules/motion.h"
|
||||||
#include "../modules/permanent_storage.h"
|
#include "../modules/permanent_storage.h"
|
||||||
#include "../modules/selector.h"
|
#include "../modules/selector.h"
|
||||||
|
#include "../debug.h"
|
||||||
|
|
||||||
namespace logic {
|
namespace logic {
|
||||||
|
|
||||||
|
|
@ -20,7 +21,10 @@ void EjectFilament::Reset(uint8_t param) {
|
||||||
error = ErrorCode::RUNNING;
|
error = ErrorCode::RUNNING;
|
||||||
slot = param;
|
slot = param;
|
||||||
|
|
||||||
if (mg::globals.FilamentLoaded() >= mg::FilamentLoadState::InSelector) {
|
if (mg::globals.FilamentLoaded() == mg::FilamentLoadState::NotLoaded) {
|
||||||
|
state = ProgressCode::OK;
|
||||||
|
dbg_logic_P(PSTR("Already ejected"));
|
||||||
|
} else if (mg::globals.FilamentLoaded() >= mg::FilamentLoadState::AtPulley) {
|
||||||
state = ProgressCode::UnloadingFilament;
|
state = ProgressCode::UnloadingFilament;
|
||||||
unl.Reset(param); //@@TODO probably act on active extruder only
|
unl.Reset(param); //@@TODO probably act on active extruder only
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -39,7 +43,7 @@ bool EjectFilament::StepInner() {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case ProgressCode::UnloadingFilament:
|
case ProgressCode::UnloadingFilament:
|
||||||
if (unl.StepInner()) {
|
if (unl.StepInner()) {
|
||||||
// unloading sequence finished - basically, no errors can occurr here
|
// unloading sequence finished - basically, no errors can occur here
|
||||||
// as UnloadFilament should handle all the possible error states on its own
|
// as UnloadFilament should handle all the possible error states on its own
|
||||||
// There is no way the UnloadFilament to finish in an error state
|
// There is no way the UnloadFilament to finish in an error state
|
||||||
MoveSelectorAside();
|
MoveSelectorAside();
|
||||||
|
|
@ -49,7 +53,7 @@ bool EjectFilament::StepInner() {
|
||||||
if (mm::motion.QueueEmpty()) { // selector parked aside
|
if (mm::motion.QueueEmpty()) { // selector parked aside
|
||||||
state = ProgressCode::EjectingFilament;
|
state = ProgressCode::EjectingFilament;
|
||||||
mm::motion.InitAxis(mm::Pulley);
|
mm::motion.InitAxis(mm::Pulley);
|
||||||
mm::motion.PlanMove<mm::Pulley>(-config::filamentMinLoadedToMMU, config::pulleyFeedrate);
|
mm::motion.PlanMove<mm::Pulley>(-config::filamentMinLoadedToMMU, config::pulleySlowFeedrate);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ProgressCode::EjectingFilament:
|
case ProgressCode::EjectingFilament:
|
||||||
|
|
@ -61,11 +65,13 @@ bool EjectFilament::StepInner() {
|
||||||
case ProgressCode::DisengagingIdler:
|
case ProgressCode::DisengagingIdler:
|
||||||
if (!mi::idler.Engaged()) { // idler disengaged
|
if (!mi::idler.Engaged()) { // idler disengaged
|
||||||
mm::motion.Disable(mm::Pulley);
|
mm::motion.Disable(mm::Pulley);
|
||||||
|
mg::globals.SetFilamentLoaded(mg::FilamentLoadState::NotLoaded);
|
||||||
state = ProgressCode::OK;
|
state = ProgressCode::OK;
|
||||||
error = ErrorCode::OK;
|
error = ErrorCode::OK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ProgressCode::OK:
|
case ProgressCode::OK:
|
||||||
|
dbg_logic_sprintf_P(PSTR("FilamentLoadState after Eject %d"), mg::globals.FilamentLoaded());
|
||||||
return true;
|
return true;
|
||||||
default: // we got into an unhandled state, better report it
|
default: // we got into an unhandled state, better report it
|
||||||
state = ProgressCode::ERRInternal;
|
state = ProgressCode::ERRInternal;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue