Added macros for adding and retrieving paramlib entries in order to make
the code less cluttered. Also built in a mechanism which makes sure that forced fast polls are not ignored anymore when adaptive polling is enabled.
This commit is contained in:
@@ -314,8 +314,24 @@ sinqController::~sinqController(void) {
|
||||
free(this->pAxes_);
|
||||
}
|
||||
|
||||
msgPrintControl &sinqController::getMsgPrintControl() {
|
||||
return msgPrintControl_;
|
||||
/*
|
||||
Access one of the axes of the controller via the axis adress stored in asynUser.
|
||||
If the axis does not exist or is not an sinqAxis, the function returns a
|
||||
nullptr.
|
||||
*/
|
||||
sinqAxis *sinqController::getSinqAxis(asynUser *pasynUser) {
|
||||
asynMotorAxis *asynAxis = sinqController::getAxis(pasynUser);
|
||||
return dynamic_cast<sinqAxis *>(asynAxis);
|
||||
}
|
||||
|
||||
/*
|
||||
Access one of the axes of the controller via the axis index.
|
||||
If the axis does not exist or is not an sinqAxis, the function returns a
|
||||
nullptr.
|
||||
*/
|
||||
sinqAxis *sinqController::getSinqAxis(int axisNo) {
|
||||
asynMotorAxis *asynAxis = sinqController::getAxis(axisNo);
|
||||
return dynamic_cast<sinqAxis *>(asynAxis);
|
||||
}
|
||||
|
||||
asynStatus sinqController::writeInt32(asynUser *pasynUser, epicsInt32 value) {
|
||||
@@ -323,9 +339,7 @@ asynStatus sinqController::writeInt32(asynUser *pasynUser, epicsInt32 value) {
|
||||
|
||||
// =====================================================================
|
||||
|
||||
asynMotorAxis *asynAxis = getAxis(pasynUser);
|
||||
sinqAxis *axis = dynamic_cast<sinqAxis *>(asynAxis);
|
||||
|
||||
sinqAxis *axis = getSinqAxis(pasynUser);
|
||||
if (axis == nullptr) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nAxis is not an "
|
||||
@@ -348,22 +362,21 @@ 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()
|
||||
asynMotorAxis *asynAxis = getAxis(pasynUser);
|
||||
sinqAxis *axis = dynamic_cast<sinqAxis *>(asynAxis);
|
||||
|
||||
sinqAxis *axis = getSinqAxis(pasynUser);
|
||||
if (axis == nullptr) {
|
||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"Controller \"%s\", axis %d => %s, line %d:\nAxis is not an "
|
||||
"instance of sinqAxis.\n",
|
||||
"instance of sinqAxis",
|
||||
portName, axis->axisNo(), __PRETTY_FUNCTION__, __LINE__);
|
||||
return asynError;
|
||||
}
|
||||
|
||||
if (pasynUser->reason == motorEnableRBV_) {
|
||||
return getIntegerParam(axis->axisNo(), motorEnableRBV_, value);
|
||||
getAxisParamChecked(axis, motorEnableRBV, value);
|
||||
return asynSuccess;
|
||||
} else if (pasynUser->reason == motorCanDisable_) {
|
||||
return getIntegerParam(axis->axisNo(), motorCanDisable_, value);
|
||||
getAxisParamChecked(axis, motorCanDisable, value);
|
||||
return asynSuccess;
|
||||
} else {
|
||||
return asynMotorController::readInt32(pasynUser, value);
|
||||
}
|
||||
@@ -374,26 +387,24 @@ asynStatus sinqController::couldNotParseResponse(const char *command,
|
||||
int axisNo,
|
||||
const char *functionName,
|
||||
int line) {
|
||||
asynStatus pl_status = asynSuccess;
|
||||
|
||||
asynPrint(pasynOctetSyncIOipPort_, 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);
|
||||
|
||||
pl_status = setStringParam(
|
||||
motorMessageText_,
|
||||
"Could not interpret controller response. Please call the support");
|
||||
if (pl_status != asynSuccess) {
|
||||
return paramLibAccessFailed(pl_status, "motorMessageText_", axisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
sinqAxis *axis = getSinqAxis(axisNo);
|
||||
if (axis == nullptr) {
|
||||
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__);
|
||||
return asynError;
|
||||
}
|
||||
|
||||
pl_status = setIntegerParam(motorStatusCommsError_, 1);
|
||||
if (pl_status != asynSuccess) {
|
||||
return paramLibAccessFailed(pl_status, "motorStatusCommsError_", axisNo,
|
||||
__PRETTY_FUNCTION__, __LINE__);
|
||||
}
|
||||
setAxisParamChecked(
|
||||
axis, motorMessageText,
|
||||
"Could not interpret controller response. Please call the support");
|
||||
setAxisParamChecked(axis, motorStatusCommsError, true);
|
||||
|
||||
return asynError;
|
||||
}
|
||||
@@ -413,7 +424,7 @@ asynStatus sinqController::paramLibAccessFailed(asynStatus status,
|
||||
|
||||
// Log the error message and try to propagate it. If propagating fails,
|
||||
// there is nothing we can do here anyway.
|
||||
setStringParam(motorMessageText_,
|
||||
setStringParam(motorMessageText(),
|
||||
"Accessing paramLib failed. Please call the support.");
|
||||
}
|
||||
|
||||
@@ -545,6 +556,22 @@ asynStatus sinqController::checkMaxSubsequentTimeouts(int timeoutNo,
|
||||
return status;
|
||||
}
|
||||
|
||||
asynStatus sinqController::poll() {
|
||||
// Decrement the number of outstanding forced fast polls, if they are not
|
||||
// zero
|
||||
if (outstandingForcedFastPolls_ > 0) {
|
||||
outstandingForcedFastPolls_--;
|
||||
}
|
||||
return asynMotorController::poll();
|
||||
}
|
||||
|
||||
asynStatus sinqController::wakeupPoller() {
|
||||
// + 1 since outstandingForcedFastPolls_ is reduced once at the start of
|
||||
// a poll cycle
|
||||
outstandingForcedFastPolls_ = forcedFastPolls_ + 1;
|
||||
return asynMotorController::wakeupPoller();
|
||||
}
|
||||
|
||||
// Static pointers (valid for the entire lifetime of the IOC). The number behind
|
||||
// the strings gives the integer number of each variant (see also method
|
||||
// stringifyAsynStatus)
|
||||
|
||||
Reference in New Issue
Block a user