Make Idler and Selector only wait for their own axis

... and fix the unit tests for this
pull/112/head
D.R.racer 2021-08-27 09:07:20 +02:00 committed by DRracer
parent 5571e77809
commit ffe5bc2807
5 changed files with 11 additions and 9 deletions

View File

@ -51,8 +51,7 @@ bool Idler::Home() {
bool Idler::Step() {
switch (state) {
case Moving:
if (mm::motion.QueueEmpty()) { //@@TODO this will block until all axes made their movements,
// not sure if that is something we want
if (mm::motion.QueueEmpty(mm::Idler)) {
// move finished
state = Ready;
}
@ -71,10 +70,5 @@ bool Idler::Step() {
}
}
//hal::tmc2130::MotorParams Idler::TMCDriverParams() const {
// return
//}
} // namespace idler
} // namespace modules

View File

@ -62,6 +62,10 @@ bool Motion::QueueEmpty() const {
return true;
}
bool Motion::QueueEmpty(config::Axis axis) const {
return axisData[axis].ctrl.QueueEmpty();
}
void Motion::AbortPlannedMoves(bool halt) {
for (uint8_t i = 0; i != NUM_AXIS; ++i)
axisData[i].ctrl.AbortPlannedMoves(halt);

View File

@ -239,7 +239,7 @@ public:
/// @returns true if all planned moves have been finished for one axis
/// @param axis requested
bool QueueEmpty(Axis axis) const { return axisData[axis].ctrl.QueueEmpty(); }
bool QueueEmpty(Axis axis) const;
/// @returns false if new moves can still be planned for one axis
/// @param axis axis requested

View File

@ -36,7 +36,7 @@ bool Selector::Home() {
bool Selector::Step() {
switch (state) {
case Moving:
if (mm::motion.QueueEmpty()) {
if (mm::motion.QueueEmpty(mm::Selector)) {
// move finished
state = Ready;
}

View File

@ -65,6 +65,10 @@ bool Motion::QueueEmpty() const {
return true;
}
bool Motion::QueueEmpty(Axis axis) const {
return axes[axis].pos == axes[axis].targetPos;
}
void Motion::AbortPlannedMoves(bool halt) {
for (uint8_t i = 0; i < 3; ++i) {
axes[i].targetPos = axes[i].pos; // leave the axis where it was at the time of abort