motion: Remove motion.ResetAxesData

Use motion.SetPosition directly to minimize redundant code which is used
for unit tests only.
pull/153/head
Yuri D'Elia 2022-01-30 12:05:52 +01:00 committed by DRracer
parent 2e32204d17
commit cabf284882
2 changed files with 6 additions and 7 deletions

View File

@ -288,12 +288,6 @@ public:
bool QueueEmpty(Axis axis) const {
return axisData[axis].ctrl.QueueEmpty();
}
void ResetAxesData() {
for (uint8_t i = 0; i != NUM_AXIS; ++i) {
axisData[i].ctrl.SetPosition(0);
}
}
#else
// Force STUB for testing
bool QueueEmpty(Axis axis) const;

View File

@ -28,9 +28,14 @@ ssize_t stepUntilDone(size_t maxSteps = 100000) {
void ResetMotionSim() {
stepUntilDone();
REQUIRE(motion.QueueEmpty());
motion.ResetAxesData();
motion.SetPosition(Idler, 0);
REQUIRE(motion.Position(Idler) == 0);
motion.SetPosition(Selector, 0);
REQUIRE(motion.Position(Selector) == 0);
motion.SetPosition(Pulley, 0);
REQUIRE(motion.Position(Pulley) == 0);
}