Always check for tmc errors
parent
ecb1696a12
commit
55e8caa054
|
|
@ -121,6 +121,10 @@ Idler::OperationResult Idler::PlanMoveInner(uint8_t slot, Operation plannedOp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Idler::Step() {
|
bool Idler::Step() {
|
||||||
|
if (state != TMCFailed) {
|
||||||
|
CheckTMC();
|
||||||
|
}
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Moving:
|
case Moving:
|
||||||
// dbg_logic_P(PSTR("Moving Idler"));
|
// dbg_logic_P(PSTR("Moving Idler"));
|
||||||
|
|
@ -142,9 +146,7 @@ bool Idler::Step() {
|
||||||
return true;
|
return true;
|
||||||
case TMCFailed:
|
case TMCFailed:
|
||||||
dbg_logic_P(PSTR("Idler Failed"));
|
dbg_logic_P(PSTR("Idler Failed"));
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
IdleChecks();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,7 @@ MovableBase::OperationResult MovableBase::InitMovement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovableBase::PerformMove() {
|
void MovableBase::PerformMove() {
|
||||||
if (mm::motion.DriverForAxis(axis).CheckForErrors(axisParams[axis].params)) {
|
if (mm::motion.QueueEmpty(axis)) {
|
||||||
// TMC2130 entered some error state, the planned move couldn't have been finished - result of operation is Failed
|
|
||||||
tmcErrorFlags = mm::motion.DriverForAxis(axis).GetErrorFlags(); // save the failed state
|
|
||||||
mm::motion.AbortPlannedMoves(axis, true);
|
|
||||||
state = TMCFailed;
|
|
||||||
} else if (mm::motion.QueueEmpty(axis)) {
|
|
||||||
// move finished
|
// move finished
|
||||||
currentSlot = plannedSlot;
|
currentSlot = plannedSlot;
|
||||||
FinishMove();
|
FinishMove();
|
||||||
|
|
@ -87,8 +82,7 @@ void MovableBase::HomeFailed() {
|
||||||
state = HomingFailed;
|
state = HomingFailed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovableBase::IdleChecks() {
|
void MovableBase::CheckTMC() {
|
||||||
// perform maintenance tasks while no motion is happening
|
|
||||||
if (mm::motion.DriverForAxis(axis).CheckForErrors(axisParams[axis].params)) {
|
if (mm::motion.DriverForAxis(axis).CheckForErrors(axisParams[axis].params)) {
|
||||||
// TMC2130 entered some error state, the planned move couldn't have been finished - result of operation is Failed
|
// TMC2130 entered some error state, the planned move couldn't have been finished - result of operation is Failed
|
||||||
tmcErrorFlags = mm::motion.DriverForAxis(axis).GetErrorFlags(); // save the failed state
|
tmcErrorFlags = mm::motion.DriverForAxis(axis).GetErrorFlags(); // save the failed state
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ protected:
|
||||||
|
|
||||||
void HomeFailed();
|
void HomeFailed();
|
||||||
|
|
||||||
void IdleChecks();
|
void CheckTMC();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace motion
|
} // namespace motion
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,10 @@ bool Pulley::FinishHomingAndPlanMoveToParkPos() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Pulley::Step() {
|
bool Pulley::Step() {
|
||||||
|
if (state != TMCFailed) {
|
||||||
|
CheckTMC();
|
||||||
|
}
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Moving:
|
case Moving:
|
||||||
PerformMove();
|
PerformMove();
|
||||||
|
|
@ -28,9 +32,7 @@ bool Pulley::Step() {
|
||||||
case Ready:
|
case Ready:
|
||||||
return true;
|
return true;
|
||||||
case TMCFailed:
|
case TMCFailed:
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
IdleChecks();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,10 @@ Selector::OperationResult Selector::MoveToSlot(uint8_t slot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Selector::Step() {
|
bool Selector::Step() {
|
||||||
|
if (state != TMCFailed) {
|
||||||
|
CheckTMC();
|
||||||
|
}
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case Moving:
|
case Moving:
|
||||||
PerformMove();
|
PerformMove();
|
||||||
|
|
@ -122,9 +126,7 @@ bool Selector::Step() {
|
||||||
return true;
|
return true;
|
||||||
case TMCFailed:
|
case TMCFailed:
|
||||||
dbg_logic_P(PSTR("Selector Failed"));
|
dbg_logic_P(PSTR("Selector Failed"));
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
IdleChecks();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue