Cleanup HoldOn-Resume code in movables

pull/262/head
D.R.racer 2023-03-01 08:07:28 +01:00 committed by DRracer
parent e089a84f48
commit d2a2014b89
3 changed files with 12 additions and 9 deletions

View File

@ -179,15 +179,8 @@ void CommandBase::InvalidateHomingAndFilamentState() {
}
void CommandBase::HoldIdlerSelector() {
mm::motion.AbortPlannedMoves(mm::Idler);
mi::idler.HoldOn();
mm::motion.AbortPlannedMoves(mm::Selector);
ms::selector.HoldOn();
// Force turn off motors - prevent overheating and allow servicing during and error state.
// And don't worry about TMC2130 creep after axis enabled - we'll rehome both axes later when needed.
mm::motion.Disable(mm::Idler);
mm::motion.Disable(mm::Selector);
}
void CommandBase::ResumeIdlerSelector() {

View File

@ -31,6 +31,14 @@ void __attribute__((noinline)) MovableBase::SetCurrents(uint8_t iRun, uint8_t iH
mm::motion.DriverForAxis(axis).SetCurrents(mm::axisParams[axis].params, tempCurrent);
}
void MovableBase::HoldOn() {
state = OnHold;
mm::motion.AbortPlannedMoves(axis);
// Force turn off motors - prevent overheating and allow servicing during an error state.
// And don't worry about TMC2130 creep after axis enabled - we'll rehome both axes later when needed.
mm::motion.Disable(axis);
}
MovableBase::OperationResult MovableBase::InitMovement() {
if (motion.InitAxis(axis)) {
return InitMovementNoReinitAxis();

View File

@ -75,8 +75,10 @@ public:
void SetCurrents(uint8_t iRun, uint8_t iHold);
/// Puts the movable on-hold
void HoldOn() { state = OnHold; }
/// Allows the movable to move/home again
/// Also, disables the axis
void HoldOn();
/// Allows the movable to move/home again after begin suspended by HoldOn
void Resume() { state = Ready; }
#ifndef UNITTEST