Updated turboPmac version

This commit is contained in:
2025-06-17 16:51:08 +02:00
parent 6e99b37ed2
commit cf6f836416
7 changed files with 105 additions and 467 deletions

View File

@ -157,17 +157,8 @@ asynStatus detectorTowerAngleAxis::init() {
} }
// Initialize the motorStatusMoving flag // Initialize the motorStatusMoving flag
status = setIntegerParam(pC_->motorStatusMoving(), 0); setAxisParamChecked(this, motorStatusMoving, false);
if (status != asynSuccess) { setAxisParamChecked(this, changeStateRBV, positionState == 2);
return pC_->paramLibAccessFailed(status, "motorStatusMoving_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
status = setIntegerParam(pC_->changeStateRBV(), positionState == 2);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "changeStateRBV", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
return callParamCallbacks(); return callParamCallbacks();
} }
@ -181,13 +172,7 @@ asynStatus detectorTowerAngleAxis::poll(bool *moving) {
if (axisNo() < liftAxis()->axisNo() && axisNo() < supportAxis()->axisNo()) { if (axisNo() < liftAxis()->axisNo() && axisNo() < supportAxis()->axisNo()) {
status = pC_->pollDetectorAxes(moving, this, liftAxis(), supportAxis()); status = pC_->pollDetectorAxes(moving, this, liftAxis(), supportAxis());
} else { } else {
status = pC_->getIntegerParam(axisNo(), pC_->motorStatusMoving(), getAxisParamChecked(this, motorStatusMoving, &moving);
(int *)moving);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorStatusMoving",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
} }
setWasMoving(*moving); setWasMoving(*moving);
return status; return status;
@ -206,13 +191,7 @@ asynStatus detectorTowerAngleAxis::doMove(double position, int relative,
double max_velocity, double max_velocity,
double acceleration) { double acceleration) {
double motorRecResolution = 0.0; double motorRecResolution = 0.0;
asynStatus plStatus = pC_->getDoubleParam( getAxisParamChecked(this, motorRecResolution, &motorRecResolution);
axisNo_, pC_->motorRecResolution(), &motorRecResolution);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "motorRecResolution_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
// Signal to the deferredMovementCollectorLoop that a movement should be // Signal to the deferredMovementCollectorLoop that a movement should be
// started to the defined target position. // started to the defined target position.
@ -237,12 +216,7 @@ asynStatus detectorTowerAngleAxis::startCombinedMove() {
// ========================================================================= // =========================================================================
plStatus = getAxisParamChecked(this, positionStateRBV, &positionState);
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "positionStateRBV_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
// If the axis is in changer position, it must be moved into working // If the axis is in changer position, it must be moved into working
// position before any move can be started. // position before any move can be started.
@ -259,20 +233,9 @@ asynStatus detectorTowerAngleAxis::startCombinedMove() {
pC_->getMsgPrintControl().getSuffix()); pC_->getMsgPrintControl().getSuffix());
} }
if (isInChangerPos) { if (isInChangerPos) {
setAxisParamChecked(this, motorMessageText,
plStatus = setStringParam(pC_->motorMessageText(), "Move the axis to working state first.");
"Move the axis to working state first."); setAxisParamChecked(this, motorStatusProblem, true);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "motorMessageText",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
plStatus = setIntegerParam(pC_->motorStatusProblem(), true);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "motorStatusProblem_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
callParamCallbacks(); callParamCallbacks();
startingDeferredMovement_ = false; startingDeferredMovement_ = false;
@ -301,12 +264,7 @@ asynStatus detectorTowerAngleAxis::startCombinedMove() {
"target position %lf failed.\n", "target position %lf failed.\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
motorCoordinatesPosition); motorCoordinatesPosition);
plStatus = setIntegerParam(pC_->motorStatusProblem(), true); setAxisParamChecked(this, motorStatusProblem, true);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "motorStatusProblem_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
callParamCallbacks(); callParamCallbacks();
} }
@ -334,12 +292,7 @@ asynStatus detectorTowerAngleAxis::stop(double acceleration) {
"failed.\n", "failed.\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__); pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
plStatus = setIntegerParam(pC_->motorStatusProblem(), true); setAxisParamChecked(this, motorStatusProblem, true);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "motorStatusProblem_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
return asynError; return asynError;
} }
@ -352,11 +305,7 @@ asynStatus detectorTowerAngleAxis::stop(double acceleration) {
// The detector tower axis uses absolute encoders // The detector tower axis uses absolute encoders
asynStatus detectorTowerAngleAxis::readEncoderType() { asynStatus detectorTowerAngleAxis::readEncoderType() {
asynStatus status = setStringParam(pC_->encoderType(), AbsoluteEncoder); setAxisParamChecked(this, encoderType, AbsoluteEncoder);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "encoderType_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
return asynSuccess; return asynSuccess;
} }
@ -368,9 +317,6 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
// Status of read-write-operations of ASCII commands to the controller // Status of read-write-operations of ASCII commands to the controller
asynStatus rwStatus = asynSuccess; asynStatus rwStatus = asynSuccess;
// Status of parameter library operations
asynStatus plStatus = asynSuccess;
bool moving = false; bool moving = false;
int positionState = 0; int positionState = 0;
@ -381,12 +327,7 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
return rwStatus; return rwStatus;
} }
plStatus = getAxisParamChecked(this, positionStateRBV, &positionState);
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "positionStateRBV_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
if (moving) { if (moving) {
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR, asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
@ -396,21 +337,10 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
toChangingPosition ? "changer" : "working", toChangingPosition ? "changer" : "working",
pC_->getMsgPrintControl().getSuffix()); pC_->getMsgPrintControl().getSuffix());
plStatus = setStringParam( setAxisParamChecked(
pC_->motorMessageText(), this, motorMessageText,
"Axis cannot be moved to changer position while it is moving."); "Axis cannot be moved to changer position while it is moving.");
if (plStatus != asynSuccess) { setAxisParamChecked(this, changeStateRBV, !toChangingPosition);
return pC_->paramLibAccessFailed(plStatus, "motorMessageText_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
plStatus = setIntegerParam(pC_->changeStateRBV(), !toChangingPosition);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "changeStateRBV",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
return asynError; return asynError;
} }
@ -428,12 +358,7 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
pC_->getMsgPrintControl().getSuffix()); pC_->getMsgPrintControl().getSuffix());
// Update the PV anyway, even though nothing changed. // Update the PV anyway, even though nothing changed.
plStatus = setIntegerParam(pC_->changeStateRBV(), toChangingPosition); setAxisParamChecked(this, changeStateRBV, toChangingPosition);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "changeStateRBV",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
return asynSuccess; return asynSuccess;
} }
@ -445,22 +370,8 @@ detectorTowerAngleAxis::toggleWorkingChangerState(bool toChangingPosition) {
rwStatus = pC_->writeRead(axisNo_, "P350=3", response, 0); rwStatus = pC_->writeRead(axisNo_, "P350=3", response, 0);
} }
if (plStatus != asynSuccess) { setAxisParamChecked(this, changeStateRBV, toChangingPosition);
plStatus = setIntegerParam(pC_->changeStateRBV(), !toChangingPosition); return asynSuccess;
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "changeStateRBV",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
}
plStatus = setIntegerParam(pC_->changeStateRBV(), toChangingPosition);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "changeStateRBV", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
return rwStatus;
} }
asynStatus detectorTowerAngleAxis::adjustOrigin(double newOrigin) { asynStatus detectorTowerAngleAxis::adjustOrigin(double newOrigin) {
@ -472,12 +383,7 @@ asynStatus detectorTowerAngleAxis::adjustOrigin(double newOrigin) {
// ========================================================================= // =========================================================================
status = getAxisParamChecked(this, positionStateRBV, &positionState);
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "positionStateRBV_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
// If the axis is in changer position, it must be moved into working // If the axis is in changer position, it must be moved into working
// position before any move can be started. // position before any move can be started.
@ -506,12 +412,7 @@ asynStatus detectorTowerAngleAxis::adjustOrigin(double newOrigin) {
"angle origin %lf failed.\n", "angle origin %lf failed.\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
newOrigin); newOrigin);
status = setIntegerParam(pC_->motorStatusProblem(), true); setAxisParamChecked(this, motorStatusProblem, true);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorStatusProblem_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
} }
return status; return status;
@ -523,12 +424,7 @@ asynStatus detectorTowerAngleAxis::doReset() {
asynStatus plStatus = asynSuccess; asynStatus plStatus = asynSuccess;
int positionState = 0; int positionState = 0;
plStatus = getAxisParamChecked(this, positionStateRBV, &positionState);
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "positionStateRBV_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
// Reset the deferred movement flags // Reset the deferred movement flags
startingDeferredMovement_ = false; startingDeferredMovement_ = false;

View File

@ -1,12 +1,12 @@
#ifndef detectorTowerAngleAxis_H #ifndef detectorTowerAngleAxis_H
#define detectorTowerAngleAxis_H #define detectorTowerAngleAxis_H
#include "detectorTowerController.h"
#include "turboPmacAxis.h" #include "turboPmacAxis.h"
#include <errlog.h> #include <errlog.h>
// Forward declaration of the controller class to resolve the cyclic dependency // Forward declaration of the controller class to resolve the cyclic dependency
// between the controller and the axis .h-file. See // between the controller and the axis .h-file. See
// https://en.cppreference.com/w/cpp/language/class. // https://en.cppreference.com/w/cpp/language/class.
class detectorTowerController;
class detectorTowerLiftAxis; class detectorTowerLiftAxis;
class detectorTowerSupportAxis; class detectorTowerSupportAxis;
@ -164,6 +164,11 @@ class detectorTowerAngleAxis : public turboPmacAxis {
*/ */
int error_; int error_;
/**
* @brief Return a pointer to the axis controller
*/
virtual detectorTowerController *pController() override { return pC_; };
protected: protected:
detectorTowerController *pC_; detectorTowerController *pC_;
detectorTowerLiftAxis *liftAxis_; detectorTowerLiftAxis *liftAxis_;

View File

@ -336,37 +336,13 @@ asynStatus detectorTowerController::pollDetectorAxes(
The motorStatusProblem_ field changes the motor record fields SEVR and STAT. The motorStatusProblem_ field changes the motor record fields SEVR and STAT.
*/ */
plStatus = angleAxis->setIntegerParam(motorStatusProblem(), false); setAxisParamChecked(angleAxis, motorStatusProblem, false);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorStatusProblem, false);
paramLibAccessFailed(plStatus, "motorStatusProblem_", angleAxisNo, setAxisParamChecked(supportAxis, motorStatusProblem, false);
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = liftAxis->setIntegerParam(motorStatusProblem(), false);
if (plStatus != asynSuccess) {
paramLibAccessFailed(plStatus, "motorStatusProblem_", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = supportAxis->setIntegerParam(motorStatusProblem(), false);
if (plStatus != asynSuccess) {
paramLibAccessFailed(plStatus, "motorStatusProblem_", supportAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = angleAxis->setIntegerParam(motorStatusCommsError(), false); setAxisParamChecked(angleAxis, motorStatusCommsError, false);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorStatusCommsError, false);
paramLibAccessFailed(plStatus, "motorStatusCommsError_", angleAxisNo, setAxisParamChecked(supportAxis, motorStatusCommsError, false);
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = liftAxis->setIntegerParam(motorStatusCommsError(), false);
if (plStatus != asynSuccess) {
paramLibAccessFailed(plStatus, "motorStatusCommsError_", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = supportAxis->setIntegerParam(motorStatusCommsError(), false);
if (plStatus != asynSuccess) {
paramLibAccessFailed(plStatus, "motorStatusCommsError_", supportAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
// Read the previous motor positions // Read the previous motor positions
plStatus = angleAxis->motorPosition(&prevAngle); plStatus = angleAxis->motorPosition(&prevAngle);
@ -427,20 +403,12 @@ asynStatus detectorTowerController::pollDetectorAxes(
*/ */
// Angle // Angle
plStatus = getDoubleParam(angleAxisNo, motorLimitsOffset(), &limitsOffset); getAxisParamChecked(angleAxis, motorLimitsOffset, &limitsOffset);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorLimitsOffset_", angleAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
angleHighLimit = angleHighLimit - limitsOffset; angleHighLimit = angleHighLimit - limitsOffset;
angleLowLimit = angleLowLimit + limitsOffset; angleLowLimit = angleLowLimit + limitsOffset;
// Lift // Lift
plStatus = getDoubleParam(liftAxisNo, motorLimitsOffset(), &limitsOffset); getAxisParamChecked(liftAxis, motorLimitsOffset, &limitsOffset);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorLimitsOffset_", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
liftHighLimit = liftHighLimit - limitsOffset; liftHighLimit = liftHighLimit - limitsOffset;
liftLowLimit = liftLowLimit + limitsOffset; liftLowLimit = liftLowLimit + limitsOffset;
@ -812,258 +780,84 @@ asynStatus detectorTowerController::pollDetectorAxes(
Does the paramLib already contain an error message? If either this is the Does the paramLib already contain an error message? If either this is the
case or if error != 0, report a status problem for all axes. case or if error != 0, report a status problem for all axes.
*/ */
getStringParam(angleAxisNo, motorMessageText(), sizeof(waitingErrorMessage), getAxisParamChecked(angleAxis, motorMessageText, &waitingErrorMessage);
waitingErrorMessage);
if (error != 0 || errorMessage[0] != '\0' || if (error != 0 || errorMessage[0] != '\0' ||
waitingErrorMessage[0] != '\0') { waitingErrorMessage[0] != '\0') {
plStatus = angleAxis->setIntegerParam(motorStatusProblem(), true); setAxisParamChecked(angleAxis, motorStatusProblem, true);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorStatusProblem, true);
return paramLibAccessFailed(plStatus, "motorStatusProblem_", setAxisParamChecked(supportAxis, motorStatusProblem, true);
angleAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
plStatus = liftAxis->setIntegerParam(motorStatusProblem(), true);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorStatusProblem_",
liftAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
plStatus = supportAxis->setIntegerParam(motorStatusProblem(), true);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorStatusProblem_",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
} }
// Update the error message text with the one created in this poll (in case // Update the error message text with the one created in this poll (in case
// it is not empty). // it is not empty).
if (errorMessage[0] != '\0') { if (errorMessage[0] != '\0') {
plStatus = angleAxis->setStringParam(motorMessageText(), errorMessage); setAxisParamChecked(angleAxis, motorMessageText, errorMessage);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorMessageText, errorMessage);
return paramLibAccessFailed(plStatus, "motorMessageText_", setAxisParamChecked(supportAxis, motorMessageText, errorMessage);
angleAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
plStatus = liftAxis->setStringParam(motorMessageText(), errorMessage);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorMessageText_",
liftAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
plStatus =
supportAxis->setStringParam(motorMessageText(), errorMessage);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorMessageText_",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
} }
// Update the working position state PV // Update the working position state PV
plStatus = angleAxis->setIntegerParam(positionStateRBV(), positionState); setAxisParamChecked(angleAxis, positionStateRBV, positionState);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, positionStateRBV, positionState);
return paramLibAccessFailed(plStatus, "positionStateRBV_", angleAxisNo, setAxisParamChecked(supportAxis, positionStateRBV, positionState);
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = liftAxis->setIntegerParam(positionStateRBV(), positionState);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "positionStateRBV_", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = supportAxis->setIntegerParam(positionStateRBV(), positionState);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "positionStateRBV_",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
// The axes are always enabled // The axes are always enabled
plStatus = angleAxis->setIntegerParam(motorEnableRBV(), 1); setAxisParamChecked(angleAxis, motorEnableRBV, true);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorEnableRBV, true);
return paramLibAccessFailed(plStatus, "motorEnableRBV_", angleAxisNo, setAxisParamChecked(supportAxis, motorEnableRBV, true);
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = liftAxis->setIntegerParam(motorEnableRBV(), 1);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorEnableRBV_", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = supportAxis->setIntegerParam(motorEnableRBV(), 1);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorEnableRBV_", supportAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
// Are the axes currently moving? // Are the axes currently moving?
plStatus = angleAxis->setIntegerParam(motorStatusMoving(), *moving); setAxisParamChecked(angleAxis, motorStatusMoving, *moving);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorStatusMoving, *moving);
return paramLibAccessFailed(plStatus, "motorStatusMoving_", angleAxisNo, setAxisParamChecked(supportAxis, motorStatusMoving, *moving);
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = liftAxis->setIntegerParam(motorStatusMoving(), *moving);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorStatusMoving_", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = supportAxis->setIntegerParam(motorStatusMoving(), *moving);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorStatusMoving_",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
// Is the axis movement done? // Is the axis movement done?
plStatus = angleAxis->setIntegerParam(motorStatusDone(), !(*moving)); setAxisParamChecked(angleAxis, motorStatusDone, !(*moving));
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorStatusDone, !(*moving));
return paramLibAccessFailed(plStatus, "motorStatusDone_", angleAxisNo, setAxisParamChecked(supportAxis, motorStatusDone, !(*moving));
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = liftAxis->setIntegerParam(motorStatusDone(), !(*moving));
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorStatusDone_", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = supportAxis->setIntegerParam(motorStatusDone(), !(*moving));
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorStatusDone_", supportAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
// In which direction are the axes currently moving? // In which direction are the axes currently moving?
plStatus = angleAxis->setIntegerParam(motorStatusDirection(), angleDir); setAxisParamChecked(angleAxis, motorStatusDirection, angleDir);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorStatusDirection, liftDir);
return paramLibAccessFailed(plStatus, "motorStatusDirection_",
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
plStatus = liftAxis->setIntegerParam(motorStatusDirection(), liftDir);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorStatusDirection_",
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
// Using the lift direction for the support axis is done on purpose! // Using the lift direction for the support axis is done on purpose!
plStatus = supportAxis->setIntegerParam(motorStatusDirection(), liftDir); setAxisParamChecked(supportAxis, motorStatusDirection, liftDir);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorStatusDirection_",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
// High limits from hardware // High limits from hardware
plStatus = setAxisParamChecked(angleAxis, motorHighLimitFromDriver, angleHighLimit);
setDoubleParam(angleAxisNo, motorHighLimitFromDriver(), angleHighLimit); setAxisParamChecked(liftAxis, motorHighLimitFromDriver, liftHighLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorHighLimitFromDriver",
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
plStatus =
setDoubleParam(liftAxisNo, motorHighLimitFromDriver(), liftHighLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorHighLimitFromDriver",
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
// Using the lift high limit for the support axis is done on purpose! // Using the lift high limit for the support axis is done on purpose!
plStatus = setDoubleParam(supportAxisNo, motorHighLimitFromDriver(), setAxisParamChecked(supportAxis, motorHighLimitFromDriver, liftHighLimit);
liftHighLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorHighLimitFromDriver",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
// Low limits from hardware // Low limits from hardware
plStatus = setAxisParamChecked(angleAxis, motorLowLimitFromDriver, angleLowLimit);
setDoubleParam(angleAxisNo, motorLowLimitFromDriver(), angleLowLimit); setAxisParamChecked(liftAxis, motorLowLimitFromDriver, liftLowLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorLowLimitFromDriver",
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
plStatus =
setDoubleParam(liftAxisNo, motorLowLimitFromDriver(), liftLowLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorLowLimitFromDriver",
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
// Using the lift low limit for the support axis is done on purpose! // Using the lift low limit for the support axis is done on purpose!
plStatus = setAxisParamChecked(supportAxis, motorLowLimitFromDriver, liftLowLimit);
setDoubleParam(supportAxisNo, motorLowLimitFromDriver(), liftLowLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorLowLimitFromDriver",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
// Write the motor origin // Write the motor origin
plStatus = setDoubleParam(angleAxisNo, motorOrigin(), angleOrigin); setAxisParamChecked(angleAxis, motorOrigin, angleOrigin);
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorOrigin, liftOrigin);
return paramLibAccessFailed(plStatus, "motorOrigin", angleAxisNo, setAxisParamChecked(supportAxis, motorOrigin, supportOrigin);
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = setDoubleParam(liftAxisNo, motorOrigin(), liftOrigin);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorOrigin", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = setDoubleParam(supportAxisNo, motorOrigin(), supportOrigin);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "supportOrigin", supportAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
// Origin adjustment high limit // Origin adjustment high limit
plStatus = setAxisParamChecked(angleAxis, motorAdjustOriginHighLimitFromDriver,
setDoubleParam(angleAxisNo, motorAdjustOriginHighLimitFromDriver(), angleAdjustOriginHighLimit);
angleAdjustOriginHighLimit); setAxisParamChecked(liftAxis, motorAdjustOriginHighLimitFromDriver,
if (plStatus != asynSuccess) { liftAdjustOriginHighLimit);
return paramLibAccessFailed(plStatus, "motorOriginHighLimitFromDriver",
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
plStatus =
setDoubleParam(liftAxisNo, motorAdjustOriginHighLimitFromDriver(),
liftAdjustOriginHighLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorOriginHighLimitFromDriver",
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
// Using the lift high limit for the support axis is done on purpose! // Using the lift high limit for the support axis is done on purpose!
plStatus = setAxisParamChecked(supportAxis, motorAdjustOriginHighLimitFromDriver,
setDoubleParam(supportAxisNo, motorAdjustOriginHighLimitFromDriver(), liftAdjustOriginHighLimit);
liftAdjustOriginHighLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorOriginHighLimitFromDriver",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
// Origin adjustment low limit // Origin adjustment low limit
plStatus = setAxisParamChecked(angleAxis, motorAdjustOriginLowLimitFromDriver,
setDoubleParam(angleAxisNo, motorAdjustOriginLowLimitFromDriver(), angleAdjustOriginLowLimit);
angleAdjustOriginLowLimit); setAxisParamChecked(liftAxis, motorAdjustOriginLowLimitFromDriver,
if (plStatus != asynSuccess) { liftAdjustOriginLowLimit);
return paramLibAccessFailed(plStatus,
"motorAdjustOriginLowLimitFromDriver",
angleAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
plStatus = setDoubleParam(liftAxisNo, motorAdjustOriginLowLimitFromDriver(),
liftAdjustOriginLowLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus,
"motorAdjustOriginLowLimitFromDriver",
liftAxisNo, __PRETTY_FUNCTION__, __LINE__);
}
// Using the lift low limit for the support axis is done on purpose! // Using the lift low limit for the support axis is done on purpose!
plStatus = setAxisParamChecked(supportAxis, motorAdjustOriginLowLimitFromDriver,
setDoubleParam(supportAxisNo, motorAdjustOriginLowLimitFromDriver(), liftAdjustOriginLowLimit);
liftAdjustOriginLowLimit);
if (plStatus != asynSuccess) {
return paramLibAccessFailed(
plStatus, "motorAdjustOriginLowLimitFromDriver", supportAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
// Axes positions // Axes positions
plStatus = angleAxis->setMotorPosition(angle); plStatus = angleAxis->setMotorPosition(angle);
@ -1137,22 +931,9 @@ asynStatus detectorTowerController::pollDetectorAxes(
one poll cycle, but are cleared afterwards. Persisting error messages will one poll cycle, but are cleared afterwards. Persisting error messages will
be recreated during each poll. be recreated during each poll.
*/ */
plStatus = angleAxis->setStringParam(motorMessageText(), ""); setAxisParamChecked(angleAxis, motorMessageText, "");
if (plStatus != asynSuccess) { setAxisParamChecked(liftAxis, motorMessageText, "");
return paramLibAccessFailed(plStatus, "motorMessageText_", angleAxisNo, setAxisParamChecked(supportAxis, motorMessageText, "");
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = liftAxis->setStringParam(motorMessageText(), "");
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorMessageText_", liftAxisNo,
__PRETTY_FUNCTION__, __LINE__);
}
plStatus = supportAxis->setStringParam(motorMessageText(), "");
if (plStatus != asynSuccess) {
return paramLibAccessFailed(plStatus, "motorMessageText_",
supportAxisNo, __PRETTY_FUNCTION__,
__LINE__);
}
return pollStatus; return pollStatus;
} }

View File

@ -111,11 +111,7 @@ asynStatus detectorTowerLiftAxis::init() {
} }
// Initialize the motorStatusMoving flag // Initialize the motorStatusMoving flag
status = setIntegerParam(pC_->motorStatusMoving(), 0); setAxisParamChecked(this, motorStatusMoving, false);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorStatusMoving_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
// Check if we are currently in the changer position and update the PV // Check if we are currently in the changer position and update the PV
// accordingly // accordingly
@ -126,11 +122,7 @@ asynStatus detectorTowerLiftAxis::init() {
__PRETTY_FUNCTION__, __LINE__); __PRETTY_FUNCTION__, __LINE__);
} }
status = setIntegerParam(pC_->changeStateRBV(), positionState == 2); setAxisParamChecked(this, changeStateRBV, positionState == 2);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "changeStateRBV", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
return callParamCallbacks(); return callParamCallbacks();
} }
@ -146,13 +138,7 @@ asynStatus detectorTowerLiftAxis::poll(bool *moving) {
status = pC_->pollDetectorAxes(moving, angleAxis(), this, status = pC_->pollDetectorAxes(moving, angleAxis(), this,
angleAxis()->supportAxis()); angleAxis()->supportAxis());
} else { } else {
status = pC_->getIntegerParam(axisNo(), pC_->motorStatusMoving(), getAxisParamChecked(this, motorStatusMoving, &moving);
(int *)moving);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorStatusMoving",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
} }
setWasMoving(*moving); setWasMoving(*moving);
return status; return status;
@ -172,13 +158,7 @@ asynStatus detectorTowerLiftAxis::doMove(double position, int relative,
double acceleration) { double acceleration) {
double motorRecResolution = 0.0; double motorRecResolution = 0.0;
asynStatus plStatus = pC_->getDoubleParam( getAxisParamChecked(this, motorRecResolution, &motorRecResolution);
axisNo_, pC_->motorRecResolution(), &motorRecResolution);
if (plStatus != asynSuccess) {
return pC_->paramLibAccessFailed(plStatus, "motorRecResolution_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
// Signal to the deferredMovementCollectorLoop (of the // Signal to the deferredMovementCollectorLoop (of the
// detectorTowerAngleAxis) that a movement should be started to the // detectorTowerAngleAxis) that a movement should be started to the
@ -208,12 +188,7 @@ asynStatus detectorTowerLiftAxis::adjustOrigin(double newOrigin) {
// ========================================================================= // =========================================================================
status = getAxisParamChecked(this, positionStateRBV, &positionState);
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "positionStateRBV_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
// If the axis is in changer position, it must be moved into working // If the axis is in changer position, it must be moved into working
// position before any move can be started. // position before any move can be started.
@ -242,12 +217,7 @@ asynStatus detectorTowerLiftAxis::adjustOrigin(double newOrigin) {
"lift origin %lf failed.\n", "lift origin %lf failed.\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
newOrigin); newOrigin);
status = setIntegerParam(pC_->motorStatusProblem(), true); setAxisParamChecked(this, motorStatusProblem, true);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorStatusProblem_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
} }
return status; return status;

View File

@ -1,11 +1,11 @@
#ifndef detectorTowerLiftAxis_H #ifndef detectorTowerLiftAxis_H
#define detectorTowerLiftAxis_H #define detectorTowerLiftAxis_H
#include "detectorTowerController.h"
#include "turboPmacAxis.h" #include "turboPmacAxis.h"
// Forward declaration of the controller class to resolve the cyclic dependency // Forward declaration of the controller class to resolve the cyclic dependency
// between the controller and the axis .h-file. See // between the controller and the axis .h-file. See
// https://en.cppreference.com/w/cpp/language/class. // https://en.cppreference.com/w/cpp/language/class.
class detectorTowerController;
class detectorTowerAngleAxis; class detectorTowerAngleAxis;
class detectorTowerLiftAxis : public turboPmacAxis { class detectorTowerLiftAxis : public turboPmacAxis {
@ -110,6 +110,11 @@ class detectorTowerLiftAxis : public turboPmacAxis {
*/ */
asynStatus readEncoderType(); asynStatus readEncoderType();
/**
* @brief Return a pointer to the axis controller
*/
virtual detectorTowerController *pController() override { return pC_; };
protected: protected:
detectorTowerController *pC_; detectorTowerController *pC_;
detectorTowerAngleAxis *angleAxis_; detectorTowerAngleAxis *angleAxis_;

View File

@ -111,11 +111,7 @@ asynStatus detectorTowerSupportAxis::init() {
} }
// Initialize the motorStatusMoving flag // Initialize the motorStatusMoving flag
status = setIntegerParam(pC_->motorStatusMoving(), 0); setAxisParamChecked(this, motorStatusMoving, false);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorStatusMoving_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
// Check if we are currently in the changer position and update the PV // Check if we are currently in the changer position and update the PV
// accordingly // accordingly
@ -126,12 +122,7 @@ asynStatus detectorTowerSupportAxis::init() {
__PRETTY_FUNCTION__, __LINE__); __PRETTY_FUNCTION__, __LINE__);
} }
status = setIntegerParam(pC_->changeStateRBV(), positionState == 2); setAxisParamChecked(this, changeStateRBV, positionState == 2);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "changeStateRBV", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
return callParamCallbacks(); return callParamCallbacks();
} }
@ -147,13 +138,7 @@ asynStatus detectorTowerSupportAxis::poll(bool *moving) {
status = pC_->pollDetectorAxes(moving, angleAxis(), status = pC_->pollDetectorAxes(moving, angleAxis(),
angleAxis()->liftAxis(), this); angleAxis()->liftAxis(), this);
} else { } else {
status = pC_->getIntegerParam(axisNo(), pC_->motorStatusMoving(), getAxisParamChecked(this, motorStatusMoving, &moving);
(int *)moving);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "motorStatusMoving",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
} }
setWasMoving(*moving); setWasMoving(*moving);
return status; return status;
@ -186,12 +171,7 @@ asynStatus detectorTowerSupportAxis::adjustOrigin(double newOrigin) {
// ========================================================================= // =========================================================================
status = getAxisParamChecked(this, positionStateRBV, &positionState);
pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState);
if (status != asynSuccess) {
return pC_->paramLibAccessFailed(status, "positionStateRBV_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
// If the axis is in changer position, it must be moved into working // If the axis is in changer position, it must be moved into working
// position before any move can be started. // position before any move can be started.
@ -220,12 +200,8 @@ asynStatus detectorTowerSupportAxis::adjustOrigin(double newOrigin) {
"lift origin %lf failed.\n", "lift origin %lf failed.\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
newOrigin); newOrigin);
status = setIntegerParam(pC_->motorStatusProblem(), true);
if (status != asynSuccess) { setAxisParamChecked(this, motorStatusProblem, true);
return pC_->paramLibAccessFailed(status, "motorStatusProblem_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
} }
return status; return status;

View File

@ -1,11 +1,11 @@
#ifndef detectorTowerSupportAxis_H #ifndef detectorTowerSupportAxis_H
#define detectorTowerSupportAxis_H #define detectorTowerSupportAxis_H
#include "detectorTowerController.h"
#include "turboPmacAxis.h" #include "turboPmacAxis.h"
// Forward declaration of the controller class to resolve the cyclic dependency // Forward declaration of the controller class to resolve the cyclic dependency
// between the controller and the axis .h-file. See // between the controller and the axis .h-file. See
// https://en.cppreference.com/w/cpp/language/class. // https://en.cppreference.com/w/cpp/language/class.
class detectorTowerController;
class detectorTowerAngleAxis; class detectorTowerAngleAxis;
/** /**
@ -112,6 +112,11 @@ class detectorTowerSupportAxis : public turboPmacAxis {
*/ */
asynStatus readEncoderType(); asynStatus readEncoderType();
/**
* @brief Return a pointer to the axis controller
*/
virtual detectorTowerController *pController() override { return pC_; };
protected: protected:
detectorTowerController *pC_; detectorTowerController *pC_;
detectorTowerAngleAxis *angleAxis_; detectorTowerAngleAxis *angleAxis_;