pmacV3 read axis state

This commit is contained in:
brambilla_m
2022-03-03 14:13:09 +01:00
parent 14bbda3364
commit fbf2331a05
4 changed files with 35 additions and 30 deletions

View File

@@ -472,7 +472,6 @@ asynStatus pmacController::writeInt32(asynUser *pasynUser, epicsInt32 value)
}
/** Returns a pointer to an pmacAxis object.
* Returns NULL if the axis number encoded in pasynUser is invalid.
* \param[in] pasynUser asynUser structure that encodes the axis index number. */
@@ -581,6 +580,7 @@ SeleneController::SeleneController(const char *portName, const char *lowLevelPor
pmacController(portName, lowLevelPortName, lowLevelPortAddress, numAxes, movingPollPeriod, idlePollPeriod, extraParams) {
static const char *functionName = "pmacV3Controller::pmacV3Controller";
createParam(EnableAxisString, asynParamInt32, &enableAxis_);
createParam(AxisStateString, asynParamInt32, &axisState_);
callParamCallbacks();
}
@@ -854,6 +854,32 @@ asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
return status;
}
asynStatus pmacV3Controller::readInt32(asynUser *pasynUser, epicsInt32 *value) {
int function = pasynUser->reason;
asynStatus status = asynError;
pmacAxis *pAxis = NULL;
static const char *functionName = "pmacController::readInt32";
char command[this->PMAC_MAXBUF_];
char response[this->PMAC_MAXBUF_];
debugFlow(functionName);
pAxis = this->getAxis(pasynUser);
if (!pAxis) {
return asynError;
}
if (function == axisState_) {
snprintf(command, sizeof(command), "P%2.2d00", pAxis->axisNo_);
status = this->lowLevelWriteRead(axisNo_, command, response);
*value = strtol(response, NULL, 10);
setIntegerParam(pAxis->axisState_, value);
return status
}
return pmacController::readInt32(pasynUser, value);
}
/* Code for iocsh registration */
#ifdef vxWorks