Updated turboPmac to 0.15.2
This commit is contained in:
@ -156,6 +156,7 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
|
|||||||
double highLimit = 0.0;
|
double highLimit = 0.0;
|
||||||
double lowLimit = 0.0;
|
double lowLimit = 0.0;
|
||||||
double limitsOffset = 0.0;
|
double limitsOffset = 0.0;
|
||||||
|
int enabled = 0;
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
@ -173,15 +174,15 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
|
|||||||
- Upper limit
|
- Upper limit
|
||||||
- Lower limit
|
- Lower limit
|
||||||
*/
|
*/
|
||||||
snprintf(command, sizeof(command), "P154 Q110 P159 Q113 Q114");
|
snprintf(command, sizeof(command), "P154 Q110 P158 P159 Q113 Q114");
|
||||||
rw_status = pC_->writeRead(axisNo(), command, response, 5);
|
rw_status = pC_->writeRead(axisNo(), command, response, 6);
|
||||||
if (rw_status != asynSuccess) {
|
if (rw_status != asynSuccess) {
|
||||||
return rw_status;
|
return rw_status;
|
||||||
};
|
};
|
||||||
|
|
||||||
nvals = sscanf(response, "%d %lf %d %lf %lf", (int *)moving,
|
nvals = sscanf(response, "%d %lf %d %d %lf %lf", (int *)moving,
|
||||||
¤tPosition, &error, &highLimit, &lowLimit);
|
¤tPosition, &enabled, &error, &highLimit, &lowLimit);
|
||||||
if (nvals != 5) {
|
if (nvals != 6) {
|
||||||
return pC_->couldNotParseResponse(command, response, axisNo(),
|
return pC_->couldNotParseResponse(command, response, axisNo(),
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
@ -208,8 +209,8 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
|
|||||||
highLimit = highLimit - limitsOffset;
|
highLimit = highLimit - limitsOffset;
|
||||||
lowLimit = lowLimit + limitsOffset;
|
lowLimit = lowLimit + limitsOffset;
|
||||||
|
|
||||||
// Update the enablement PV. If the error is 1, the axis is not enabled
|
// Update the enablement PV.
|
||||||
pl_status = setIntegerParam(pC_->motorEnableRBV(), (error != 1));
|
pl_status = setIntegerParam(pC_->motorEnableRBV(), enabled);
|
||||||
if (pl_status != asynSuccess) {
|
if (pl_status != asynSuccess) {
|
||||||
return pC_->paramLibAccessFailed(pl_status, "motorEnableRBV_", axisNo(),
|
return pC_->paramLibAccessFailed(pl_status, "motorEnableRBV_", axisNo(),
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
@ -309,8 +310,20 @@ asynStatus beamShiftAxis::handleError(int error, char *userMessage,
|
|||||||
// No error
|
// No error
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// Axis is not switched on. This is a normal state which is not
|
// Axis is not switched on.
|
||||||
// problematic, it just requires that the user enables the axis.
|
|
||||||
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
|
pC_->pasynUser())) {
|
||||||
|
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||||
|
"Controller \"%s\", axis %d => %s, line %d\nAxis must "
|
||||||
|
"be enabled first.%s\n",
|
||||||
|
pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__,
|
||||||
|
pC_->getMsgPrintControl().getSuffix());
|
||||||
|
}
|
||||||
|
resetError = false;
|
||||||
|
|
||||||
|
snprintf(userMessage, sizeUserMessage, "Axis must be enabled first.");
|
||||||
|
status = asynError;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// Axis received a new command while it was moving
|
// Axis received a new command while it was moving
|
||||||
@ -327,7 +340,7 @@ asynStatus beamShiftAxis::handleError(int error, char *userMessage,
|
|||||||
resetError = false;
|
resetError = false;
|
||||||
|
|
||||||
snprintf(userMessage, sizeUserMessage,
|
snprintf(userMessage, sizeUserMessage,
|
||||||
"Axis received move command while it is still moving. Please "
|
"Axis received move command, but is still moving. Please "
|
||||||
"call the support.");
|
"call the support.");
|
||||||
status = asynError;
|
status = asynError;
|
||||||
break;
|
break;
|
||||||
@ -379,6 +392,21 @@ asynStatus beamShiftAxis::handleError(int error, char *userMessage,
|
|||||||
"Target position exceeds limits. Please call the support.");
|
"Target position exceeds limits. Please call the support.");
|
||||||
status = asynError;
|
status = asynError;
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
// Axis received a new command while it was moving
|
||||||
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
|
pC_->pasynUser())) {
|
||||||
|
asynPrint(pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||||
|
"Controller \"%s\", axis %d => %s, line %d\nAxis is not "
|
||||||
|
"ready, delete error first.%s\n",
|
||||||
|
pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__,
|
||||||
|
pC_->getMsgPrintControl().getSuffix());
|
||||||
|
}
|
||||||
|
resetError = false;
|
||||||
|
|
||||||
|
snprintf(userMessage, sizeUserMessage, "Delete error first.");
|
||||||
|
status = asynError;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
|
||||||
@ -531,6 +559,7 @@ asynStatus beamShiftAxis::enable(bool on) {
|
|||||||
asynStatus status = asynSuccess;
|
asynStatus status = asynSuccess;
|
||||||
int nvals = 0;
|
int nvals = 0;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
int enabled = 0;
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
||||||
@ -538,16 +567,16 @@ asynStatus beamShiftAxis::enable(bool on) {
|
|||||||
// message
|
// message
|
||||||
if (on) {
|
if (on) {
|
||||||
// Check if the axis is currently switched off
|
// Check if the axis is currently switched off
|
||||||
snprintf(command, sizeof(command), "P159");
|
snprintf(command, sizeof(command), "P158 P159");
|
||||||
status = pC_->writeRead(axisNo(), command, response, 1);
|
status = pC_->writeRead(axisNo(), command, response, 2);
|
||||||
|
|
||||||
nvals = sscanf(response, "%d", &error);
|
nvals = sscanf(response, "%d %d", &enabled, &error);
|
||||||
if (nvals != 1) {
|
if (nvals != 2) {
|
||||||
return pC_->couldNotParseResponse(command, response, axisNo(),
|
return pC_->couldNotParseResponse(command, response, axisNo(),
|
||||||
__PRETTY_FUNCTION__, __LINE__);
|
__PRETTY_FUNCTION__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == 1) {
|
if (enabled == 0) {
|
||||||
snprintf(command, sizeof(command), "P152=1");
|
snprintf(command, sizeof(command), "P152=1");
|
||||||
return pC_->writeRead(axisNo(), command, response, 0);
|
return pC_->writeRead(axisNo(), command, response, 0);
|
||||||
} else {
|
} else {
|
||||||
|
Submodule turboPmac updated: 55b523ddaa...a11d10cb6c
Reference in New Issue
Block a user