Added public accessors for all status library indices and some other
properties. This also enabled the removal of "friend classes".
This commit is contained in:
114
src/sinqAxis.cpp
114
src/sinqAxis.cpp
@ -16,9 +16,9 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||
targetPosition_ = 0.0;
|
||||
|
||||
// Motor is assumed to be enabled
|
||||
status = setIntegerParam(pC_->motorEnableRBV_, 1);
|
||||
status = setIntegerParam(pC_->motorEnableRBV(), 1);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
@ -28,9 +28,9 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||
}
|
||||
|
||||
// By default, motors cannot be disabled
|
||||
status = setIntegerParam(pC_->motorCanDisable_, 0);
|
||||
status = setIntegerParam(pC_->motorCanDisable(), 0);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
@ -40,9 +40,9 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||
}
|
||||
|
||||
// Provide a default value for the motor position.
|
||||
status = setDoubleParam(pC_->motorPosition_, 0.0);
|
||||
status = setDoubleParam(pC_->motorPosition(), 0.0);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
@ -52,9 +52,9 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||
}
|
||||
|
||||
// We assume that the motor has no status problems initially
|
||||
status = setIntegerParam(pC_->motorStatusProblem_, 0);
|
||||
status = setIntegerParam(pC_->motorStatusProblem(), 0);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
@ -64,9 +64,9 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||
}
|
||||
|
||||
// Set the homing-related flags
|
||||
status = setIntegerParam(pC_->motorStatusHome_, 0);
|
||||
status = setIntegerParam(pC_->motorStatusHome(), 0);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
@ -74,9 +74,9 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
status = setIntegerParam(pC_->motorStatusHomed_, 0);
|
||||
status = setIntegerParam(pC_->motorStatusHomed(), 0);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
@ -84,9 +84,9 @@ sinqAxis::sinqAxis(class sinqController *pC, int axisNo)
|
||||
pC_->stringifyAsynStatus(status));
|
||||
exit(-1);
|
||||
}
|
||||
status = setIntegerParam(pC_->motorStatusAtHome_, 0);
|
||||
status = setIntegerParam(pC_->motorStatusAtHome(), 0);
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||
"(setting a parameter value failed "
|
||||
"with %s)\n. Terminating IOC",
|
||||
@ -110,17 +110,17 @@ asynStatus sinqAxis::poll(bool *moving) {
|
||||
|
||||
The motorStatusProblem_ field changes the motor record fields SEVR and STAT.
|
||||
*/
|
||||
pl_status = setIntegerParam(pC_->motorStatusProblem_, false);
|
||||
pl_status = setIntegerParam(pC_->motorStatusProblem(), false);
|
||||
if (pl_status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
pl_status = setIntegerParam(pC_->motorStatusCommsError_, false);
|
||||
pl_status = setIntegerParam(pC_->motorStatusCommsError(), false);
|
||||
if (pl_status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(pl_status, "motorStatusCommsError_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
pl_status = setStringParam(pC_->motorMessageText_, "");
|
||||
pl_status = setStringParam(pC_->motorMessageText(), "");
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
@ -136,20 +136,20 @@ asynStatus sinqAxis::poll(bool *moving) {
|
||||
// The poll did not succeed: Something went wrong and the motor has a status
|
||||
// problem.
|
||||
if (poll_status != asynSuccess) {
|
||||
pl_status = setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
pl_status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (pl_status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorStatusHomed_, &homed);
|
||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorStatusHomed(), &homed);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusHomed_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorStatusHome_, &homing);
|
||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorStatusHome(), &homing);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusHome_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
@ -158,19 +158,19 @@ asynStatus sinqAxis::poll(bool *moving) {
|
||||
if (homing == 1 && !(*moving)) {
|
||||
|
||||
// Set the homing-related flags
|
||||
pl_status = setIntegerParam(pC_->motorStatusHome_, 0);
|
||||
pl_status = setIntegerParam(pC_->motorStatusHome(), 0);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusHome_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
pl_status = setIntegerParam(pC_->motorStatusHomed_, 1);
|
||||
pl_status = setIntegerParam(pC_->motorStatusHomed(), 1);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusHomed_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
pl_status = setIntegerParam(pC_->motorStatusAtHome_, 1);
|
||||
pl_status = setIntegerParam(pC_->motorStatusAtHome(), 1);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusAtHome_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
@ -187,15 +187,15 @@ asynStatus sinqAxis::poll(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;
|
||||
@ -216,19 +216,19 @@ asynStatus sinqAxis::move(double position, int relative, double minVelocity,
|
||||
// =========================================================================
|
||||
|
||||
// When a new move is done, the motor is not homed anymore
|
||||
pl_status = setIntegerParam(pC_->motorStatusHomed_, 0);
|
||||
pl_status = setIntegerParam(pC_->motorStatusHomed(), 0);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusHomed_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
pl_status = setIntegerParam(pC_->motorStatusAtHome_, 0);
|
||||
pl_status = setIntegerParam(pC_->motorStatusAtHome(), 0);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusAtHome_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
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_",
|
||||
@ -256,7 +256,7 @@ asynStatus sinqAxis::home(double minVelocity, double maxVelocity,
|
||||
|
||||
if (status == asynSuccess) {
|
||||
|
||||
status = setStringParam(pC_->motorMessageText_, "Homing");
|
||||
status = setStringParam(pC_->motorMessageText(), "Homing");
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorMessageText_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
@ -264,19 +264,19 @@ asynStatus sinqAxis::home(double minVelocity, double maxVelocity,
|
||||
}
|
||||
|
||||
// Set the homing-related flags
|
||||
status = setIntegerParam(pC_->motorStatusHome_, 1);
|
||||
status = setIntegerParam(pC_->motorStatusHome(), 1);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusHome_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
status = setIntegerParam(pC_->motorStatusHomed_, 0);
|
||||
status = setIntegerParam(pC_->motorStatusHomed(), 0);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusHomed_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
status = setIntegerParam(pC_->motorStatusAtHome_, 0);
|
||||
status = setIntegerParam(pC_->motorStatusAtHome(), 0);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorStatusAtHome_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
@ -288,7 +288,7 @@ asynStatus sinqAxis::home(double minVelocity, double maxVelocity,
|
||||
|
||||
} else if (status == asynError) {
|
||||
// asynError means that we tried to home an absolute encoder
|
||||
status = setStringParam(pC_->motorMessageText_,
|
||||
status = setStringParam(pC_->motorMessageText(),
|
||||
"Can't home a motor with absolute encoder");
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorMessageText_",
|
||||
@ -319,7 +319,7 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) {
|
||||
|
||||
// Can the speed of the motor be varied?
|
||||
status =
|
||||
pC_->getIntegerParam(axisNo_, pC_->motorCanSetSpeed_, &variableSpeed);
|
||||
pC_->getIntegerParam(axisNo_, pC_->motorCanSetSpeed(), &variableSpeed);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorCanSetSpeed_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
@ -328,7 +328,7 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) {
|
||||
|
||||
// Check the inputs and create corresponding error messages
|
||||
if (vbas > vmax) {
|
||||
asynPrint(pC_->lowLevelPortUser_, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nLower speed "
|
||||
"limit vbas=%lf must not be smaller than upper limit "
|
||||
"vmax=%lf.\n",
|
||||
@ -336,7 +336,7 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) {
|
||||
vbas, vmax);
|
||||
|
||||
status = setStringParam(
|
||||
pC_->motorMessageText_,
|
||||
pC_->motorMessageText(),
|
||||
"Lower speed limit must not be smaller than upper speed limit");
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorMessageText_",
|
||||
@ -346,14 +346,14 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) {
|
||||
return asynError;
|
||||
}
|
||||
if (velo < vbas || velo > vmax) {
|
||||
asynPrint(pC_->lowLevelPortUser_, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nActual "
|
||||
"speed velo=%lf must be between lower limit vbas=%lf and "
|
||||
"upper limit vmax=%lf.\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
velo, vbas, vmax);
|
||||
|
||||
status = setStringParam(pC_->motorMessageText_,
|
||||
status = setStringParam(pC_->motorMessageText(),
|
||||
"Speed is not inside limits");
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorMessageText_",
|
||||
@ -363,21 +363,21 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) {
|
||||
return asynError;
|
||||
}
|
||||
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVbasFromDriver_, vbas);
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVbasFromDriver(), vbas);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorVbasFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVeloFromDriver_, velo);
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVeloFromDriver(), velo);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorVeloFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVmaxFromDriver_, vmax);
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVmaxFromDriver(), vmax);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorVmaxFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
@ -385,21 +385,21 @@ asynStatus sinqAxis::setVeloFields(double velo, double vbas, double vmax) {
|
||||
}
|
||||
} else {
|
||||
// Set minimum and maximum speed equal to the set speed
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVbasFromDriver_, velo);
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVbasFromDriver(), velo);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorVbasFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVeloFromDriver_, velo);
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVeloFromDriver(), velo);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorVeloFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVmaxFromDriver_, velo);
|
||||
status = pC_->setDoubleParam(axisNo_, pC_->motorVmaxFromDriver(), velo);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorVmaxFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
@ -415,7 +415,7 @@ asynStatus sinqAxis::setAcclField(double accl) {
|
||||
return asynError;
|
||||
}
|
||||
|
||||
asynStatus status = setDoubleParam(pC_->motorAcclFromDriver_, accl);
|
||||
asynStatus status = setDoubleParam(pC_->motorAcclFromDriver(), accl);
|
||||
if (status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(status, "motorAcclFromDriver_",
|
||||
axisNo_, __PRETTY_FUNCTION__,
|
||||
@ -425,14 +425,14 @@ asynStatus sinqAxis::setAcclField(double accl) {
|
||||
}
|
||||
|
||||
asynStatus sinqAxis::setWatchdogEnabled(bool enable) {
|
||||
return setIntegerParam(pC_->motorEnableMovWatchdog_, enable);
|
||||
return setIntegerParam(pC_->motorEnableMovWatchdog(), enable);
|
||||
}
|
||||
|
||||
asynStatus sinqAxis::startMovTimeoutWatchdog() {
|
||||
asynStatus pl_status;
|
||||
int enableMovWatchdog = 0;
|
||||
|
||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorEnableMovWatchdog_,
|
||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorEnableMovWatchdog(),
|
||||
&enableMovWatchdog);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorEnableMovWatchdog_",
|
||||
@ -460,7 +460,7 @@ asynStatus sinqAxis::startMovTimeoutWatchdog() {
|
||||
to save the read result to the member variable earlier), since the
|
||||
parameter library is updated at a later stage!
|
||||
*/
|
||||
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_",
|
||||
@ -468,7 +468,7 @@ asynStatus sinqAxis::startMovTimeoutWatchdog() {
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorPosition_,
|
||||
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorPosition(),
|
||||
&motorPositionRec);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition",
|
||||
@ -492,7 +492,7 @@ asynStatus sinqAxis::startMovTimeoutWatchdog() {
|
||||
*/
|
||||
|
||||
// Read the velocity
|
||||
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorVelocity_,
|
||||
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorVelocity(),
|
||||
&motorVelocityRec);
|
||||
|
||||
// Only calculate timeContSpeed if the motorVelocity has been populated
|
||||
@ -508,7 +508,7 @@ asynStatus sinqAxis::startMovTimeoutWatchdog() {
|
||||
}
|
||||
|
||||
pl_status =
|
||||
pC_->getDoubleParam(axisNo_, pC_->motorAccel_, &motorAccelRec);
|
||||
pC_->getDoubleParam(axisNo_, pC_->motorAccel(), &motorAccelRec);
|
||||
if (pl_status == asynSuccess && motorVelocityRec > 0.0 &&
|
||||
motorAccelRec > 0.0) {
|
||||
|
||||
@ -533,7 +533,7 @@ asynStatus sinqAxis::checkMovTimeoutWatchdog(bool moving) {
|
||||
asynStatus pl_status;
|
||||
int enableMovWatchdog = 0;
|
||||
|
||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorEnableMovWatchdog_,
|
||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorEnableMovWatchdog(),
|
||||
&enableMovWatchdog);
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorEnableMovWatchdog_",
|
||||
@ -550,14 +550,14 @@ asynStatus sinqAxis::checkMovTimeoutWatchdog(bool moving) {
|
||||
// Check if the expected time of arrival has been exceeded.
|
||||
if (expectedArrivalTime_ < time(NULL)) {
|
||||
// Check the watchdog
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nExceeded "
|
||||
"expected arrival time %ld (current time is %ld).\n",
|
||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||
expectedArrivalTime_, time(NULL));
|
||||
|
||||
pl_status = setStringParam(
|
||||
pC_->motorMessageText_,
|
||||
pC_->motorMessageText(),
|
||||
"Exceeded expected arrival time. Check if the axis is blocked.");
|
||||
if (pl_status != asynSuccess) {
|
||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||
@ -565,7 +565,7 @@ asynStatus sinqAxis::checkMovTimeoutWatchdog(bool moving) {
|
||||
__LINE__);
|
||||
}
|
||||
|
||||
pl_status = setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
pl_status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||
if (pl_status != asynSuccess) {
|
||||
pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_", axisNo_,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
|
@ -304,7 +304,12 @@ class epicsShareClass sinqAxis : public asynMotorAxis {
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
friend class sinqController;
|
||||
/**
|
||||
* @brief Return the axis number of this axis
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
int axisNo() { return axisNo_; }
|
||||
|
||||
protected:
|
||||
// Internal variables used in the movement timeout watchdog
|
||||
|
@ -51,7 +51,7 @@ sinqController::sinqController(const char *portName,
|
||||
msgPrintControl_(4) {
|
||||
|
||||
asynStatus status = asynSuccess;
|
||||
lowLevelPortUser_ = nullptr;
|
||||
ipPortUser_ = nullptr;
|
||||
|
||||
// Initial values for the average timeout mechanism, can be overwritten
|
||||
// later by a FFI function
|
||||
@ -74,8 +74,8 @@ sinqController::sinqController(const char *portName,
|
||||
We try to connect to the port via the port name provided by the constructor.
|
||||
If this fails, the function is terminated via exit.
|
||||
*/
|
||||
pasynOctetSyncIO->connect(ipPortConfigName, 0, &lowLevelPortUser_, NULL);
|
||||
if (status != asynSuccess || lowLevelPortUser_ == nullptr) {
|
||||
pasynOctetSyncIO->connect(ipPortConfigName, 0, &ipPortUser_, NULL);
|
||||
if (status != asynSuccess || ipPortUser_ == nullptr) {
|
||||
errlogPrintf("Controller \"%s\" => %s, line %d:\nFATAL ERROR (cannot "
|
||||
"connect to MCU controller).\n"
|
||||
"Terminating IOC",
|
||||
@ -296,7 +296,7 @@ asynStatus sinqController::writeInt32(asynUser *pasynUser, epicsInt32 value) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nAxis is not an "
|
||||
"instance of sinqAxis",
|
||||
portName, axis->axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
portName, axis->axisNo(), __PRETTY_FUNCTION__, __LINE__);
|
||||
return asynError;
|
||||
}
|
||||
|
||||
@ -314,7 +314,7 @@ asynStatus sinqController::writeInt32(asynUser *pasynUser, epicsInt32 value) {
|
||||
|
||||
asynStatus sinqController::readInt32(asynUser *pasynUser, epicsInt32 *value) {
|
||||
|
||||
// Casting into a sinqAxis is necessary to get access to the field axisNo_
|
||||
// Casting into a sinqAxis is necessary to get access to the field axisNo()
|
||||
asynMotorAxis *asynAxis = getAxis(pasynUser);
|
||||
sinqAxis *axis = dynamic_cast<sinqAxis *>(asynAxis);
|
||||
|
||||
@ -322,14 +322,14 @@ asynStatus sinqController::readInt32(asynUser *pasynUser, epicsInt32 *value) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nAxis is not an "
|
||||
"instance of sinqAxis.\n",
|
||||
portName, axis->axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||
portName, axis->axisNo(), __PRETTY_FUNCTION__, __LINE__);
|
||||
return asynError;
|
||||
}
|
||||
|
||||
if (pasynUser->reason == motorEnableRBV_) {
|
||||
return getIntegerParam(axis->axisNo_, motorEnableRBV_, value);
|
||||
return getIntegerParam(axis->axisNo(), motorEnableRBV_, value);
|
||||
} else if (pasynUser->reason == motorCanDisable_) {
|
||||
return getIntegerParam(axis->axisNo_, motorCanDisable_, value);
|
||||
return getIntegerParam(axis->axisNo(), motorCanDisable_, value);
|
||||
} else {
|
||||
return asynMotorController::readInt32(pasynUser, value);
|
||||
}
|
||||
@ -342,7 +342,7 @@ asynStatus sinqController::errMsgCouldNotParseResponse(const char *command,
|
||||
int line) {
|
||||
asynStatus pl_status = asynSuccess;
|
||||
|
||||
asynPrint(lowLevelPortUser_, ASYN_TRACE_ERROR,
|
||||
asynPrint(ipPortUser_, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nCould not interpret "
|
||||
"response \"%s\" for command \"%s\".\n",
|
||||
portName, axisNo, functionName, line, response, command);
|
||||
@ -371,7 +371,7 @@ asynStatus sinqController::paramLibAccessFailed(asynStatus status,
|
||||
int line) {
|
||||
|
||||
if (status != asynSuccess) {
|
||||
asynPrint(lowLevelPortUser_, ASYN_TRACE_ERROR,
|
||||
asynPrint(ipPortUser_, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\n Accessing the "
|
||||
"parameter library failed for parameter %s with error %s.\n",
|
||||
portName, axisNo, functionName, line, parameter,
|
||||
@ -446,12 +446,12 @@ asynStatus sinqController::checkComTimeoutWatchdog(sinqAxis *axis) {
|
||||
char motorMessage[200] = {0};
|
||||
|
||||
asynStatus status =
|
||||
checkComTimeoutWatchdog(axis->axisNo_, motorMessage, 200);
|
||||
checkComTimeoutWatchdog(axis->axisNo(), motorMessage, 200);
|
||||
if (status == asynError) {
|
||||
status = axis->setStringParam(motorMessageText_, motorMessage);
|
||||
if (status != asynSuccess) {
|
||||
return paramLibAccessFailed(status, "motorMessageText_",
|
||||
axis->axisNo_, __PRETTY_FUNCTION__,
|
||||
axis->axisNo(), __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
}
|
||||
@ -498,13 +498,13 @@ asynStatus sinqController::checkMaxSubsequentTimeouts(int timeoutNo,
|
||||
|
||||
char motorMessage[200] = {0};
|
||||
|
||||
asynStatus status =
|
||||
checkMaxSubsequentTimeouts(axis->axisNo_, timeoutNo, motorMessage, 200);
|
||||
asynStatus status = checkMaxSubsequentTimeouts(axis->axisNo(), timeoutNo,
|
||||
motorMessage, 200);
|
||||
if (status == asynError) {
|
||||
status = axis->setStringParam(motorMessageText_, motorMessage);
|
||||
if (status != asynSuccess) {
|
||||
return paramLibAccessFailed(status, "motorMessageText_",
|
||||
axis->axisNo_, __PRETTY_FUNCTION__,
|
||||
axis->axisNo(), __PRETTY_FUNCTION__,
|
||||
__LINE__);
|
||||
}
|
||||
}
|
||||
@ -640,9 +640,9 @@ asynStatus setMaxSubsequentTimeouts(const char *portName,
|
||||
if (ptr == nullptr) {
|
||||
/*
|
||||
We can't use asynPrint here since this macro would require us
|
||||
to get a lowLevelPortUser_ from a pointer to an asynPortDriver.
|
||||
to get a ipPortUser_ from a pointer to an asynPortDriver.
|
||||
However, the given pointer is a nullptr and therefore doesn't
|
||||
have a lowLevelPortUser_! printf is an EPICS alternative which
|
||||
have a ipPortUser_! printf is an EPICS alternative which
|
||||
works w/o that, but doesn't offer the comfort provided
|
||||
by the asynTrace-facility
|
||||
*/
|
||||
|
@ -218,15 +218,92 @@ class epicsShareClass sinqController : public asynMotorController {
|
||||
* @brief Get a reference to the map used to control the maximum number of
|
||||
* message repetitions. See the documentation of printRepetitionWatchdog in
|
||||
* msgPrintControl.h for details.
|
||||
*
|
||||
* @return std::unordered_map<msgPrintControlKey, size_t>&
|
||||
*/
|
||||
msgPrintControl &getMsgPrintControl();
|
||||
|
||||
friend class sinqAxis;
|
||||
// =========================================================================
|
||||
// Public getters for protected members
|
||||
|
||||
// Accessors for double parameters
|
||||
int motorMoveRel() { return motorMoveRel_; }
|
||||
int motorMoveAbs() { return motorMoveAbs_; }
|
||||
int motorMoveVel() { return motorMoveVel_; }
|
||||
int motorHome() { return motorHome_; }
|
||||
int motorStop() { return motorStop_; }
|
||||
int motorVelocity() { return motorVelocity_; }
|
||||
int motorVelBase() { return motorVelBase_; }
|
||||
int motorAccel() { return motorAccel_; }
|
||||
int motorPosition() { return motorPosition_; }
|
||||
int motorEncoderPosition() { return motorEncoderPosition_; }
|
||||
int motorDeferMoves() { return motorDeferMoves_; }
|
||||
int motorMoveToHome() { return motorMoveToHome_; }
|
||||
int motorResolution() { return motorResolution_; }
|
||||
int motorEncoderRatio() { return motorEncoderRatio_; }
|
||||
int motorPGain() { return motorPGain_; }
|
||||
int motorIGain() { return motorIGain_; }
|
||||
int motorDGain() { return motorDGain_; }
|
||||
int motorHighLimit() { return motorHighLimit_; }
|
||||
int motorLowLimit() { return motorLowLimit_; }
|
||||
int motorClosedLoop() { return motorClosedLoop_; }
|
||||
int motorPowerAutoOnOff() { return motorPowerAutoOnOff_; }
|
||||
int motorPowerOnDelay() { return motorPowerOnDelay_; }
|
||||
int motorPowerOffDelay() { return motorPowerOffDelay_; }
|
||||
int motorPowerOffFraction() { return motorPowerOffFraction_; }
|
||||
int motorPostMoveDelay() { return motorPostMoveDelay_; }
|
||||
int motorStatus() { return motorStatus_; }
|
||||
int motorUpdateStatus() { return motorUpdateStatus_; }
|
||||
|
||||
// Accessors for sztatus bits (integers)
|
||||
int motorStatusDirection() { return motorStatusDirection_; }
|
||||
int motorStatusDone() { return motorStatusDone_; }
|
||||
int motorStatusHighLimit() { return motorStatusHighLimit_; }
|
||||
int motorStatusAtHome() { return motorStatusAtHome_; }
|
||||
int motorStatusSlip() { return motorStatusSlip_; }
|
||||
int motorStatusPowerOn() { return motorStatusPowerOn_; }
|
||||
int motorStatusFollowingError() { return motorStatusFollowingError_; }
|
||||
int motorStatusHome() { return motorStatusHome_; }
|
||||
int motorStatusHasEncoder() { return motorStatusHasEncoder_; }
|
||||
int motorStatusProblem() { return motorStatusProblem_; }
|
||||
int motorStatusMoving() { return motorStatusMoving_; }
|
||||
int motorStatusGainSupport() { return motorStatusGainSupport_; }
|
||||
int motorStatusCommsError() { return motorStatusCommsError_; }
|
||||
int motorStatusLowLimit() { return motorStatusLowLimit_; }
|
||||
int motorStatusHomed() { return motorStatusHomed_; }
|
||||
|
||||
// Parameters for passing additional motor record information to the driver
|
||||
int motorRecResolution() { return motorRecResolution_; }
|
||||
int motorRecDirection() { return motorRecDirection_; }
|
||||
int motorRecOffset() { return motorRecOffset_; }
|
||||
|
||||
// Accessors for additional PVs defined in sinqController
|
||||
int motorMessageText() { return motorMessageText_; }
|
||||
int motorReset() { return motorReset_; }
|
||||
int motorEnable() { return motorEnable_; }
|
||||
int motorEnableRBV() { return motorEnableRBV_; }
|
||||
int motorCanDisable() { return motorCanDisable_; }
|
||||
int motorEnableMovWatchdog() { return motorEnableMovWatchdog_; }
|
||||
int motorCanSetSpeed() { return motorCanSetSpeed_; }
|
||||
int motorLimitsOffset() { return motorLimitsOffset_; }
|
||||
int motorForceStop() { return motorForceStop_; }
|
||||
int motorVeloFromDriver() { return motorVeloFromDriver_; }
|
||||
int motorVbasFromDriver() { return motorVbasFromDriver_; }
|
||||
int motorVmaxFromDriver() { return motorVmaxFromDriver_; }
|
||||
int motorAcclFromDriver() { return motorAcclFromDriver_; }
|
||||
int motorHighLimitFromDriver() { return motorHighLimitFromDriver_; }
|
||||
int motorLowLimitFromDriver() { return motorLowLimitFromDriver_; }
|
||||
int encoderType() { return encoderType_; }
|
||||
|
||||
// Additional members
|
||||
int numAxes() { return numAxes_; }
|
||||
asynUser *asynUserSelf() { return pasynUserSelf; }
|
||||
asynUser *ipPortUser() { return ipPortUser_; }
|
||||
|
||||
// =========================================================================
|
||||
|
||||
protected:
|
||||
asynUser *lowLevelPortUser_;
|
||||
// Pointer to the port user which is specified by the char array
|
||||
// ipPortConfigName in the constructor
|
||||
asynUser *ipPortUser_;
|
||||
double movingPollPeriod_;
|
||||
double idlePollPeriod_;
|
||||
msgPrintControl msgPrintControl_;
|
||||
|
Reference in New Issue
Block a user