Suspend all moves of Idler and Selector when entering an Error screen
parent
436ebcbeee
commit
d75119c8d6
|
|
@ -153,6 +153,7 @@ void CommandBase::Panic(ErrorCode ec) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandBase::InvalidateHoming() {
|
void CommandBase::InvalidateHoming() {
|
||||||
|
ResumeIdlerSelector();
|
||||||
mi::idler.InvalidateHoming();
|
mi::idler.InvalidateHoming();
|
||||||
ms::selector.InvalidateHoming();
|
ms::selector.InvalidateHoming();
|
||||||
}
|
}
|
||||||
|
|
@ -177,6 +178,18 @@ void CommandBase::InvalidateHomingAndFilamentState() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommandBase::HoldIdlerSelector() {
|
||||||
|
mm::motion.AbortPlannedMoves(mm::Idler);
|
||||||
|
mi::idler.HoldOn();
|
||||||
|
mm::motion.AbortPlannedMoves(mm::Selector);
|
||||||
|
ms::selector.HoldOn();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandBase::ResumeIdlerSelector() {
|
||||||
|
mi::idler.Resume();
|
||||||
|
ms::selector.Resume();
|
||||||
|
}
|
||||||
|
|
||||||
bool CommandBase::CheckToolIndex(uint8_t index) {
|
bool CommandBase::CheckToolIndex(uint8_t index) {
|
||||||
if (index >= config::toolCount) {
|
if (index >= config::toolCount) {
|
||||||
error = ErrorCode::INVALID_TOOL;
|
error = ErrorCode::INVALID_TOOL;
|
||||||
|
|
@ -195,6 +208,7 @@ void CommandBase::ErrDisengagingIdler() {
|
||||||
mg::globals.IncDriveErrors();
|
mg::globals.IncDriveErrors();
|
||||||
mpu::pulley.Disable();
|
mpu::pulley.Disable();
|
||||||
mui::userInput.Clear(); // remove all buffered events if any just before we wait for some input
|
mui::userInput.Clear(); // remove all buffered events if any just before we wait for some input
|
||||||
|
HoldIdlerSelector(); // put all movables on hold until the error screen gets resolved
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -95,12 +95,19 @@ public:
|
||||||
/// filament presence according to known sensors (FINDA+FSensor)
|
/// filament presence according to known sensors (FINDA+FSensor)
|
||||||
static void InvalidateHomingAndFilamentState();
|
static void InvalidateHomingAndFilamentState();
|
||||||
|
|
||||||
|
/// Put Idler and Selector on-hold - they shall not move (not even home) until ResumeIdlerSelector is called
|
||||||
|
static void HoldIdlerSelector();
|
||||||
|
|
||||||
|
/// Allow Idler and Selector to move/home again. Any move needs to be newly planned.
|
||||||
|
static void ResumeIdlerSelector();
|
||||||
|
|
||||||
#ifndef UNITTEST
|
#ifndef UNITTEST
|
||||||
protected:
|
protected:
|
||||||
#endif
|
#endif
|
||||||
/// @returns true if the slot/tool index is within specified range (0 - config::toolCount)
|
/// @returns true if the slot/tool index is within specified range (0 - config::toolCount)
|
||||||
/// If not, it returns false and sets the error to ErrorCode::INVALID_TOOL
|
/// If not, it returns false and sets the error to ErrorCode::INVALID_TOOL
|
||||||
bool CheckToolIndex(uint8_t index);
|
bool
|
||||||
|
CheckToolIndex(uint8_t index);
|
||||||
|
|
||||||
/// Checks for errors of modules - that includes TMC errors, Idler and Selector errors and possibly more.
|
/// Checks for errors of modules - that includes TMC errors, Idler and Selector errors and possibly more.
|
||||||
/// The idea is to check blocking errors at one spot consistently.
|
/// The idea is to check blocking errors at one spot consistently.
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,7 @@ bool EjectFilament::StepInner() {
|
||||||
mui::Event ev = mui::userInput.ConsumeEvent();
|
mui::Event ev = mui::userInput.ConsumeEvent();
|
||||||
switch (ev) {
|
switch (ev) {
|
||||||
case mui::Event::Middle:
|
case mui::Event::Middle:
|
||||||
|
ResumeIdlerSelector();
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case ErrorCode::FILAMENT_EJECTED: // the user clicked "Done", we can finish the Eject operation
|
case ErrorCode::FILAMENT_EJECTED: // the user clicked "Done", we can finish the Eject operation
|
||||||
FinishedOK();
|
FinishedOK();
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,7 @@ bool LoadFilament::StepInner() {
|
||||||
mui::Event ev = mui::userInput.ConsumeEvent();
|
mui::Event ev = mui::userInput.ConsumeEvent();
|
||||||
switch (ev) {
|
switch (ev) {
|
||||||
case mui::Event::Middle: // try again the whole sequence
|
case mui::Event::Middle: // try again the whole sequence
|
||||||
|
ResumeIdlerSelector();
|
||||||
// however it depends on the state of FINDA - if it is on, we must perform unload first
|
// however it depends on the state of FINDA - if it is on, we must perform unload first
|
||||||
if (!mf::finda.Pressed()) {
|
if (!mf::finda.Pressed()) {
|
||||||
Reset2(false);
|
Reset2(false);
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,8 @@ bool Idler::Step() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case OnHold:
|
||||||
|
return true; // just wait, do nothing!
|
||||||
case TMCFailed:
|
case TMCFailed:
|
||||||
dbg_logic_P(PSTR("Idler Failed"));
|
dbg_logic_P(PSTR("Idler Failed"));
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ public:
|
||||||
HomeForward,
|
HomeForward,
|
||||||
HomeBack,
|
HomeBack,
|
||||||
TMCFailed,
|
TMCFailed,
|
||||||
HomingFailed
|
HomingFailed,
|
||||||
|
OnHold,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Operation (Engage/Disengage/MoveToSlot) return values
|
/// Operation (Engage/Disengage/MoveToSlot) return values
|
||||||
|
|
@ -72,6 +73,11 @@ public:
|
||||||
/// iRun == 0 means set the default from config
|
/// iRun == 0 means set the default from config
|
||||||
void SetCurrents(uint8_t iRun, uint8_t iHold);
|
void SetCurrents(uint8_t iRun, uint8_t iHold);
|
||||||
|
|
||||||
|
/// Puts the movable on-hold
|
||||||
|
void HoldOn() { state = OnHold; }
|
||||||
|
/// Allows the movable to move/home again
|
||||||
|
void Resume() { state = Ready; }
|
||||||
|
|
||||||
#ifndef UNITTEST
|
#ifndef UNITTEST
|
||||||
protected:
|
protected:
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ bool Pulley::Step() {
|
||||||
return true;
|
return true;
|
||||||
case Ready:
|
case Ready:
|
||||||
return true;
|
return true;
|
||||||
|
case OnHold:
|
||||||
|
return true;
|
||||||
case TMCFailed:
|
case TMCFailed:
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,8 @@ bool Selector::Step() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case OnHold:
|
||||||
|
return true; // just wait, do nothing!
|
||||||
case TMCFailed:
|
case TMCFailed:
|
||||||
dbg_logic_P(PSTR("Selector Failed"));
|
dbg_logic_P(PSTR("Selector Failed"));
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue