diff --git a/src/seleneAngleAxis.cpp b/src/seleneAngleAxis.cpp index 2d6dd25..01d445b 100644 --- a/src/seleneAngleAxis.cpp +++ b/src/seleneAngleAxis.cpp @@ -56,21 +56,20 @@ asynStatus seleneAngleAxis::doMove(double position, int relative, axisNo_, __PRETTY_FUNCTION__, __LINE__); } - targetPosition_ = position * motorRecResolution; + setTargetPosition(position * motorRecResolution); targetSet_ = true; return liftAxis_->startCombinedMoveFromVirtualAxis(); targetSet_ = false; } -asynStatus seleneAngleAxis::targetPosition(double *targetPosition) { - asynStatus status = asynSuccess; - +double seleneAngleAxis::targetPosition() { if (targetSet_) { - *targetPosition = targetPosition_; + return turboPmacAxis::targetPosition(); } else { - status = motorPosition(targetPosition); + double targetPos = 0; + motorPosition(&targetPos); + return targetPos; } - return status; } asynStatus seleneAngleAxis::doPoll(bool *moving) { diff --git a/src/seleneAngleAxis.h b/src/seleneAngleAxis.h index 7c174ad..1634488 100644 --- a/src/seleneAngleAxis.h +++ b/src/seleneAngleAxis.h @@ -102,13 +102,11 @@ class seleneAngleAxis : public turboPmacAxis { double acceleration, int forwards); /** - * @brief Read the target position from the axis and write it into the - * provided pointer. + * @brief Override of the superclass method * - * @param targetPosition - * @return asynStatus + * @return double */ - asynStatus targetPosition(double *targetPosition); + double targetPosition(); /** * @brief Set the offsets of axis 3 and 4 to zero and recalculate all other diff --git a/src/seleneLiftAxis.cpp b/src/seleneLiftAxis.cpp index 8c024cd..4febb24 100644 --- a/src/seleneLiftAxis.cpp +++ b/src/seleneLiftAxis.cpp @@ -472,22 +472,21 @@ asynStatus seleneLiftAxis::doMove(double position, int relative, return pC_->paramLibAccessFailed(status, "motorRecResolution_", axisNo_, __PRETTY_FUNCTION__, __LINE__); } - targetPosition_ = position * motorRecResolution; + setTargetPosition(position * motorRecResolution); targetSet_ = true; status = startCombinedMoveFromVirtualAxis(); targetSet_ = false; return status; } -asynStatus seleneLiftAxis::targetPosition(double *targetPosition) { - asynStatus status = asynSuccess; - +double seleneLiftAxis::targetPosition() { if (targetSet_) { - *targetPosition = targetPosition_; + return turboPmacAxis::targetPosition(); } else { - status = motorPosition(targetPosition); + double targetPos = 0; + motorPosition(&targetPos); + return targetPos; } - return status; } asynStatus seleneLiftAxis::startCombinedMove() { @@ -500,26 +499,15 @@ asynStatus seleneLiftAxis::startCombinedMove() { // ========================================================================= - status = targetPosition(&liftTargetPosition); - if (status != asynSuccess) { - return status; - } - - status = angleAxis_->targetPosition(&angleTargetPosition); - if (status != asynSuccess) { - return status; - } + liftTargetPosition = targetPosition(); + angleTargetPosition = angleAxis_->targetPosition(); auto targetPositions = positionsFromLiftAndAngle(liftTargetPosition, angleTargetPosition); // Apply the offsets of the individual offset axes for (int i = 0; i < numAxes_; i++) { - double offsetTargetPosition = 0.0; - status = offsetAxes_[i]->targetPosition(&offsetTargetPosition); - if (status != asynSuccess) { - return status; - } - targetPositions[i] = targetPositions[i] + offsetTargetPosition; + targetPositions[i] = + targetPositions[i] + offsetAxes_[i]->targetPosition(); } // Set all target positions and send the move command diff --git a/src/seleneLiftAxis.h b/src/seleneLiftAxis.h index ecd767e..7f6da82 100644 --- a/src/seleneLiftAxis.h +++ b/src/seleneLiftAxis.h @@ -256,13 +256,11 @@ class seleneLiftAxis : public turboPmacAxis { bool virtualAxisMovement() { return virtualAxisMovement_; } /** - * @brief Read the target position from the axis and write it into the - * provided pointer. + * @brief Override of the superclass method * - * @param targetPosition - * @return asynStatus + * @return double */ - asynStatus targetPosition(double *targetPosition); + double targetPosition(); /** * @brief Access the position of the lift axis diff --git a/src/seleneOffsetAxis.cpp b/src/seleneOffsetAxis.cpp index 83c8a9e..35da4d9 100644 --- a/src/seleneOffsetAxis.cpp +++ b/src/seleneOffsetAxis.cpp @@ -151,15 +151,14 @@ asynStatus seleneOffsetAxis::init() { return status; } -asynStatus seleneOffsetAxis::targetPosition(double *targetPosition) { - asynStatus status = asynSuccess; - +double seleneOffsetAxis::targetPosition() { if (targetSet_) { - *targetPosition = targetPosition_; + return turboPmacAxis::targetPosition(); } else { - status = motorPosition(targetPosition); + double targetPos = 0; + motorPosition(&targetPos); + return targetPos; } - return status; } asynStatus seleneOffsetAxis::doPoll(bool *moving) { @@ -332,7 +331,7 @@ asynStatus seleneOffsetAxis::doMove(double position, int relative, } // Set the target position - targetPosition_ = position * motorRecResolution; + setTargetPosition(position * motorRecResolution); targetSet_ = true; asynStatus status = liftAxis_->startCombinedMoveFromOffsetAxis(); targetSet_ = false; diff --git a/src/seleneOffsetAxis.h b/src/seleneOffsetAxis.h index b13c01b..1687f59 100644 --- a/src/seleneOffsetAxis.h +++ b/src/seleneOffsetAxis.h @@ -81,13 +81,11 @@ class seleneOffsetAxis : public turboPmacAxis { asynStatus setPositionsFromEncoderPosition(double encoderPosition); /** - * @brief Read the target position from the axis and write it into the - * provided pointer. + * @brief Override of the superclass method * - * @param targetPosition - * @return asynStatus + * @return double */ - asynStatus targetPosition(double *targetPosition); + double targetPosition(); /** * @brief Set the offsets of axis 3 and 4 to zero and recalculate all other