Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
a990da4245 | |||
83a74ce8d0 | |||
445dd44c19 | |||
d471041c59 | |||
967613447b |
2
Makefile
2
Makefile
@ -14,7 +14,7 @@ REQUIRED+=sinqMotor
|
|||||||
motorBase_VERSION=7.2.2
|
motorBase_VERSION=7.2.2
|
||||||
|
|
||||||
# Specify the version of sinqMotor we want to build against
|
# Specify the version of sinqMotor we want to build against
|
||||||
sinqMotor_VERSION=0.8.0
|
sinqMotor_VERSION=0.10.0
|
||||||
|
|
||||||
# These headers allow to depend on this library for derived drivers.
|
# These headers allow to depend on this library for derived drivers.
|
||||||
HEADERS += src/turboPmacAxis.h
|
HEADERS += src/turboPmacAxis.h
|
||||||
|
10
README.md
10
README.md
@ -1,5 +1,7 @@
|
|||||||
# turboPmac
|
# turboPmac
|
||||||
|
|
||||||
|
## <span style="color:red">Please read the documentation of sinqMotor first: https://git.psi.ch/sinq-epics-modules/sinqmotor</span>
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
This is a driver for the Turbo PMAC motion controller with the SINQ communication protocol. It is based on the sinqMotor shared library (https://git.psi.ch/sinq-epics-modules/sinqmotor). The header files contain detailed documentation for all public functions. The headers themselves are exported when building the library to allow other drivers to depend on this one.
|
This is a driver for the Turbo PMAC motion controller with the SINQ communication protocol. It is based on the sinqMotor shared library (https://git.psi.ch/sinq-epics-modules/sinqmotor). The header files contain detailed documentation for all public functions. The headers themselves are exported when building the library to allow other drivers to depend on this one.
|
||||||
@ -21,11 +23,11 @@ turboPmac exports the following IOC shell functions:
|
|||||||
- `turboPmacController`: Create a new controller object.
|
- `turboPmacController`: Create a new controller object.
|
||||||
- `turboPmacAxis`: Create a new axis object.
|
- `turboPmacAxis`: Create a new axis object.
|
||||||
|
|
||||||
The full mcu.cmd file looks like this:
|
The full turboPmacX.cmd file looks like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
# Define the name of the controller and the corresponding port
|
# Define the name of the controller and the corresponding port
|
||||||
epicsEnvSet("NAME","mcu")
|
epicsEnvSet("NAME","turboPmacX")
|
||||||
epicsEnvSet("ASYN_PORT","p$(NAME)")
|
epicsEnvSet("ASYN_PORT","p$(NAME)")
|
||||||
|
|
||||||
# Create the TCP/IP socket used to talk with the controller. The socket can be adressed from within the IOC shell via the port name
|
# Create the TCP/IP socket used to talk with the controller. The socket can be adressed from within the IOC shell via the port name
|
||||||
@ -47,8 +49,8 @@ turboPmacAxis("$(NAME)",5);
|
|||||||
# Set the number of subsequent timeouts
|
# Set the number of subsequent timeouts
|
||||||
setMaxSubsequentTimeouts("$(NAME)", 20);
|
setMaxSubsequentTimeouts("$(NAME)", 20);
|
||||||
|
|
||||||
# Configure the timeout frequency watchdog:
|
# Configure the timeout frequency watchdog: A maximum of 10 timeouts are allowed in 300 seconds before an alarm message is sent.
|
||||||
setThresholdComTimeout("$(NAME)", 100, 1);
|
setThresholdComTimeout("$(NAME)", 300, 10);
|
||||||
|
|
||||||
# Parametrize the EPICS record database with the substitution file named after the MCU.
|
# Parametrize the EPICS record database with the substitution file named after the MCU.
|
||||||
epicsEnvSet("SINQDBPATH","$(sinqMotor_DB)/sinqMotor.db")
|
epicsEnvSet("SINQDBPATH","$(sinqMotor_DB)/sinqMotor.db")
|
||||||
|
@ -54,13 +54,13 @@ turboPmacAxis::turboPmacAxis(turboPmacController *pC, int axisNo,
|
|||||||
line 40). However, we want the IOC creation to stop completely, since this
|
line 40). However, we want the IOC creation to stop completely, since this
|
||||||
is a configuration error.
|
is a configuration error.
|
||||||
*/
|
*/
|
||||||
if (axisNo >= pC->numAxes_) {
|
if (axisNo >= pC->numAxes()) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d: FATAL ERROR: "
|
"Controller \"%s\", axis %d => %s, line %d: FATAL ERROR: "
|
||||||
"Axis index %d must be smaller than the total number of axes "
|
"Axis index %d must be smaller than the total number of axes "
|
||||||
"%d",
|
"%d",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
axisNo_, pC->numAxes_);
|
axisNo_, pC->numAxes());
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,13 +78,14 @@ turboPmacAxis::turboPmacAxis(turboPmacController *pC, int axisNo,
|
|||||||
|
|
||||||
// Initialize all member variables
|
// Initialize all member variables
|
||||||
waitForHandshake_ = false;
|
waitForHandshake_ = false;
|
||||||
|
timeAtHandshake_ = 0;
|
||||||
axisStatus_ = 0;
|
axisStatus_ = 0;
|
||||||
|
|
||||||
// Provide initial values for some parameter library entries
|
// Provide initial values for some parameter library entries
|
||||||
status = pC_->setIntegerParam(axisNo_, pC_->rereadEncoderPosition_, 0);
|
status = pC_->setIntegerParam(axisNo_, pC_->rereadEncoderPosition(), 0);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
"Controller \"%s\", axis %d => %s, line %d:\nFATAL ERROR "
|
||||||
"(setting a parameter value failed with %s)\n. Terminating IOC",
|
"(setting a parameter value failed with %s)\n. Terminating IOC",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
@ -93,10 +94,10 @@ turboPmacAxis::turboPmacAxis(turboPmacController *pC, int axisNo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// turboPmac motors can always be disabled
|
// turboPmac motors can always be disabled
|
||||||
status = pC_->setIntegerParam(axisNo_, pC_->motorCanDisable_, 1);
|
status = pC_->setIntegerParam(axisNo_, pC_->motorCanDisable(), 1);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nFATAL ERROR "
|
"Controller \"%s\", axis %d => %s, line %d\nFATAL ERROR "
|
||||||
"(setting a parameter value failed with %s)\n. Terminating IOC",
|
"(setting a parameter value failed with %s)\n. Terminating IOC",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
@ -121,7 +122,7 @@ asynStatus turboPmacAxis::init() {
|
|||||||
char command[pC_->MAXBUF_], response[pC_->MAXBUF_];
|
char command[pC_->MAXBUF_], response[pC_->MAXBUF_];
|
||||||
int nvals = 0;
|
int nvals = 0;
|
||||||
double motorRecResolution = 0.0;
|
double motorRecResolution = 0.0;
|
||||||
double motorPosition = 0.0;
|
double motorPos = 0.0;
|
||||||
double motorVelocity = 0.0;
|
double motorVelocity = 0.0;
|
||||||
double motorVmax = 0.0;
|
double motorVmax = 0.0;
|
||||||
double motorAccel = 0.0;
|
double motorAccel = 0.0;
|
||||||
@ -134,11 +135,11 @@ asynStatus turboPmacAxis::init() {
|
|||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
time_t maxInitTime = 60;
|
time_t maxInitTime = 60;
|
||||||
while (1) {
|
while (1) {
|
||||||
status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution_,
|
status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution(),
|
||||||
&motorRecResolution);
|
&motorRecResolution);
|
||||||
if (status == asynParamUndefined) {
|
if (status == asynParamUndefined) {
|
||||||
if (now + maxInitTime < time(NULL)) {
|
if (now + maxInitTime < time(NULL)) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line "
|
"Controller \"%s\", axis %d => %s, line "
|
||||||
"%d\nInitializing the parameter library failed.\n",
|
"%d\nInitializing the parameter library failed.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -165,7 +166,7 @@ asynStatus turboPmacAxis::init() {
|
|||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
nvals = sscanf(response, "%d %lf %lf %lf %lf %d", &axStatus, &motorPosition,
|
nvals = sscanf(response, "%d %lf %lf %lf %lf %d", &axStatus, &motorPos,
|
||||||
&motorVmax, &motorVelocity, &motorAccel, &acoDelay);
|
&motorVmax, &motorVelocity, &motorAccel, &acoDelay);
|
||||||
|
|
||||||
// The acoDelay is given in milliseconds -> Convert to seconds, rounded up
|
// The acoDelay is given in milliseconds -> Convert to seconds, rounded up
|
||||||
@ -177,17 +178,20 @@ asynStatus turboPmacAxis::init() {
|
|||||||
motorAccel = motorAccel * 1000;
|
motorAccel = motorAccel * 1000;
|
||||||
|
|
||||||
if (nvals != 6) {
|
if (nvals != 6) {
|
||||||
return pC_->errMsgCouldNotParseResponse(command, response, axisNo_,
|
return pC_->couldNotParseResponse(command, response, axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transform from motor to parameter library coordinates
|
|
||||||
motorPosition = motorPosition / motorRecResolution;
|
|
||||||
|
|
||||||
// Store these values in the parameter library
|
// Store these values in the parameter library
|
||||||
status = pC_->setDoubleParam(axisNo_, pC_->motorPosition_, motorPosition);
|
status = setMotorPosition(motorPos);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(status, "motorPosition_", axisNo_,
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initial motor status is idle
|
||||||
|
status = pC_->setIntegerParam(axisNo_, pC_->motorStatusDone(), 1);
|
||||||
|
if (status != asynSuccess) {
|
||||||
|
return pC_->paramLibAccessFailed(status, "motorStatusDone_", axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +211,7 @@ asynStatus turboPmacAxis::init() {
|
|||||||
// If we can't communicate with the parameter library, it doesn't make
|
// If we can't communicate with the parameter library, it doesn't make
|
||||||
// sense to try and upstream this to the user -> Just log the error
|
// sense to try and upstream this to the user -> Just log the error
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\ncallParamCallbacks "
|
"Controller \"%s\", axis %d => %s, line %d\ncallParamCallbacks "
|
||||||
"failed with %s.\n",
|
"failed with %s.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
@ -245,11 +249,41 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
double lowLimit = 0.0;
|
double lowLimit = 0.0;
|
||||||
double limitsOffset = 0.0;
|
double limitsOffset = 0.0;
|
||||||
|
|
||||||
|
// Was the axis idle during the previous poll?
|
||||||
|
int previousStatusDone = 1;
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
// Are we currently waiting for a handshake?
|
// Are we currently waiting for a handshake?
|
||||||
if (waitForHandshake_) {
|
if (waitForHandshake_) {
|
||||||
|
|
||||||
|
// Check if the handshake takes too long and communicate an error in
|
||||||
|
// this case. A handshake should not take more than 5 seconds.
|
||||||
|
time_t currentTime = time(NULL);
|
||||||
|
bool timedOut = (currentTime > timeAtHandshake_ + 5);
|
||||||
|
|
||||||
|
if (pC_->getMsgPrintControl().shouldBePrinted(
|
||||||
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, timedOut,
|
||||||
|
pC_->asynUserSelf())) {
|
||||||
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
|
"Controller \"%s\", axis %d => %s, line %d\nAsked for a "
|
||||||
|
"handshake at %ld s and didn't get a positive reply yet "
|
||||||
|
"(current time is %ld s).\n",
|
||||||
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
|
timeAtHandshake_, currentTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (timedOut) {
|
||||||
|
pl_status =
|
||||||
|
setStringParam(pC_->motorMessageText(),
|
||||||
|
"Timed out while waiting for a handshake");
|
||||||
|
if (pl_status != asynSuccess) {
|
||||||
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(command, sizeof(command), "P%2.2d23 P%2.2d01", axisNo_,
|
snprintf(command, sizeof(command), "P%2.2d23 P%2.2d01", axisNo_,
|
||||||
axisNo_);
|
axisNo_);
|
||||||
rw_status = pC_->writeRead(axisNo_, command, response, 2);
|
rw_status = pC_->writeRead(axisNo_, command, response, 2);
|
||||||
@ -259,8 +293,8 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
|
|
||||||
nvals = sscanf(response, "%d %d", &handshakePerformed, &error);
|
nvals = sscanf(response, "%d %d", &handshakePerformed, &error);
|
||||||
if (nvals != 2) {
|
if (nvals != 2) {
|
||||||
return pC_->errMsgCouldNotParseResponse(
|
return pC_->couldNotParseResponse(command, response, axisNo_,
|
||||||
command, response, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
@ -277,14 +311,14 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
// poll. This is already part of the movement procedure.
|
// poll. This is already part of the movement procedure.
|
||||||
*moving = true;
|
*moving = true;
|
||||||
|
|
||||||
pl_status = setIntegerParam(pC_->motorStatusMoving_, *moving);
|
pl_status = setIntegerParam(pC_->motorStatusMoving(), *moving);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status,
|
return pC_->paramLibAccessFailed(pl_status,
|
||||||
"motorStatusMoving_", axisNo_,
|
"motorStatusMoving_", axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_status = setIntegerParam(pC_->motorStatusDone_, !(*moving));
|
pl_status = setIntegerParam(pC_->motorStatusDone(), !(*moving));
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusDone_",
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusDone_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -295,8 +329,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Motor resolution from parameter library
|
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution(),
|
||||||
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution_,
|
|
||||||
&motorRecResolution);
|
&motorRecResolution);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_",
|
return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_",
|
||||||
@ -305,16 +338,17 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read the previous motor position
|
// Read the previous motor position
|
||||||
pl_status =
|
pl_status = motorPosition(&previousPosition);
|
||||||
pC_->getDoubleParam(axisNo_, pC_->motorPosition_, &previousPosition);
|
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_,
|
return pl_status;
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transform from EPICS to motor coordinates (see comment in
|
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorStatusDone(),
|
||||||
// turboPmacAxis::atFirstPoll)
|
&previousStatusDone);
|
||||||
previousPosition = previousPosition * motorRecResolution;
|
if (pl_status != asynSuccess) {
|
||||||
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusDone_", axisNo_,
|
||||||
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
|
}
|
||||||
|
|
||||||
// Query the axis status
|
// Query the axis status
|
||||||
snprintf(command, sizeof(command),
|
snprintf(command, sizeof(command),
|
||||||
@ -328,8 +362,8 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
nvals = sscanf(response, "%d %lf %d %lf %lf", &axStatus, ¤tPosition,
|
nvals = sscanf(response, "%d %lf %d %lf %lf", &axStatus, ¤tPosition,
|
||||||
&error, &highLimit, &lowLimit);
|
&error, &highLimit, &lowLimit);
|
||||||
if (nvals != 5) {
|
if (nvals != 5) {
|
||||||
return pC_->errMsgCouldNotParseResponse(command, response, axisNo_,
|
return pC_->couldNotParseResponse(command, response, axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -345,7 +379,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
by limitsOffset on both sides.
|
by limitsOffset on both sides.
|
||||||
*/
|
*/
|
||||||
pl_status =
|
pl_status =
|
||||||
pC_->getDoubleParam(axisNo_, pC_->motorLimitsOffset_, &limitsOffset);
|
pC_->getDoubleParam(axisNo_, pC_->motorLimitsOffset(), &limitsOffset);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorLimitsOffset_",
|
return pC_->paramLibAccessFailed(pl_status, "motorLimitsOffset_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -358,7 +392,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
axisStatus_ = axStatus;
|
axisStatus_ = axStatus;
|
||||||
|
|
||||||
// Update the enablement PV
|
// Update the enablement PV
|
||||||
pl_status = setIntegerParam(pC_->motorEnableRBV_,
|
pl_status = setIntegerParam(pC_->motorEnableRBV(),
|
||||||
(axStatus != -3 && axStatus != -5));
|
(axStatus != -3 && axStatus != -5));
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorEnableRBV_", axisNo_,
|
return pC_->paramLibAccessFailed(pl_status, "motorEnableRBV_", axisNo_,
|
||||||
@ -375,13 +409,19 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
switch (axStatus) {
|
switch (axStatus) {
|
||||||
case -6:
|
case -6:
|
||||||
// Axis is stopping
|
// Axis is stopping
|
||||||
*moving = true;
|
|
||||||
|
// If the axis was already idle during the last poll, it is not moving
|
||||||
|
if (previousStatusDone == 0) {
|
||||||
|
*moving = true;
|
||||||
|
} else {
|
||||||
|
*moving = false;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case -5:
|
case -5:
|
||||||
// Axis is deactivated
|
// Axis is deactivated
|
||||||
*moving = false;
|
*moving = false;
|
||||||
|
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, "Deactivated");
|
pl_status = setStringParam(pC_->motorMessageText(), "Deactivated");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -392,18 +432,18 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
// Emergency stop
|
// Emergency stop
|
||||||
*moving = false;
|
*moving = false;
|
||||||
|
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyStatus, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyStatus, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nEmergency stop "
|
"Controller \"%s\", axis %d => %s, line %d\nEmergency stop "
|
||||||
"activated.%s\n",
|
"activated.%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
pC_->msgPrintControl_.getSuffix());
|
pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetCountStatus = false;
|
resetCountStatus = false;
|
||||||
|
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, "Emergency stop");
|
pl_status = setStringParam(pC_->motorMessageText(), "Emergency stop");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -415,7 +455,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
// Disabled
|
// Disabled
|
||||||
*moving = false;
|
*moving = false;
|
||||||
|
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, "Disabled");
|
pl_status = setStringParam(pC_->motorMessageText(), "Disabled");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -447,7 +487,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
*moving = true;
|
*moving = true;
|
||||||
|
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_FLOW,
|
pC_->asynUserSelf(), ASYN_TRACE_FLOW,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nAxis is moving\n",
|
"Controller \"%s\", axis %d => %s, line %d\nAxis is moving\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||||
|
|
||||||
@ -455,14 +495,14 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
default:
|
default:
|
||||||
*moving = false;
|
*moving = false;
|
||||||
|
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyStatus, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyStatus, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
|
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nReached "
|
"Controller \"%s\", axis %d => %s, line %d\nReached "
|
||||||
"unreachable state P%2.2d00 = %d.%s\n",
|
"unreachable state P%2.2d00 = %d.%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
axisNo_, axStatus, pC_->msgPrintControl_.getSuffix());
|
axisNo_, axStatus, pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetCountStatus = false;
|
resetCountStatus = false;
|
||||||
|
|
||||||
@ -470,7 +510,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
"Unknown state P%2.2d00 = %d has been reached. Please call "
|
"Unknown state P%2.2d00 = %d has been reached. Please call "
|
||||||
"the support.",
|
"the support.",
|
||||||
axisNo_, error);
|
axisNo_, error);
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, userMessage);
|
pl_status = setStringParam(pC_->motorMessageText(), userMessage);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -479,7 +519,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resetCountStatus) {
|
if (resetCountStatus) {
|
||||||
pC_->msgPrintControl_.resetCount(keyStatus);
|
pC_->getMsgPrintControl().resetCount(keyStatus, pC_->asynUserSelf());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*moving) {
|
if (*moving) {
|
||||||
@ -504,17 +544,17 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
case 1:
|
case 1:
|
||||||
// EPICS should already prevent this issue in the first place,
|
// EPICS should already prevent this issue in the first place,
|
||||||
// since it contains the user limits
|
// since it contains the user limits
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nTarget "
|
"Controller \"%s\", axis %d => %s, line %d\nTarget "
|
||||||
"position would exceed user limits.%s\n",
|
"position would exceed user limits.%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
pC_->msgPrintControl_.getSuffix());
|
pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
pl_status = setStringParam(pC_->motorMessageText_,
|
pl_status = setStringParam(pC_->motorMessageText(),
|
||||||
"Target position would exceed software "
|
"Target position would exceed software "
|
||||||
"limits. Please call the support.");
|
"limits. Please call the support.");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
@ -527,19 +567,19 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
// Command not possible
|
// Command not possible
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyStatus, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyStatus, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nAxis is "
|
"Controller \"%s\", axis %d => %s, line %d\nAxis is "
|
||||||
"still moving, but received another move command. EPICS "
|
"still moving, but received another move command. EPICS "
|
||||||
"should prevent this, check if *moving is set correctly.%s\n",
|
"should prevent this, check if *moving is set correctly.%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
pC_->msgPrintControl_.getSuffix());
|
pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
pl_status = setStringParam(pC_->motorMessageText_,
|
pl_status = setStringParam(pC_->motorMessageText(),
|
||||||
"Axis received move command while it is "
|
"Axis received move command while it is "
|
||||||
"still moving. Please call the support.");
|
"still moving. Please call the support.");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
@ -551,13 +591,13 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
poll_status = asynError;
|
poll_status = asynError;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nAir cushion "
|
"Controller \"%s\", axis %d => %s, line %d\nAir cushion "
|
||||||
"feedback stopped during movement (P%2.2d01 = %d).%s\n",
|
"feedback stopped during movement (P%2.2d01 = %d).%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
axisNo_, error, pC_->msgPrintControl_.getSuffix());
|
axisNo_, error, pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
@ -566,7 +606,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
"%d). Please call the support.",
|
"%d). Please call the support.",
|
||||||
axisNo_, error);
|
axisNo_, error);
|
||||||
|
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, userMessage);
|
pl_status = setStringParam(pC_->motorMessageText(), userMessage);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -574,14 +614,14 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nNo air cushion "
|
"Controller \"%s\", axis %d => %s, line %d\nNo air cushion "
|
||||||
"feedback before movement start (P%2.2d01 = %d).%s\n",
|
"feedback before movement start (P%2.2d01 = %d).%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, axisNo_,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, axisNo_,
|
||||||
error, pC_->msgPrintControl_.getSuffix());
|
error, pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
@ -589,7 +629,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
"No air cushion feedback before movement start (P%2.2d01 = "
|
"No air cushion feedback before movement start (P%2.2d01 = "
|
||||||
"%d). Please call the support.",
|
"%d). Please call the support.",
|
||||||
axisNo_, error);
|
axisNo_, error);
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, userMessage);
|
pl_status = setStringParam(pC_->motorMessageText(), userMessage);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -604,14 +644,14 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
which is not properly homed or if a bug occured.
|
which is not properly homed or if a bug occured.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nAxis hit the "
|
"Controller \"%s\", axis %d => %s, line %d\nAxis hit the "
|
||||||
"controller limits.%s\n",
|
"controller limits.%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
pC_->msgPrintControl_.getSuffix());
|
pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
@ -622,7 +662,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
"Otherwise please call the support.",
|
"Otherwise please call the support.",
|
||||||
axisNo_, error);
|
axisNo_, error);
|
||||||
|
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, userMessage);
|
pl_status = setStringParam(pC_->motorMessageText(), userMessage);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -634,14 +674,14 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
case 11:
|
case 11:
|
||||||
// Following error
|
// Following error
|
||||||
|
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nMaximum allowed "
|
"Controller \"%s\", axis %d => %s, line %d\nMaximum allowed "
|
||||||
"following error exceeded.%s\n",
|
"following error exceeded.%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
pC_->msgPrintControl_.getSuffix());
|
pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
@ -650,7 +690,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
"Check if movement range is blocked. "
|
"Check if movement range is blocked. "
|
||||||
"Otherwise please call the support.",
|
"Otherwise please call the support.",
|
||||||
axisNo_, error);
|
axisNo_, error);
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, command);
|
pl_status = setStringParam(pC_->motorMessageText(), command);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -661,13 +701,13 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nSecurity "
|
"Controller \"%s\", axis %d => %s, line %d\nSecurity "
|
||||||
"input is triggered (P%2.2d01 = %d).%s\n",
|
"input is triggered (P%2.2d01 = %d).%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
axisNo_, error, pC_->msgPrintControl_.getSuffix());
|
axisNo_, error, pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
@ -676,7 +716,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
"for errors (if available). Otherwise please call "
|
"for errors (if available). Otherwise please call "
|
||||||
"the support.",
|
"the support.",
|
||||||
axisNo_, error);
|
axisNo_, error);
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, command);
|
pl_status = setStringParam(pC_->motorMessageText(), command);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -689,13 +729,13 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
case 13:
|
case 13:
|
||||||
// Driver hardware error triggered
|
// Driver hardware error triggered
|
||||||
|
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nDriver "
|
"Controller \"%s\", axis %d => %s, line %d\nDriver "
|
||||||
"hardware error triggered.%s\n",
|
"hardware error triggered.%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
pC_->msgPrintControl_.getSuffix());
|
pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
@ -703,7 +743,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
"Driver hardware error (P%2.2d01 = 13). "
|
"Driver hardware error (P%2.2d01 = 13). "
|
||||||
"Please call the support.",
|
"Please call the support.",
|
||||||
axisNo_);
|
axisNo_);
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, command);
|
pl_status = setStringParam(pC_->motorMessageText(), command);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -716,13 +756,13 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
// EPICS should already prevent this issue in the first place,
|
// EPICS should already prevent this issue in the first place,
|
||||||
// since it contains the user limits
|
// since it contains the user limits
|
||||||
|
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nMove "
|
"Controller \"%s\", axis %d => %s, line %d\nMove "
|
||||||
"command exceeds hardware limits (P%2.2d01 = %d).%s\n",
|
"command exceeds hardware limits (P%2.2d01 = %d).%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
axisNo_, error, pC_->msgPrintControl_.getSuffix());
|
axisNo_, error, pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
@ -730,7 +770,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
"Move command exceeds hardware limits (P%2.2d01 = %d). Please "
|
"Move command exceeds hardware limits (P%2.2d01 = %d). Please "
|
||||||
"call the support.",
|
"call the support.",
|
||||||
axisNo_, error);
|
axisNo_, error);
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, userMessage);
|
pl_status = setStringParam(pC_->motorMessageText(), userMessage);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -741,21 +781,21 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
if (pC_->msgPrintControl_.shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
pC_->pasynUserSelf)) {
|
pC_->asynUserSelf())) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nUnknown error "
|
"Controller \"%s\", axis %d => %s, line %d\nUnknown error "
|
||||||
"P%2.2d01 = %d.%s\n",
|
"P%2.2d01 = %d.%s\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, axisNo_,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, axisNo_,
|
||||||
error, pC_->msgPrintControl_.getSuffix());
|
error, pC_->getMsgPrintControl().getSuffix());
|
||||||
}
|
}
|
||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
snprintf(userMessage, sizeof(userMessage),
|
snprintf(userMessage, sizeof(userMessage),
|
||||||
"Unknown error P%2.2d01 = %d. Please call the support.",
|
"Unknown error P%2.2d01 = %d. Please call the support.",
|
||||||
axisNo_, error);
|
axisNo_, error);
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, userMessage);
|
pl_status = setStringParam(pC_->motorMessageText(), userMessage);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -767,12 +807,12 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resetError) {
|
if (resetError) {
|
||||||
pC_->msgPrintControl_.resetCount(keyError);
|
pC_->getMsgPrintControl().resetCount(keyError, pC_->asynUserSelf());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the parameter library
|
// Update the parameter library
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
pl_status = setIntegerParam(pC_->motorStatusProblem_, true);
|
pl_status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -781,7 +821,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*moving == false) {
|
if (*moving == false) {
|
||||||
pl_status = setIntegerParam(pC_->motorMoveToHome_, 0);
|
pl_status = setIntegerParam(pC_->motorMoveToHome(), 0);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMoveToHome_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMoveToHome_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -789,28 +829,28 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_status = setIntegerParam(pC_->motorStatusMoving_, *moving);
|
pl_status = setIntegerParam(pC_->motorStatusMoving(), *moving);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving_",
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusMoving_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
__LINE__);
|
__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_status = setIntegerParam(pC_->motorStatusDone_, !(*moving));
|
pl_status = setIntegerParam(pC_->motorStatusDone(), !(*moving));
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusDone_", axisNo_,
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusDone_", axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_status = setIntegerParam(pC_->motorStatusDirection_, direction);
|
pl_status = setIntegerParam(pC_->motorStatusDirection(), direction);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusDirection_",
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusDirection_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
__LINE__);
|
__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_status =
|
pl_status = pC_->setDoubleParam(axisNo_, pC_->motorHighLimitFromDriver(),
|
||||||
pC_->setDoubleParam(axisNo_, pC_->motorHighLimitFromDriver_, highLimit);
|
highLimit);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver_",
|
return pC_->paramLibAccessFailed(pl_status, "motorHighLimitFromDriver_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -818,22 +858,16 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pl_status =
|
pl_status =
|
||||||
pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver_, lowLimit);
|
pC_->setDoubleParam(axisNo_, pC_->motorLowLimitFromDriver(), lowLimit);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorLowLimit_", axisNo_,
|
return pC_->paramLibAccessFailed(pl_status, "motorLowLimit_", axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transform from motor to EPICS coordinates (see comment in
|
pl_status = setMotorPosition(currentPosition);
|
||||||
// turboPmacAxis::init())
|
|
||||||
currentPosition = currentPosition / motorRecResolution;
|
|
||||||
|
|
||||||
pl_status = setDoubleParam(pC_->motorPosition_, currentPosition);
|
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorPosition_", axisNo_,
|
return pl_status;
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return poll_status;
|
return poll_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -857,13 +891,13 @@ asynStatus turboPmacAxis::doMove(double position, int relative,
|
|||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorEnableRBV_, &enabled);
|
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorEnableRBV(), &enabled);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "enableMotorRBV_", axisNo_,
|
return pC_->paramLibAccessFailed(pl_status, "enableMotorRBV_", axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution_,
|
pl_status = pC_->getDoubleParam(axisNo_, pC_->motorRecResolution(),
|
||||||
&motorRecResolution);
|
&motorRecResolution);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_",
|
return pC_->paramLibAccessFailed(pl_status, "motorRecResolution_",
|
||||||
@ -873,7 +907,7 @@ asynStatus turboPmacAxis::doMove(double position, int relative,
|
|||||||
|
|
||||||
if (enabled == 0) {
|
if (enabled == 0) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nAxis is disabled.\n",
|
"Controller \"%s\", axis %d => %s, line %d\nAxis is disabled.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||||
return asynSuccess;
|
return asynSuccess;
|
||||||
@ -883,13 +917,13 @@ asynStatus turboPmacAxis::doMove(double position, int relative,
|
|||||||
motorCoordinatesPosition = position * motorRecResolution;
|
motorCoordinatesPosition = position * motorRecResolution;
|
||||||
motorVelocity = maxVelocity * motorRecResolution;
|
motorVelocity = maxVelocity * motorRecResolution;
|
||||||
|
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_FLOW,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_FLOW,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nStart of axis to "
|
"Controller \"%s\", axis %d => %s, line %d\nStart of axis to "
|
||||||
"position %lf.\n",
|
"position %lf.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, position);
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, position);
|
||||||
|
|
||||||
// Check if the speed is allowed to be changed
|
// Check if the speed is allowed to be changed
|
||||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorCanSetSpeed_,
|
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorCanSetSpeed(),
|
||||||
&motorCanSetSpeed);
|
&motorCanSetSpeed);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorCanSetSpeed_",
|
return pC_->paramLibAccessFailed(pl_status, "motorCanSetSpeed_",
|
||||||
@ -905,7 +939,7 @@ asynStatus turboPmacAxis::doMove(double position, int relative,
|
|||||||
motorVelocity);
|
motorVelocity);
|
||||||
writeOffset = strlen(command);
|
writeOffset = strlen(command);
|
||||||
|
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_FLOW,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_FLOW,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nSetting speed "
|
"Controller \"%s\", axis %d => %s, line %d\nSetting speed "
|
||||||
"to %lf.\n",
|
"to %lf.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
@ -929,12 +963,12 @@ asynStatus turboPmacAxis::doMove(double position, int relative,
|
|||||||
if (rw_status != asynSuccess) {
|
if (rw_status != asynSuccess) {
|
||||||
|
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nStarting movement to "
|
"Controller \"%s\", axis %d => %s, line %d\nStarting movement to "
|
||||||
"target position %lf failed.\n",
|
"target position %lf failed.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
motorCoordinatesPosition);
|
motorCoordinatesPosition);
|
||||||
pl_status = setIntegerParam(pC_->motorStatusProblem_, true);
|
pl_status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -974,12 +1008,45 @@ asynStatus turboPmacAxis::stop(double acceleration) {
|
|||||||
|
|
||||||
if (rw_status != asynSuccess) {
|
if (rw_status != asynSuccess) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nStopping the movement "
|
"Controller \"%s\", axis %d => %s, line %d\nStopping the movement "
|
||||||
"failed.\n",
|
"failed.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
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__,
|
||||||
|
__LINE__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rw_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
asynStatus turboPmacAxis::doReset() {
|
||||||
|
|
||||||
|
// Status of read-write-operations of ASCII commands to the controller
|
||||||
|
asynStatus rw_status = asynSuccess;
|
||||||
|
|
||||||
|
// Status of parameter library operations
|
||||||
|
asynStatus pl_status = asynSuccess;
|
||||||
|
|
||||||
|
char command[pC_->MAXBUF_], response[pC_->MAXBUF_];
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
// Reset the error for this axis manually
|
||||||
|
snprintf(command, sizeof(command), "P%2.2d01=0", axisNo_);
|
||||||
|
rw_status = pC_->writeRead(axisNo_, command, response, 0);
|
||||||
|
|
||||||
|
if (rw_status != asynSuccess) {
|
||||||
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
|
"Controller \"%s\", axis %d => %s, line %d\nResetting the "
|
||||||
|
"error failed\n",
|
||||||
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||||
|
|
||||||
|
pl_status = setIntegerParam(pC_->motorStatusProblem(), true);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
|
return pC_->paramLibAccessFailed(pl_status, "motorStatusProblem_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -1006,7 +1073,7 @@ asynStatus turboPmacAxis::doHome(double min_velocity, double max_velocity,
|
|||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
pl_status = pC_->getStringParam(axisNo_, pC_->encoderType_,
|
pl_status = pC_->getStringParam(axisNo_, pC_->encoderType(),
|
||||||
sizeof(response), response);
|
sizeof(response), response);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "encoderType_", axisNo_,
|
return pC_->paramLibAccessFailed(pl_status, "encoderType_", axisNo_,
|
||||||
@ -1022,14 +1089,14 @@ asynStatus turboPmacAxis::doHome(double min_velocity, double max_velocity,
|
|||||||
return rw_status;
|
return rw_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_status = setIntegerParam(pC_->motorMoveToHome_, 1);
|
pl_status = setIntegerParam(pC_->motorMoveToHome(), 1);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMoveToHome_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMoveToHome_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
__LINE__);
|
__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, "Homing");
|
pl_status = setStringParam(pC_->motorMessageText(), "Homing");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -1037,7 +1104,7 @@ asynStatus turboPmacAxis::doHome(double min_velocity, double max_velocity,
|
|||||||
}
|
}
|
||||||
return callParamCallbacks();
|
return callParamCallbacks();
|
||||||
} else {
|
} else {
|
||||||
pl_status = setStringParam(pC_->motorMessageText_,
|
pl_status = setStringParam(pC_->motorMessageText(),
|
||||||
"Can't home a motor with absolute encoder");
|
"Can't home a motor with absolute encoder");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
@ -1075,16 +1142,16 @@ asynStatus turboPmacAxis::readEncoderType() {
|
|||||||
|
|
||||||
int reponse_length = strlen(response);
|
int reponse_length = strlen(response);
|
||||||
if (reponse_length < 3) {
|
if (reponse_length < 3) {
|
||||||
return pC_->errMsgCouldNotParseResponse(command, response, axisNo_,
|
return pC_->couldNotParseResponse(command, response, axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are only interested in the last two digits and the last value in
|
// We are only interested in the last two digits and the last value in
|
||||||
// the string before the terminator is \r
|
// the string before the terminator is \r
|
||||||
nvals = sscanf(response + (reponse_length - 3), "%2X", &encoder_id);
|
nvals = sscanf(response + (reponse_length - 3), "%2X", &encoder_id);
|
||||||
if (nvals != 1) {
|
if (nvals != 1) {
|
||||||
return pC_->errMsgCouldNotParseResponse(command, response, axisNo_,
|
return pC_->couldNotParseResponse(command, response, axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(command, sizeof(command), "P46");
|
snprintf(command, sizeof(command), "P46");
|
||||||
@ -1096,9 +1163,9 @@ asynStatus turboPmacAxis::readEncoderType() {
|
|||||||
|
|
||||||
// If true, the encoder is incremental
|
// If true, the encoder is incremental
|
||||||
if (encoder_id <= number_of_axes) {
|
if (encoder_id <= number_of_axes) {
|
||||||
pl_status = setStringParam(pC_->encoderType_, IncrementalEncoder);
|
pl_status = setStringParam(pC_->encoderType(), IncrementalEncoder);
|
||||||
} else {
|
} else {
|
||||||
pl_status = setStringParam(pC_->encoderType_, AbsoluteEncoder);
|
pl_status = setStringParam(pC_->encoderType(), AbsoluteEncoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
@ -1135,7 +1202,7 @@ asynStatus turboPmacAxis::rereadEncoder() {
|
|||||||
if (rw_status != asynSuccess) {
|
if (rw_status != asynSuccess) {
|
||||||
return rw_status;
|
return rw_status;
|
||||||
}
|
}
|
||||||
pl_status = pC_->getStringParam(axisNo_, pC_->encoderType_,
|
pl_status = pC_->getStringParam(axisNo_, pC_->encoderType(),
|
||||||
sizeof(encoderType), encoderType);
|
sizeof(encoderType), encoderType);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "encoderType_", axisNo_,
|
return pC_->paramLibAccessFailed(pl_status, "encoderType_", axisNo_,
|
||||||
@ -1144,7 +1211,7 @@ asynStatus turboPmacAxis::rereadEncoder() {
|
|||||||
|
|
||||||
// Abort if the axis is incremental
|
// Abort if the axis is incremental
|
||||||
if (strcmp(encoderType, IncrementalEncoder) == 0) {
|
if (strcmp(encoderType, IncrementalEncoder) == 0) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_FLOW,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_FLOW,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nEncoder is "
|
"Controller \"%s\", axis %d => %s, line %d\nEncoder is "
|
||||||
"not reread because it is incremental.\n",
|
"not reread because it is incremental.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||||
@ -1154,19 +1221,19 @@ asynStatus turboPmacAxis::rereadEncoder() {
|
|||||||
// Check if the axis is disabled. If not, inform the user that this
|
// Check if the axis is disabled. If not, inform the user that this
|
||||||
// is necessary
|
// is necessary
|
||||||
int enabled = 0;
|
int enabled = 0;
|
||||||
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorEnableRBV_, &enabled);
|
pl_status = pC_->getIntegerParam(axisNo_, pC_->motorEnableRBV(), &enabled);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "enableMotorRBV_", axisNo_,
|
return pC_->paramLibAccessFailed(pl_status, "enableMotorRBV_", axisNo_,
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enabled == 1) {
|
if (enabled == 1) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_WARNING,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_WARNING,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nAxis must be "
|
"Controller \"%s\", axis %d => %s, line %d\nAxis must be "
|
||||||
"disabled before rereading the encoder.\n",
|
"disabled before rereading the encoder.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||||
pl_status = setStringParam(
|
pl_status = setStringParam(
|
||||||
pC_->motorMessageText_,
|
pC_->motorMessageText(),
|
||||||
"Axis must be disabled before rereading the encoder.");
|
"Axis must be disabled before rereading the encoder.");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
@ -1177,7 +1244,7 @@ asynStatus turboPmacAxis::rereadEncoder() {
|
|||||||
} else {
|
} else {
|
||||||
snprintf(command, sizeof(command), "M%2.2d=15", axisNo_);
|
snprintf(command, sizeof(command), "M%2.2d=15", axisNo_);
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_FLOW,
|
pC_->asynUserSelf(), ASYN_TRACE_FLOW,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nRereading absolute "
|
"Controller \"%s\", axis %d => %s, line %d\nRereading absolute "
|
||||||
"encoder via command %s.\n",
|
"encoder via command %s.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, command);
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__, command);
|
||||||
@ -1192,7 +1259,7 @@ asynStatus turboPmacAxis::rereadEncoder() {
|
|||||||
// turn off parameter as finished rereading
|
// turn off parameter as finished rereading
|
||||||
// this will only be immediately noticed in the read back variable
|
// this will only be immediately noticed in the read back variable
|
||||||
// though
|
// though
|
||||||
pl_status = pC_->setIntegerParam(pC_->rereadEncoderPosition_, 0);
|
pl_status = pC_->setIntegerParam(pC_->rereadEncoderPosition(), 0);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "rereadEncoderPosition_",
|
return pC_->paramLibAccessFailed(pl_status, "rereadEncoderPosition_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -1224,13 +1291,13 @@ asynStatus turboPmacAxis::enable(bool on) {
|
|||||||
// actually be disabled in this state!
|
// actually be disabled in this state!
|
||||||
if (axisStatus_ == 1 || axisStatus_ == 2 || axisStatus_ == 3 ||
|
if (axisStatus_ == 1 || axisStatus_ == 2 || axisStatus_ == 3 ||
|
||||||
axisStatus_ == 4 || axisStatus_ == 5) {
|
axisStatus_ == 4 || axisStatus_ == 5) {
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nAxis is not "
|
"Controller \"%s\", axis %d => %s, line %d\nAxis is not "
|
||||||
"idle and can therefore not be enabled / disabled.\n",
|
"idle and can therefore not be enabled / disabled.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
||||||
|
|
||||||
pl_status =
|
pl_status =
|
||||||
setStringParam(pC_->motorMessageText_,
|
setStringParam(pC_->motorMessageText(),
|
||||||
"Axis cannot be disabled while it is moving.");
|
"Axis cannot be disabled while it is moving.");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
@ -1245,7 +1312,7 @@ asynStatus turboPmacAxis::enable(bool on) {
|
|||||||
// was sent => Do nothing
|
// was sent => Do nothing
|
||||||
if ((axisStatus_ != -3) == on) {
|
if ((axisStatus_ != -3) == on) {
|
||||||
asynPrint(
|
asynPrint(
|
||||||
pC_->pasynUserSelf, ASYN_TRACE_WARNING,
|
pC_->asynUserSelf(), ASYN_TRACE_WARNING,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nAxis is already %s.\n",
|
"Controller \"%s\", axis %d => %s, line %d\nAxis is already %s.\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
on ? "enabled" : "disabled");
|
on ? "enabled" : "disabled");
|
||||||
@ -1262,14 +1329,14 @@ asynStatus turboPmacAxis::enable(bool on) {
|
|||||||
|
|
||||||
// Enable / disable the axis if it is not moving
|
// Enable / disable the axis if it is not moving
|
||||||
snprintf(command, sizeof(command), "M%2.2d14=%d", axisNo_, on);
|
snprintf(command, sizeof(command), "M%2.2d14=%d", axisNo_, on);
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_FLOW,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_FLOW,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\n%s axis\n",
|
"Controller \"%s\", axis %d => %s, line %d\n%s axis\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
on ? "Enable" : "Disable");
|
on ? "Enable" : "Disable");
|
||||||
if (on == 0) {
|
if (on == 0) {
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, "Disabling ...");
|
pl_status = setStringParam(pC_->motorMessageText(), "Disabling ...");
|
||||||
} else {
|
} else {
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, "Enabling ...");
|
pl_status = setStringParam(pC_->motorMessageText(), "Enabling ...");
|
||||||
}
|
}
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
@ -1295,8 +1362,8 @@ asynStatus turboPmacAxis::enable(bool on) {
|
|||||||
}
|
}
|
||||||
nvals = sscanf(response, "%d", &axisStatus_);
|
nvals = sscanf(response, "%d", &axisStatus_);
|
||||||
if (nvals != 1) {
|
if (nvals != 1) {
|
||||||
return pC_->errMsgCouldNotParseResponse(
|
return pC_->couldNotParseResponse(command, response, axisNo_,
|
||||||
command, response, axisNo_, __PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((axisStatus_ != -3) == on) {
|
if ((axisStatus_ != -3) == on) {
|
||||||
@ -1309,7 +1376,7 @@ asynStatus turboPmacAxis::enable(bool on) {
|
|||||||
|
|
||||||
// Failed to change axis status within timeout_enable_disable => Send a
|
// Failed to change axis status within timeout_enable_disable => Send a
|
||||||
// corresponding message
|
// corresponding message
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_FLOW,
|
asynPrint(pC_->asynUserSelf(), ASYN_TRACE_FLOW,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nFailed to %s axis "
|
"Controller \"%s\", axis %d => %s, line %d\nFailed to %s axis "
|
||||||
"within %d seconds\n",
|
"within %d seconds\n",
|
||||||
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
pC_->portName, axisNo_, __PRETTY_FUNCTION__, __LINE__,
|
||||||
@ -1318,7 +1385,7 @@ asynStatus turboPmacAxis::enable(bool on) {
|
|||||||
// Output message to user
|
// Output message to user
|
||||||
snprintf(command, sizeof(command), "Failed to %s within %d seconds",
|
snprintf(command, sizeof(command), "Failed to %s within %d seconds",
|
||||||
on ? "enable" : "disable", timeout_enable_disable);
|
on ? "enable" : "disable", timeout_enable_disable);
|
||||||
pl_status = setStringParam(pC_->motorMessageText_, "Enabling ...");
|
pl_status = setStringParam(pC_->motorMessageText(), "Enabling ...");
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
return pC_->paramLibAccessFailed(pl_status, "motorMessageText_",
|
||||||
axisNo_, __PRETTY_FUNCTION__,
|
axisNo_, __PRETTY_FUNCTION__,
|
||||||
@ -1354,9 +1421,9 @@ asynStatus turboPmacCreateAxis(const char *portName, int axis) {
|
|||||||
if (ptr == nullptr) {
|
if (ptr == nullptr) {
|
||||||
/*
|
/*
|
||||||
We can't use asynPrint here since this macro would require us
|
We can't use asynPrint here since this macro would require us
|
||||||
to get a lowLevelPortUser_ from a pointer to an asynPortDriver.
|
to get an asynUser from a pointer to an asynPortDriver.
|
||||||
However, the given pointer is a nullptr and therefore doesn't
|
However, the given pointer is a nullptr and therefore doesn't
|
||||||
have a lowLevelPortUser_! printf is an EPICS alternative which
|
have an asynUser! printf is an EPICS alternative which
|
||||||
works w/o that, but doesn't offer the comfort provided
|
works w/o that, but doesn't offer the comfort provided
|
||||||
by the asynTrace-facility
|
by the asynTrace-facility
|
||||||
*/
|
*/
|
||||||
@ -1421,4 +1488,4 @@ static void turboPmacAxisRegister(void) {
|
|||||||
}
|
}
|
||||||
epicsExportRegistrar(turboPmacAxisRegister);
|
epicsExportRegistrar(turboPmacAxisRegister);
|
||||||
|
|
||||||
} // extern "C"
|
} // extern "C"
|
||||||
|
@ -81,6 +81,14 @@ class turboPmacAxis : public sinqAxis {
|
|||||||
*/
|
*/
|
||||||
asynStatus init();
|
asynStatus init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Implementation of the `doReset` function from sinqAxis.
|
||||||
|
*
|
||||||
|
* @param on
|
||||||
|
* @return asynStatus
|
||||||
|
*/
|
||||||
|
asynStatus doReset();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Enable / disable the axis.
|
* @brief Enable / disable the axis.
|
||||||
*
|
*
|
||||||
@ -112,9 +120,6 @@ class turboPmacAxis : public sinqAxis {
|
|||||||
|
|
||||||
// The axis status is used when enabling / disabling the motor
|
// The axis status is used when enabling / disabling the motor
|
||||||
int axisStatus_;
|
int axisStatus_;
|
||||||
|
|
||||||
private:
|
|
||||||
friend class turboPmacController;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,27 +49,12 @@ turboPmacController::turboPmacController(const char *portName,
|
|||||||
asynStatus status = asynSuccess;
|
asynStatus status = asynSuccess;
|
||||||
|
|
||||||
// Initialization of all member variables
|
// Initialization of all member variables
|
||||||
lowLevelPortUser_ = nullptr;
|
|
||||||
comTimeout_ = comTimeout;
|
comTimeout_ = comTimeout;
|
||||||
|
|
||||||
// Maximum allowed number of subsequent timeouts before the user is
|
// Maximum allowed number of subsequent timeouts before the user is
|
||||||
// informed.
|
// informed.
|
||||||
maxSubsequentTimeouts_ = 10;
|
maxSubsequentTimeouts_ = 10;
|
||||||
|
|
||||||
// =========================================================================;
|
|
||||||
|
|
||||||
/*
|
|
||||||
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) {
|
|
||||||
errlogPrintf("Controller \"%s\" => %s, line %d\nFATAL ERROR "
|
|
||||||
"(cannot connect to MCU controller).\nTerminating IOC",
|
|
||||||
portName, __PRETTY_FUNCTION__, __LINE__);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
// Create additional parameter library entries
|
// Create additional parameter library entries
|
||||||
|
|
||||||
@ -103,15 +88,15 @@ turboPmacController::turboPmacController(const char *portName,
|
|||||||
const char *message_from_device =
|
const char *message_from_device =
|
||||||
"\006"; // Hex-code for ACK (acknowledge) -> Each message from the MCU
|
"\006"; // Hex-code for ACK (acknowledge) -> Each message from the MCU
|
||||||
// is terminated by this value
|
// is terminated by this value
|
||||||
status = pasynOctetSyncIO->setInputEos(
|
status = pasynOctetSyncIO->setInputEos(ipPortUser_, message_from_device,
|
||||||
lowLevelPortUser_, message_from_device, strlen(message_from_device));
|
strlen(message_from_device));
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\" => %s, line %d\nFATAL ERROR "
|
"Controller \"%s\" => %s, line %d\nFATAL ERROR "
|
||||||
"(setting input EOS failed with %s).\nTerminating IOC",
|
"(setting input EOS failed with %s).\nTerminating IOC",
|
||||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||||
stringifyAsynStatus(status));
|
stringifyAsynStatus(status));
|
||||||
pasynOctetSyncIO->disconnect(lowLevelPortUser_);
|
pasynOctetSyncIO->disconnect(ipPortUser_);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,7 +108,7 @@ turboPmacController::turboPmacController(const char *portName,
|
|||||||
"with %s).\nTerminating IOC",
|
"with %s).\nTerminating IOC",
|
||||||
portName, __PRETTY_FUNCTION__, __LINE__,
|
portName, __PRETTY_FUNCTION__, __LINE__,
|
||||||
stringifyAsynStatus(status));
|
stringifyAsynStatus(status));
|
||||||
pasynOctetSyncIO->disconnect(lowLevelPortUser_);
|
pasynOctetSyncIO->disconnect(ipPortUser_);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,8 +239,8 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
trying to reconnect. If the problem persists, ask them to call the support
|
trying to reconnect. If the problem persists, ask them to call the support
|
||||||
*/
|
*/
|
||||||
|
|
||||||
status = pasynOctetSyncIO->write(lowLevelPortUser_, fullCommand,
|
status = pasynOctetSyncIO->write(ipPortUser_, fullCommand, fullComandLength,
|
||||||
fullComandLength, comTimeout_, &nbytesOut);
|
comTimeout_, &nbytesOut);
|
||||||
|
|
||||||
msgPrintControlKey writeKey =
|
msgPrintControlKey writeKey =
|
||||||
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||||
@ -279,7 +264,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
||||||
timeoutCounter += 1;
|
timeoutCounter += 1;
|
||||||
|
|
||||||
status = pasynOctetSyncIO->write(lowLevelPortUser_, fullCommand,
|
status = pasynOctetSyncIO->write(ipPortUser_, fullCommand,
|
||||||
fullComandLength, comTimeout_,
|
fullComandLength, comTimeout_,
|
||||||
&nbytesOut);
|
&nbytesOut);
|
||||||
if (status != asynTimeout) {
|
if (status != asynTimeout) {
|
||||||
@ -300,12 +285,12 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
stringifyAsynStatus(status), msgPrintControl_.getSuffix());
|
stringifyAsynStatus(status), msgPrintControl_.getSuffix());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msgPrintControl_.resetCount(writeKey);
|
msgPrintControl_.resetCount(writeKey, pasynUserSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the response from the MCU buffer
|
// Read the response from the MCU buffer
|
||||||
status = pasynOctetSyncIO->read(lowLevelPortUser_, response, MAXBUF_,
|
status = pasynOctetSyncIO->read(ipPortUser_, response, MAXBUF_, comTimeout_,
|
||||||
comTimeout_, &nbytesIn, &eomReason);
|
&nbytesIn, &eomReason);
|
||||||
|
|
||||||
msgPrintControlKey readKey =
|
msgPrintControlKey readKey =
|
||||||
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||||
@ -330,9 +315,8 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
||||||
timeoutCounter += 1;
|
timeoutCounter += 1;
|
||||||
|
|
||||||
status =
|
status = pasynOctetSyncIO->read(ipPortUser_, response, MAXBUF_,
|
||||||
pasynOctetSyncIO->read(lowLevelPortUser_, response, MAXBUF_,
|
comTimeout_, &nbytesIn, &eomReason);
|
||||||
comTimeout_, &nbytesIn, &eomReason);
|
|
||||||
if (status != asynTimeout) {
|
if (status != asynTimeout) {
|
||||||
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
asynPrint(this->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line "
|
"Controller \"%s\", axis %d => %s, line "
|
||||||
@ -351,7 +335,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
stringifyAsynStatus(status), msgPrintControl_.getSuffix());
|
stringifyAsynStatus(status), msgPrintControl_.getSuffix());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msgPrintControl_.resetCount(readKey);
|
msgPrintControl_.resetCount(readKey, pasynUserSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeoutStatus == asynError) {
|
if (timeoutStatus == asynError) {
|
||||||
@ -377,7 +361,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
eomReason, msgPrintControl_.getSuffix());
|
eomReason, msgPrintControl_.getSuffix());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msgPrintControl_.resetCount(terminateKey);
|
msgPrintControl_.resetCount(terminateKey, pasynUserSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -412,7 +396,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
modResponse, command);
|
modResponse, command);
|
||||||
status = asynError;
|
status = asynError;
|
||||||
} else {
|
} else {
|
||||||
msgPrintControl_.resetCount(numResponsesKey);
|
msgPrintControl_.resetCount(numResponsesKey, pasynUserSelf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create custom error messages for different failure modes, if no error
|
// Create custom error messages for different failure modes, if no error
|
||||||
@ -511,12 +495,12 @@ asynStatus turboPmacController::readInt32(asynUser *pasynUser,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
asynStatus turboPmacController::errMsgCouldNotParseResponse(
|
asynStatus turboPmacController::couldNotParseResponse(
|
||||||
const char *command, const char *response, int axisNo,
|
const char *command, const char *response, int axisNo,
|
||||||
const char *functionName, int lineNumber) {
|
const char *functionName, int lineNumber) {
|
||||||
char modifiedResponse[MAXBUF_] = {0};
|
char modifiedResponse[MAXBUF_] = {0};
|
||||||
adjustResponseForPrint(modifiedResponse, response, MAXBUF_);
|
adjustResponseForPrint(modifiedResponse, response, MAXBUF_);
|
||||||
return sinqController::errMsgCouldNotParseResponse(
|
return sinqController::couldNotParseResponse(
|
||||||
command, modifiedResponse, axisNo, functionName, lineNumber);
|
command, modifiedResponse, axisNo, functionName, lineNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,9 +73,6 @@ class turboPmacController : public sinqController {
|
|||||||
*/
|
*/
|
||||||
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
|
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
|
||||||
|
|
||||||
protected:
|
|
||||||
asynUser *lowLevelPortUser_;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send a command to the hardware and receive a response
|
* @brief Send a command to the hardware and receive a response
|
||||||
*
|
*
|
||||||
@ -96,13 +93,13 @@ class turboPmacController : public sinqController {
|
|||||||
int numExpectedResponses);
|
int numExpectedResponses);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Specialized version of sinqController::errMsgCouldNotParseResponse
|
* @brief Specialized version of sinqController::couldNotParseResponse
|
||||||
* for turboPmac
|
* for turboPmac
|
||||||
*
|
*
|
||||||
* This is an overloaded version of
|
* This is an overloaded version of
|
||||||
* sinqController::errMsgCouldNotParseResponse which calls
|
* sinqController::couldNotParseResponse which calls
|
||||||
* adjustResponseForLogging on response before handing it over to
|
* adjustResponseForLogging on response before handing it over to
|
||||||
* sinqController::errMsgCouldNotParseResponse.
|
* sinqController::couldNotParseResponse.
|
||||||
*
|
*
|
||||||
* @param command Command which led to the unparseable message
|
* @param command Command which led to the unparseable message
|
||||||
* @param response Response which wasn't parseable
|
* @param response Response which wasn't parseable
|
||||||
@ -113,17 +110,21 @@ class turboPmacController : public sinqController {
|
|||||||
called. It is recommended to use a macro, e.g. __LINE__.
|
called. It is recommended to use a macro, e.g. __LINE__.
|
||||||
* @return asynStatus Returns asynError.
|
* @return asynStatus Returns asynError.
|
||||||
*/
|
*/
|
||||||
asynStatus errMsgCouldNotParseResponse(const char *command,
|
asynStatus couldNotParseResponse(const char *command,
|
||||||
const char *response, int axisNo_,
|
const char *response, int axisNo_,
|
||||||
const char *functionName,
|
const char *functionName,
|
||||||
int lineNumber);
|
int lineNumber);
|
||||||
|
|
||||||
protected:
|
// Accessors for additional PVs
|
||||||
|
int rereadEncoderPosition() { return rereadEncoderPosition_; }
|
||||||
|
int readConfig() { return readConfig_; }
|
||||||
|
|
||||||
// Set the maximum buffer size. This is an empirical value which must be
|
// Set the maximum buffer size. This is an empirical value which must be
|
||||||
// large enough to avoid overflows for all commands to the device /
|
// large enough to avoid overflows for all commands to the device /
|
||||||
// responses from it.
|
// responses from it.
|
||||||
static const uint32_t MAXBUF_ = 200;
|
static const uint32_t MAXBUF_ = 200;
|
||||||
|
|
||||||
|
protected:
|
||||||
/*
|
/*
|
||||||
Timeout for the communication process in seconds
|
Timeout for the communication process in seconds
|
||||||
*/
|
*/
|
||||||
@ -136,8 +137,6 @@ class turboPmacController : public sinqController {
|
|||||||
int rereadEncoderPosition_;
|
int rereadEncoderPosition_;
|
||||||
int readConfig_;
|
int readConfig_;
|
||||||
#define LAST_turboPmac_PARAM readConfig_
|
#define LAST_turboPmac_PARAM readConfig_
|
||||||
|
|
||||||
friend class turboPmacAxis;
|
|
||||||
};
|
};
|
||||||
#define NUM_turboPmac_DRIVER_PARAMS \
|
#define NUM_turboPmac_DRIVER_PARAMS \
|
||||||
(&LAST_turboPmac_PARAM - &FIRST_turboPmac_PARAM + 1)
|
(&LAST_turboPmac_PARAM - &FIRST_turboPmac_PARAM + 1)
|
||||||
|
Reference in New Issue
Block a user