Check for tmc2130 error flags
parent
8b2de34e34
commit
739f4cd2a3
|
|
@ -143,7 +143,7 @@ public:
|
|||
sg_filter_counter = sg_filter_threshold;
|
||||
}
|
||||
|
||||
/// Should be called periodically from main loop. Maybe not all the time. Once every 10 ms is probably enough
|
||||
/// Should be called periodically. Maybe not all the time. Once every 10 ms is probably enough
|
||||
bool CheckForErrors(const MotorParams ¶ms);
|
||||
|
||||
inline ErrorFlags GetErrorFlags() const {
|
||||
|
|
|
|||
|
|
@ -142,7 +142,9 @@ bool Idler::Step() {
|
|||
return true;
|
||||
case TMCFailed:
|
||||
dbg_logic_P(PSTR("Idler Failed"));
|
||||
return true;
|
||||
default:
|
||||
IdleChecks();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ MovableBase::OperationResult MovableBase::InitMovement() {
|
|||
}
|
||||
|
||||
void MovableBase::PerformMove() {
|
||||
if (!mm::motion.DriverForAxis(axis).GetErrorFlags().Good()) { // @@TODO check occasionally, i.e. not every time?
|
||||
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
|
||||
tmcErrorFlags = mm::motion.DriverForAxis(axis).GetErrorFlags(); // save the failed state
|
||||
state = TMCFailed;
|
||||
|
|
@ -86,5 +86,14 @@ void MovableBase::HomeFailed() {
|
|||
state = HomingFailed;
|
||||
}
|
||||
|
||||
void MovableBase::IdleChecks() {
|
||||
// perform maintenance tasks while no motion is happening
|
||||
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
|
||||
tmcErrorFlags = mm::motion.DriverForAxis(axis).GetErrorFlags(); // save the failed state
|
||||
state = TMCFailed;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace motion
|
||||
} // namespace modules
|
||||
|
|
|
|||
|
|
@ -103,6 +103,8 @@ protected:
|
|||
void PerformHomeBack();
|
||||
|
||||
void HomeFailed();
|
||||
|
||||
void IdleChecks();
|
||||
};
|
||||
|
||||
} // namespace motion
|
||||
|
|
|
|||
|
|
@ -28,7 +28,9 @@ bool Pulley::Step() {
|
|||
case Ready:
|
||||
return true;
|
||||
case TMCFailed:
|
||||
return true;
|
||||
default:
|
||||
IdleChecks();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,9 @@ bool Selector::Step() {
|
|||
return true;
|
||||
case TMCFailed:
|
||||
dbg_logic_P(PSTR("Selector Failed"));
|
||||
return true;
|
||||
default:
|
||||
IdleChecks();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue