Check for tmc2130 error flags
parent
8b2de34e34
commit
739f4cd2a3
|
|
@ -143,7 +143,7 @@ public:
|
||||||
sg_filter_counter = sg_filter_threshold;
|
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);
|
bool CheckForErrors(const MotorParams ¶ms);
|
||||||
|
|
||||||
inline ErrorFlags GetErrorFlags() const {
|
inline ErrorFlags GetErrorFlags() const {
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,9 @@ 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,7 +36,7 @@ MovableBase::OperationResult MovableBase::InitMovement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovableBase::PerformMove() {
|
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
|
// 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
|
||||||
state = TMCFailed;
|
state = TMCFailed;
|
||||||
|
|
@ -86,5 +86,14 @@ void MovableBase::HomeFailed() {
|
||||||
state = HomingFailed;
|
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 motion
|
||||||
} // namespace modules
|
} // namespace modules
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,8 @@ protected:
|
||||||
void PerformHomeBack();
|
void PerformHomeBack();
|
||||||
|
|
||||||
void HomeFailed();
|
void HomeFailed();
|
||||||
|
|
||||||
|
void IdleChecks();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace motion
|
} // namespace motion
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,9 @@ bool Pulley::Step() {
|
||||||
case Ready:
|
case Ready:
|
||||||
return true;
|
return true;
|
||||||
case TMCFailed:
|
case TMCFailed:
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
|
IdleChecks();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,9 @@ 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