diff --git a/src/auxiliaryAxis.cpp b/src/auxiliaryAxis.cpp index f5f4fb6..a2bd87a 100644 --- a/src/auxiliaryAxis.cpp +++ b/src/auxiliaryAxis.cpp @@ -45,13 +45,13 @@ auxiliaryAxis::auxiliaryAxis(detectorTowerController *pC, int axisNo) line 40). However, we want the IOC creation to stop completely, since this is a configuration error. */ - if (axisNo >= pC->numAxes_) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + if (axisNo >= pC->numAxes()) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d: FATAL ERROR: " "Axis index %d must be smaller than the total number of axes " "%d", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - axisNo_, pC->numAxes_); + axisNo_, pC->numAxes()); exit(-1); } @@ -85,11 +85,11 @@ asynStatus auxiliaryAxis::init() { time_t now = time(NULL); time_t maxInitTime = 60; while (1) { - status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution_, + status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution(), &motorRecResolution); if (status == asynParamUndefined) { if (now + maxInitTime < time(NULL)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line " "%d\nInitializing the parameter library failed.\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, @@ -124,8 +124,8 @@ asynStatus auxiliaryAxis::doPoll(bool *moving) { The axis is moving if the detectorTowerAxis is moving -> We read the moving status from the detectorTowerAxis. */ - pl_status = - pC_->getIntegerParam(dTA_->axisNo_, pC_->motorStatusMoving_, &isMoving); + pl_status = pC_->getIntegerParam(dTA_->axisNo_, pC_->motorStatusMoving(), + &isMoving); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_, __PRETTY_FUNCTION__, __LINE__); @@ -134,7 +134,7 @@ asynStatus auxiliaryAxis::doPoll(bool *moving) { // Update the parameter library if (dTA_->error_ != 0) { - pl_status = setIntegerParam(pC_->motorStatusProblem_, true); + pl_status = setIntegerParam(pC_->motorStatusProblem(), true); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_, __PRETTY_FUNCTION__, @@ -143,7 +143,7 @@ asynStatus auxiliaryAxis::doPoll(bool *moving) { } if (*moving == false) { - pl_status = setIntegerParam(pC_->motorMoveToHome_, 0); + pl_status = setIntegerParam(pC_->motorMoveToHome(), 0); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMoveToHome_", axisNo_, __PRETTY_FUNCTION__, @@ -151,14 +151,14 @@ asynStatus auxiliaryAxis::doPoll(bool *moving) { } } - pl_status = setIntegerParam(pC_->motorStatusMoving_, *moving); + pl_status = setIntegerParam(pC_->motorStatusMoving(), *moving); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving_", axisNo_, __PRETTY_FUNCTION__, __LINE__); } - pl_status = setIntegerParam(pC_->motorStatusDone_, !(*moving)); + pl_status = setIntegerParam(pC_->motorStatusDone(), !(*moving)); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusDone_", axisNo_, __PRETTY_FUNCTION__, __LINE__); @@ -168,15 +168,15 @@ asynStatus auxiliaryAxis::doPoll(bool *moving) { // function should be called at the end of a poll implementation. pl_status = callParamCallbacks(); bool wantToPrint = pl_status != asynSuccess; - if (pC_->msgPrintControl_.shouldBePrinted( + if (pC_->getMsgPrintControl().shouldBePrinted( pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, wantToPrint, - pC_->pasynUserSelf)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf())) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line " "%d:\ncallParamCallbacks failed with %s.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, pC_->stringifyAsynStatus(poll_status), - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } if (wantToPrint) { poll_status = pl_status; @@ -193,7 +193,7 @@ asynStatus auxiliaryAxis::doMove(double position, int relative, double motorRecResolution = 0.0; asynStatus pl_status = pC_->getDoubleParam( - axisNo_, pC_->motorRecResolution_, &motorRecResolution); + axisNo_, pC_->motorRecResolution(), &motorRecResolution); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_", axisNo_, __PRETTY_FUNCTION__, @@ -224,12 +224,12 @@ asynStatus auxiliaryAxis::stop(double acceleration) { if (rw_status != asynSuccess) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nStopping the movement " "failed.\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__); - pl_status = setIntegerParam(pC_->motorStatusProblem_, true); + pl_status = setIntegerParam(pC_->motorStatusProblem(), true); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_, __PRETTY_FUNCTION__, diff --git a/src/auxiliaryAxis.h b/src/auxiliaryAxis.h index ba19139..22220a9 100644 --- a/src/auxiliaryAxis.h +++ b/src/auxiliaryAxis.h @@ -71,7 +71,6 @@ class auxiliaryAxis : public turboPmacAxis { double targetPosition_; private: - friend class detectorTowerController; friend class detectorTowerAxis; }; diff --git a/src/detectorTowerAxis.cpp b/src/detectorTowerAxis.cpp index 124c6ec..88d7b91 100644 --- a/src/detectorTowerAxis.cpp +++ b/src/detectorTowerAxis.cpp @@ -65,13 +65,13 @@ detectorTowerAxis::detectorTowerAxis(detectorTowerController *pC, int axisNo, line 40). However, we want the IOC creation to stop completely, since this is a configuration error. */ - if (axisNo >= pC->numAxes_) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + if (axisNo >= pC->numAxes()) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d: FATAL ERROR: " "Axis index %d must be smaller than the total number of axes " "%d", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - axisNo_, pC->numAxes_); + axisNo_, pC->numAxes()); exit(-1); } @@ -122,11 +122,11 @@ asynStatus detectorTowerAxis::init() { time_t now = time(NULL); time_t maxInitTime = 60; while (1) { - status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution_, + status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution(), &motorRecResolution); if (status == asynParamUndefined) { if (now + maxInitTime < time(NULL)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis " "%ddeferredMovementCollectorLoop => %s, line " "%d\nInitializing the parameter library failed.\n", @@ -181,7 +181,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { // ========================================================================= // Motor resolution from parameter library - pl_status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution_, + pl_status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution(), &motorRecResolution); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_", @@ -190,7 +190,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { } // Read the previous motor position - pl_status = pC_->getDoubleParam(axisNo_, pC_->motorPosition_, + pl_status = pC_->getDoubleParam(axisNo_, pC_->motorPosition(), &previousBeamTiltAngle); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_, @@ -240,7 +240,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { by limitsOffset on both sides. */ pl_status = - pC_->getDoubleParam(axisNo_, pC_->motorLimitsOffset_, &limitsOffset); + pC_->getDoubleParam(axisNo_, pC_->motorLimitsOffset(), &limitsOffset); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorLimitsOffset_", axisNo_, __PRETTY_FUNCTION__, @@ -253,7 +253,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { error_ = error; // Update the working position state PV - pl_status = setIntegerParam(pC_->positionStateRBV_, positionState); + pl_status = setIntegerParam(pC_->positionStateRBV(), positionState); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "positionStateRBV_", axisNo_, __PRETTY_FUNCTION__, @@ -261,7 +261,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { } // Axis is always enabled - pl_status = setIntegerParam(pC_->motorEnableRBV_, 1); + pl_status = setIntegerParam(pC_->motorEnableRBV(), 1); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorEnableRBV_", axisNo_, __PRETTY_FUNCTION__, __LINE__); @@ -297,40 +297,40 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { // Axis ready break; case 2: - if (pC_->msgPrintControl_.shouldBePrinted(keyPosState, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyPosState, true, + pC_->asynUserSelf())) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_FLOW, + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_FLOW, "Controller \"%s\", axis %d => %s, line %d\nAxis moving " "to or in change " "position.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetCountPosState = false; break; case 3: - if (pC_->msgPrintControl_.shouldBePrinted(keyPosState, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyPosState, true, + pC_->asynUserSelf())) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_FLOW, + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_FLOW, "Controller \"%s\", axis %d => %s, line %d\nAxis moving " "to working position.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetCountPosState = false; break; default: - if (pC_->msgPrintControl_.shouldBePrinted(keyPosState, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyPosState, true, + pC_->asynUserSelf())) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nReached unknown " "state P354 = %d.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - positionState, pC_->msgPrintControl_.getSuffix()); + positionState, pC_->getMsgPrintControl().getSuffix()); } resetCountPosState = false; @@ -338,7 +338,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { "Unknown state P354 = %d has been reached. Please call " "the support.", positionState); - pl_status = setStringParam(pC_->motorMessageText_, userMessage); + pl_status = setStringParam(pC_->motorMessageText(), userMessage); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", axisNo_, __PRETTY_FUNCTION__, @@ -347,7 +347,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { } if (resetCountPosState) { - pC_->msgPrintControl_.resetCount(keyPosState, pC_->pasynUserSelf); + pC_->getMsgPrintControl().resetCount(keyPosState, pC_->asynUserSelf()); } if (*moving) { @@ -371,19 +371,19 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { // No error break; case 1: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nBrake COZ not " "released (P359=1).%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = - setStringParam(pC_->motorMessageText_, + setStringParam(pC_->motorMessageText(), "Brake COZ not released. Try resetting the axis. " "If the problem persists, please call the support."); if (pl_status != asynSuccess) { @@ -396,18 +396,18 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 2: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nMove command " "rejected because axis is already moving.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; - pl_status = setStringParam(pC_->motorMessageText_, + pl_status = setStringParam(pC_->motorMessageText(), "Move command rejected because axis is " "already moving. Please call the support"); if (pl_status != asynSuccess) { @@ -420,18 +420,18 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 3: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nError motor " "FTZ.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = - setStringParam(pC_->motorMessageText_, + setStringParam(pC_->motorMessageText(), "Error in motor FTZ. Try resetting the axis. If " "the problem persists, please call the support"); if (pl_status != asynSuccess) { @@ -444,19 +444,19 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 4: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nAxis stopped " "unexpectedly.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = - setStringParam(pC_->motorMessageText_, + setStringParam(pC_->motorMessageText(), "Axis stopped unexpectedly. Try resetting the axis " "and issue the move command again. If the problem " "persists, please call the support."); @@ -470,19 +470,19 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 5: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nRelease removed " "while moving.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = setStringParam( - pC_->motorMessageText_, + pC_->motorMessageText(), "Axis release was removed while moving. Try resetting the axis " "and issue the move command again. If the problem persists, please " "call the support."); @@ -496,19 +496,19 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 6: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nEmergency stop " "activated.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = - setStringParam(pC_->motorMessageText_, "Emergency stop activate"); + setStringParam(pC_->motorMessageText(), "Emergency stop activate"); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", axisNo_, __PRETTY_FUNCTION__, @@ -519,18 +519,18 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 7: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nError motor " "COZ.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = - setStringParam(pC_->motorMessageText_, + setStringParam(pC_->motorMessageText(), "Error in motor COZ. Try resetting the axis. If " "the problem persists, please call the support"); if (pl_status != asynSuccess) { @@ -543,18 +543,18 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 8: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nError motor " "COM.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = - setStringParam(pC_->motorMessageText_, + setStringParam(pC_->motorMessageText(), "Error in motor COM. Try resetting the axis. If " "the problem persists, please call the support"); if (pl_status != asynSuccess) { @@ -567,18 +567,18 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 9: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nError motor " "COX.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = - setStringParam(pC_->motorMessageText_, + setStringParam(pC_->motorMessageText(), "Error in motor COX. Try resetting the axis. If " "the problem persists, please call the support"); if (pl_status != asynSuccess) { @@ -591,18 +591,18 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; case 10: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nHit end " "switch FTZ.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; pl_status = - setStringParam(pC_->motorMessageText_, "Hit end switch FTZ"); + setStringParam(pC_->motorMessageText(), "Hit end switch FTZ"); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", axisNo_, __PRETTY_FUNCTION__, @@ -614,14 +614,14 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { case 11: // Following error - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nMaximum allowed " "following error FTZ exceeded.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; @@ -630,7 +630,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { "Check if movement range is blocked. " "Otherwise please call the support.", error); - pl_status = setStringParam(pC_->motorMessageText_, userMessage); + pl_status = setStringParam(pC_->motorMessageText(), userMessage); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", axisNo_, __PRETTY_FUNCTION__, @@ -641,20 +641,20 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { break; default: - if (pC_->msgPrintControl_.shouldBePrinted(keyError, true, - pC_->pasynUserSelf)) { + if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true, + pC_->asynUserSelf())) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nUnknown error " "P359 = %d.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, error, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } resetError = false; snprintf(userMessage, sizeof(userMessage), "Unknown error P359 = %d. Please call the support.", error); - pl_status = setStringParam(pC_->motorMessageText_, userMessage); + pl_status = setStringParam(pC_->motorMessageText(), userMessage); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", axisNo_, __PRETTY_FUNCTION__, @@ -666,12 +666,12 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { } if (resetError) { - pC_->msgPrintControl_.resetCount(keyError, pC_->pasynUserSelf); + pC_->getMsgPrintControl().resetCount(keyError, pC_->asynUserSelf()); } // Update the parameter library if (error != 0) { - pl_status = setIntegerParam(pC_->motorStatusProblem_, true); + pl_status = setIntegerParam(pC_->motorStatusProblem(), true); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_, __PRETTY_FUNCTION__, @@ -680,7 +680,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { } if (*moving == false) { - pl_status = setIntegerParam(pC_->motorMoveToHome_, 0); + pl_status = setIntegerParam(pC_->motorMoveToHome(), 0); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMoveToHome_", axisNo_, __PRETTY_FUNCTION__, @@ -688,28 +688,28 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { } } - pl_status = setIntegerParam(pC_->motorStatusMoving_, *moving); + pl_status = setIntegerParam(pC_->motorStatusMoving(), *moving); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving_", axisNo_, __PRETTY_FUNCTION__, __LINE__); } - pl_status = setIntegerParam(pC_->motorStatusDone_, !(*moving)); + pl_status = setIntegerParam(pC_->motorStatusDone(), !(*moving)); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusDone_", axisNo_, __PRETTY_FUNCTION__, __LINE__); } - pl_status = setIntegerParam(pC_->motorStatusDirection_, direction); + pl_status = setIntegerParam(pC_->motorStatusDirection(), direction); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusDirection_", axisNo_, __PRETTY_FUNCTION__, __LINE__); } - pl_status = - pC_->setDoubleParam(axisNo_, pC_->motorHighLimitFromDriver_, highLimit); + pl_status = pC_->setDoubleParam(axisNo_, pC_->motorHighLimitFromDriver(), + highLimit); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver_", axisNo_, __PRETTY_FUNCTION__, @@ -717,7 +717,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { } pl_status = - pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver_, lowLimit); + pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver(), lowLimit); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorLowLimitFromDriver_", axisNo_, __PRETTY_FUNCTION__, @@ -729,21 +729,21 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { double liftOffsetPosition = detectorHeight + detectorRadius * sin(beamTiltAngle); - pl_status = pC_->setDoubleParam(liftAxisNo, pC_->motorPosition_, + pl_status = pC_->setDoubleParam(liftAxisNo, pC_->motorPosition(), liftOffsetPosition / motorRecResolution); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorPosition_", liftAxisNo, __PRETTY_FUNCTION__, __LINE__); } - pl_status = pC_->setDoubleParam(liftAxisNo, pC_->motorHighLimitFromDriver_, + pl_status = pC_->setDoubleParam(liftAxisNo, pC_->motorHighLimitFromDriver(), liftOffsetHighLimit); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver_", liftAxisNo, __PRETTY_FUNCTION__, __LINE__); } - pl_status = pC_->setDoubleParam(liftAxisNo, pC_->motorLowLimitFromDriver_, + pl_status = pC_->setDoubleParam(liftAxisNo, pC_->motorLowLimitFromDriver(), liftOffsetLowLimit); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorLowLimitFromDriver_", @@ -756,7 +756,7 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { // There exists no readback value for tiltOffsetAxis_, hence we just set the // current position to the target position. pl_status = tiltOffsetAxis_->setDoubleParam( - pC_->motorPosition_, + pC_->motorPosition(), tiltOffsetAxis_->targetPosition_ / motorRecResolution); if (pl_status != asynSuccess) { @@ -764,14 +764,14 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { tiltAxisNo, __PRETTY_FUNCTION__, __LINE__); } - pl_status = pC_->setDoubleParam(tiltAxisNo, pC_->motorHighLimitFromDriver_, + pl_status = pC_->setDoubleParam(tiltAxisNo, pC_->motorHighLimitFromDriver(), tiltOffsetHighLimit); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver_", tiltAxisNo, __PRETTY_FUNCTION__, __LINE__); } - pl_status = pC_->setDoubleParam(tiltAxisNo, pC_->motorLowLimitFromDriver_, + pl_status = pC_->setDoubleParam(tiltAxisNo, pC_->motorLowLimitFromDriver(), tiltOffsetLowLimit); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorLowLimitFromDriver_", @@ -781,14 +781,14 @@ asynStatus detectorTowerAxis::doPoll(bool *moving) { // Transform from motor to EPICS coordinates (see comment in // turboPmacAxis::init()) - pl_status = - setDoubleParam(pC_->motorPosition_, beamTiltAngle / motorRecResolution); + pl_status = setDoubleParam(pC_->motorPosition(), + beamTiltAngle / motorRecResolution); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_, __PRETTY_FUNCTION__, __LINE__); } - pl_status = setIntegerParam(pC_->positionStateRBV_, positionState); + pl_status = setIntegerParam(pC_->positionStateRBV(), positionState); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "positionStateRBV_", axisNo_, __PRETTY_FUNCTION__, @@ -803,7 +803,7 @@ asynStatus detectorTowerAxis::doMove(double position, int relative, double acceleration) { double motorRecResolution = 0.0; asynStatus pl_status = pC_->getDoubleParam( - axisNo_, pC_->motorRecResolution_, &motorRecResolution); + axisNo_, pC_->motorRecResolution(), &motorRecResolution); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_", axisNo_, __PRETTY_FUNCTION__, @@ -835,16 +835,16 @@ asynStatus detectorTowerAxis::startCombinedMove() { // If the axis is in changer position, it must be moved into working // position before any move can be started. bool isInChangerPos = positionState == 2 || positionState == 3; - if (pC_->msgPrintControl_.shouldBePrinted( + if (pC_->getMsgPrintControl().shouldBePrinted( pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - isInChangerPos, pC_->pasynUserSelf)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + isInChangerPos, pC_->asynUserSelf())) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nAxis cannot be " "moved because it is moving from working to changer " "position, is in changer position or is moving from changer " "to working position.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } if (isInChangerPos) { startingDeferredMovement_ = false; @@ -858,7 +858,7 @@ asynStatus detectorTowerAxis::startCombinedMove() { tiltOffsetAxis_->targetPosition_); // DEBUG - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "%s\n", command); + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "%s\n", command); // Lock the access to the controller since this function runs in another // thread than the poll method. @@ -872,12 +872,12 @@ asynStatus detectorTowerAxis::startCombinedMove() { if (rw_status != asynSuccess) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nStarting movement to " "target position %lf failed.\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, motorCoordinatesPosition); - pl_status = setIntegerParam(pC_->motorStatusProblem_, true); + pl_status = setIntegerParam(pC_->motorStatusProblem(), true); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_, __PRETTY_FUNCTION__, @@ -904,12 +904,12 @@ asynStatus detectorTowerAxis::stop(double acceleration) { if (rw_status != asynSuccess) { asynPrint( - pC_->pasynUserSelf, ASYN_TRACE_ERROR, + pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nStopping the movement " "failed.\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__); - pl_status = setIntegerParam(pC_->motorStatusProblem_, true); + pl_status = setIntegerParam(pC_->motorStatusProblem(), true); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_, __PRETTY_FUNCTION__, @@ -923,7 +923,7 @@ asynStatus detectorTowerAxis::stop(double acceleration) { // The detector tower axis uses absolute encoders asynStatus detectorTowerAxis::readEncoderType() { - asynStatus status = setStringParam(pC_->encoderType_, AbsoluteEncoder); + asynStatus status = setStringParam(pC_->encoderType(), AbsoluteEncoder); if (status != asynSuccess) { return pC_->paramLibAccessFailed(status, "encoderType_", axisNo_, __PRETTY_FUNCTION__, __LINE__); @@ -950,7 +950,7 @@ detectorTowerAxis::toggleWorkingChangerState(bool toChangingPosition) { doPoll(&moving); pl_status = - pC_->getIntegerParam(axisNo_, pC_->positionStateRBV_, &positionState); + pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "positionStateRBV_", axisNo_, __PRETTY_FUNCTION__, @@ -958,15 +958,15 @@ detectorTowerAxis::toggleWorkingChangerState(bool toChangingPosition) { } if (moving) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR, "Controller \"%s\", axis %d => %s, line %d\nAxis is not " "idle and can therefore not be moved to %s state.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, toChangingPosition ? "changer" : "working", - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); pl_status = setStringParam( - pC_->motorMessageText_, + pC_->motorMessageText(), "Axis cannot be moved to changer position while it is moving."); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "motorMessageText_", @@ -980,15 +980,15 @@ detectorTowerAxis::toggleWorkingChangerState(bool toChangingPosition) { bool isAlreadyThere = (toChangingPosition == false && positionState == 1) || (toChangingPosition == true && positionState == 2); - if (pC_->msgPrintControl_.shouldBePrinted( + if (pC_->getMsgPrintControl().shouldBePrinted( pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, - isAlreadyThere, pC_->pasynUserSelf)) { - asynPrint(pC_->pasynUserSelf, ASYN_TRACE_WARNING, + isAlreadyThere, pC_->asynUserSelf())) { + asynPrint(pC_->asynUserSelf(), ASYN_TRACE_WARNING, "Controller \"%s\", axis %d => %s, line %d\nAxis is already " "in %s position.%s\n", pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, toChangingPosition ? "changer" : "working", - pC_->msgPrintControl_.getSuffix()); + pC_->getMsgPrintControl().getSuffix()); } if (isAlreadyThere) { return asynSuccess; @@ -997,11 +997,11 @@ detectorTowerAxis::toggleWorkingChangerState(bool toChangingPosition) { // Move the axis into changer or working position if (toChangingPosition) { rw_status = pC_->writeRead(axisNo_, "P350=2", response, 0); - pl_status = setStringParam(pC_->motorMessageText_, + pl_status = setStringParam(pC_->motorMessageText(), "Moving to changer position ..."); } else { rw_status = pC_->writeRead(axisNo_, "P350=3", response, 0); - pl_status = setStringParam(pC_->motorMessageText_, + pl_status = setStringParam(pC_->motorMessageText(), "Moving to working state ..."); } if (pl_status != asynSuccess) { @@ -1019,7 +1019,7 @@ asynStatus detectorTowerAxis::reset() { int positionState = 0; pl_status = - pC_->getIntegerParam(axisNo_, pC_->positionStateRBV_, &positionState); + pC_->getIntegerParam(axisNo_, pC_->positionStateRBV(), &positionState); if (pl_status != asynSuccess) { return pC_->paramLibAccessFailed(pl_status, "positionStateRBV_", axisNo_, __PRETTY_FUNCTION__, diff --git a/src/detectorTowerAxis.h b/src/detectorTowerAxis.h index 885abd9..d101f2d 100644 --- a/src/detectorTowerAxis.h +++ b/src/detectorTowerAxis.h @@ -123,7 +123,6 @@ class detectorTowerAxis : public turboPmacAxis { auxiliaryAxis *liftOffsetAxis_; private: - friend class detectorTowerController; friend class auxiliaryAxis; }; diff --git a/src/detectorTowerController.h b/src/detectorTowerController.h index 3ab483f..44e6c3a 100644 --- a/src/detectorTowerController.h +++ b/src/detectorTowerController.h @@ -74,15 +74,16 @@ class detectorTowerController : public turboPmacController { */ detectorTowerAxis *getDetectorTowerAxis(int axisNo); + // Accessors for additional PVs + int positionStateRBV() { return positionStateRBV_; } + int changeState() { return changeState_; } + private: // Indices of additional PVs #define FIRST_detectorTower_PARAM positionStateRBV_ int positionStateRBV_; int changeState_; #define LAST_detectorTower_PARAM changeState_ - - friend class detectorTowerAxis; - friend class auxiliaryAxis; }; #define NUM_detectorTower_DRIVER_PARAMS \ (&LAST_detectorTower_PARAM - &FIRST_detectorTower_PARAM + 1)