Compare commits

...

5 Commits
1.0.0 ... 1.1.1

6 changed files with 60 additions and 12 deletions

View File

@ -31,3 +31,14 @@ record(longout, "$(INSTR)FlushHardware") {
field(PINI, "NO")
field(VAL, "1")
}
# If this PV is set to 1 (default), the position limits are read out from the
# controller. Otherwise, the limits given in the substitution file (DHLM and
# DLLM) are used.
# This record is coupled to the parameter library via limFromHardware -> LIM_FROM_HARDWARE.
record(longout, "$(INSTR)$(M):LimFromHardware") {
field(DTYP, "asynInt32")
field(OUT, "@asyn($(CONTROLLER),$(AXIS),1) LIM_FROM_HARDWARE")
field(PINI, "YES")
field(VAL, "$(LIMFROMHARDWARE=1)")
}

View File

@ -609,19 +609,30 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
__LINE__);
}
pl_status = pC_->setDoubleParam(axisNo_, pC_->motorHighLimitFromDriver(),
highLimit);
int limFromHardware = 0;
pl_status =
pC_->getIntegerParam(axisNo_, pC_->limFromHardware(), &limFromHardware);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
return pC_->paramLibAccessFailed(pl_status, "limFromHardware", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
pl_status =
pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver(), lowLimit);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorLowLimit_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
if (limFromHardware != 0) {
pl_status = pC_->setDoubleParam(
axisNo_, pC_->motorHighLimitFromDriver(), highLimit);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(
pl_status, "motorHighLimitFromDriver_", axisNo_,
__PRETTY_FUNCTION__, __LINE__);
}
pl_status = pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver(),
lowLimit);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorLowLimit_",
axisNo_, __PRETTY_FUNCTION__,
__LINE__);
}
}
pl_status = setMotorPosition(currentPosition);
@ -1419,7 +1430,7 @@ asynStatus turboPmacAxis::enable(bool on) {
// Failed to change axis status within timeout_enable_disable => Send a
// corresponding message
asynPrint(pC_->pasynUser(), ASYN_TRACE_FLOW,
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
"Controller \"%s\", axis %d => %s, line %d\nFailed to %s axis "
"within %d seconds\n",
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,

View File

@ -24,6 +24,7 @@ class turboPmacAxis : public sinqAxis {
/**
* @brief Destroy the turboPmacAxis
*
* This destructor is necessary in order to use the PIMPL idiom.
*/
virtual ~turboPmacAxis();

View File

@ -45,6 +45,7 @@ struct turboPmacControllerImpl {
int rereadEncoderPosition;
int readConfig;
int flushHardware;
int limFromHardware;
};
#define NUM_turboPmac_DRIVER_PARAMS 3
@ -114,6 +115,17 @@ turboPmacController::turboPmacController(const char *portName,
exit(-1);
}
status = createParam("LIM_FROM_HARDWARE", asynParamInt32,
&pTurboPmacC_->limFromHardware);
if (status != asynSuccess) {
asynPrint(this->pasynUser(), ASYN_TRACE_ERROR,
"Controller \"%s\" => %s, line %d\nFATAL ERROR (creating a "
"parameter failed with %s).\nTerminating IOC",
portName, __PRETTY_FUNCTION__, __LINE__,
stringifyAsynStatus(status));
exit(-1);
}
/*
Define the end-of-string of a message coming from the device to EPICS.
It is not necessary to append a terminator to outgoing messages, since
@ -167,6 +179,8 @@ turboPmacController::turboPmacController(const char *portName,
}
}
turboPmacController::~turboPmacController() {}
/*
Access one of the axes of the controller via the axis adress stored in asynUser.
If the axis does not exist or is not a Axis, a nullptr is returned and an
@ -506,6 +520,9 @@ int turboPmacController::rereadEncoderPosition() {
}
int turboPmacController::readConfig() { return pTurboPmacC_->readConfig; }
int turboPmacController::flushHardware() { return pTurboPmacC_->flushHardware; }
int turboPmacController::limFromHardware() {
return pTurboPmacC_->limFromHardware;
}
asynUser *turboPmacController::pasynInt32SyncIOipPort() {
return pTurboPmacC_->pasynInt32SyncIOipPort;

View File

@ -36,6 +36,13 @@ class turboPmacController : public sinqController {
double idlePollPeriod, double comTimeout,
int numExtraParams = 0);
/**
* @brief Destroy the controller. Its implementation is empty, however the
* destructor needs to be provided for handling turboPmacControllerImpl.
*
*/
virtual ~turboPmacController();
/**
* @brief Get the axis object
*
@ -122,6 +129,7 @@ class turboPmacController : public sinqController {
int rereadEncoderPosition();
int readConfig();
int flushHardware();
int limFromHardware();
asynUser *pasynInt32SyncIOipPort();