Rehome all movables if any of them fails to home

pull/259/head
D.R.racer 2023-02-17 09:30:46 +01:00
parent 9fce324bff
commit fbfbfbe809
2 changed files with 18 additions and 2 deletions

View File

@ -99,7 +99,16 @@ bool CommandBase::WaitForOneModuleErrorRecovery(ErrorCode ec, modules::motion::M
mui::Event ev = mui::userInput.ConsumeEvent();
if (ev == mui::Event::Middle) {
recoveringMovableErrorAxisMask |= axisMask;
m.PlanHome(); // force initiate a new homing attempt
// @@TODO this may be the best spot to initiate rehoming of BOTH movables - Idler AND Selector.
// It is merely a workaround to allow disabling power to both axes when one of the fails to home - to allow servicing.
//m.PlanHome(); // force initiate a new homing attempt
mi::idler.InvalidateHoming();
mi::idler.PlanHome();
ms::selector.InvalidateHoming();
ms::selector.PlanHome();
state = ProgressCode::Homing;
error = ErrorCode::RUNNING;
}
@ -129,6 +138,7 @@ bool CommandBase::WaitForOneModuleErrorRecovery(ErrorCode ec, modules::motion::M
}
bool CommandBase::WaitForModulesErrorRecovery() {
// Beware, the order is important, Idler must come before Selector because of homing precedence.
bool rv = WaitForOneModuleErrorRecovery(CheckMovable(mi::idler), mi::idler, 0x1);
rv |= WaitForOneModuleErrorRecovery(CheckMovable(ms::selector), ms::selector, 0x2);
rv |= WaitForOneModuleErrorRecovery(CheckMovable(mpu::pulley), mpu::pulley, 0x4);

View File

@ -88,7 +88,13 @@ void MovableBase::HomeFailed() {
// we ran out of planned moves but no StallGuard event has occurred
// or the measured length of axis was not within the accepted tolerance
homingValid = false;
mm::motion.Disable(axis); // disable power to the axis - allows the user to do something with the device manually
// Explicitly cut the power to all the axes, the user will probably want to move one or the other.
// Rehoming of all the axes will happen after the error gets resolved.
mm::motion.Disable(mm::Idler);
mm::motion.Disable(mm::Selector);
mm::motion.Disable(mm::Pulley);
state = HomingFailed;
}