Remove Enable/Disable TMC when reiniting Movable axes
The previous commits by @leptun were correct but there has been one call to Disable axis (and TMC) hidden in `InitMovement`. Therefore `InitMovement` has been split into 2 separate functions - one is there to allow the original full axis reinit, but the other `InitMovementNoReinitAxis` now only prepares a move without reiniting the TMC driver. This approach seems to have the benefit of fixing the Idler creep over time. The disadvantage is the fact, that setting StallGuard threshold is no longer called. We may need to add a special piece of code to handle/apply SGTHRS change at runtime like before.pull/224/head
parent
e2924c3506
commit
dc487c36b6
|
|
@ -83,7 +83,7 @@ Idler::OperationResult Idler::Disengage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// disengaging
|
// disengaging
|
||||||
return InitMovement();
|
return InitMovementNoReinitAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
Idler::OperationResult Idler::PartiallyDisengage(uint8_t slot) {
|
Idler::OperationResult Idler::PartiallyDisengage(uint8_t slot) {
|
||||||
|
|
@ -122,7 +122,7 @@ Idler::OperationResult Idler::PlanMoveInner(uint8_t slot, Operation plannedOp) {
|
||||||
return OperationResult::Accepted;
|
return OperationResult::Accepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
return InitMovement();
|
return InitMovementNoReinitAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Idler::Step() {
|
bool Idler::Step() {
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,19 @@ void MovableBase::PlanHome() {
|
||||||
MovableBase::OperationResult MovableBase::InitMovement() {
|
MovableBase::OperationResult MovableBase::InitMovement() {
|
||||||
mm::motion.PlanStallGuardThreshold(axis, mg::globals.StallGuardThreshold(axis));
|
mm::motion.PlanStallGuardThreshold(axis, mg::globals.StallGuardThreshold(axis));
|
||||||
if (motion.InitAxis(axis)) {
|
if (motion.InitAxis(axis)) {
|
||||||
PrepareMoveToPlannedSlot();
|
return InitMovementNoReinitAxis();
|
||||||
state = Moving;
|
|
||||||
return OperationResult::Accepted;
|
|
||||||
} else {
|
} else {
|
||||||
state = TMCFailed;
|
state = TMCFailed;
|
||||||
return OperationResult::Failed;
|
return OperationResult::Failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MovableBase::OperationResult MovableBase::InitMovementNoReinitAxis() {
|
||||||
|
PrepareMoveToPlannedSlot();
|
||||||
|
state = Moving;
|
||||||
|
return OperationResult::Accepted;
|
||||||
|
}
|
||||||
|
|
||||||
void MovableBase::PerformMove() {
|
void MovableBase::PerformMove() {
|
||||||
if (mm::motion.QueueEmpty(axis)) {
|
if (mm::motion.QueueEmpty(axis)) {
|
||||||
// move finished
|
// move finished
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,13 @@ protected:
|
||||||
virtual bool FinishHomingAndPlanMoveToParkPos() = 0;
|
virtual bool FinishHomingAndPlanMoveToParkPos() = 0;
|
||||||
virtual void FinishMove() = 0;
|
virtual void FinishMove() = 0;
|
||||||
|
|
||||||
|
/// Initializes movement of a movable module.
|
||||||
|
/// Beware: this operation reinitializes the axis/TMC driver as well (may introduce axis creep as we have seen on the Idler)
|
||||||
OperationResult InitMovement();
|
OperationResult InitMovement();
|
||||||
|
|
||||||
|
/// Initializes movement of a movable module without reinitializing the axis/TMC driver
|
||||||
|
OperationResult InitMovementNoReinitAxis();
|
||||||
|
|
||||||
void PerformMove();
|
void PerformMove();
|
||||||
|
|
||||||
void PerformHomeForward();
|
void PerformHomeForward();
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ Selector::OperationResult Selector::MoveToSlot(uint8_t slot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// do the move
|
// do the move
|
||||||
return InitMovement();
|
return InitMovementNoReinitAxis();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Selector::Step() {
|
bool Selector::Step() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue