Suspend all moves of Idler and Selector when entering an Error screen

pull/262/head
D.R.racer 2023-02-24 16:16:39 +01:00 committed by DRracer
parent 436ebcbeee
commit d75119c8d6
8 changed files with 37 additions and 2 deletions

View File

@ -153,6 +153,7 @@ void CommandBase::Panic(ErrorCode ec) {
}
void CommandBase::InvalidateHoming() {
ResumeIdlerSelector();
mi::idler.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) {
if (index >= config::toolCount) {
error = ErrorCode::INVALID_TOOL;
@ -195,6 +208,7 @@ void CommandBase::ErrDisengagingIdler() {
mg::globals.IncDriveErrors();
mpu::pulley.Disable();
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
}
}

View File

@ -95,12 +95,19 @@ public:
/// filament presence according to known sensors (FINDA+FSensor)
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
protected:
#endif
/// @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
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.
/// The idea is to check blocking errors at one spot consistently.

View File

@ -77,6 +77,7 @@ bool EjectFilament::StepInner() {
mui::Event ev = mui::userInput.ConsumeEvent();
switch (ev) {
case mui::Event::Middle:
ResumeIdlerSelector();
switch (error) {
case ErrorCode::FILAMENT_EJECTED: // the user clicked "Done", we can finish the Eject operation
FinishedOK();

View File

@ -122,6 +122,7 @@ bool LoadFilament::StepInner() {
mui::Event ev = mui::userInput.ConsumeEvent();
switch (ev) {
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
if (!mf::finda.Pressed()) {
Reset2(false);

View File

@ -148,6 +148,8 @@ bool Idler::Step() {
return false;
}
return true;
case OnHold:
return true; // just wait, do nothing!
case TMCFailed:
dbg_logic_P(PSTR("Idler Failed"));
default:

View File

@ -18,7 +18,8 @@ public:
HomeForward,
HomeBack,
TMCFailed,
HomingFailed
HomingFailed,
OnHold,
};
/// Operation (Engage/Disengage/MoveToSlot) return values
@ -72,6 +73,11 @@ public:
/// iRun == 0 means set the default from config
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
protected:
#endif

View File

@ -31,6 +31,8 @@ bool Pulley::Step() {
return true;
case Ready:
return true;
case OnHold:
return true;
case TMCFailed:
default:
return true;

View File

@ -124,6 +124,8 @@ bool Selector::Step() {
return false;
}
return true;
case OnHold:
return true; // just wait, do nothing!
case TMCFailed:
dbg_logic_P(PSTR("Selector Failed"));
default: