Updated turboPmac to 0.15.2

This commit is contained in:
2025-05-16 16:05:09 +02:00
parent 6c675f4672
commit 5713911ac4
2 changed files with 45 additions and 16 deletions

View File

@ -156,6 +156,7 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
double highLimit = 0.0;
double lowLimit = 0.0;
double limitsOffset = 0.0;
int enabled = 0;
// =========================================================================
@ -173,15 +174,15 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
- Upper limit
- Lower limit
*/
snprintf(command, sizeof(command), "P154 Q110 P159 Q113 Q114");
rw_status = pC_->writeRead(axisNo(), command, response, 5);
snprintf(command, sizeof(command), "P154 Q110 P158 P159 Q113 Q114");
rw_status = pC_->writeRead(axisNo(), command, response, 6);
if (rw_status != asynSuccess) {
return rw_status;
};
nvals = sscanf(response, "%d %lf %d %lf %lf", (int *)moving,
&currentPosition, &error, &highLimit, &lowLimit);
if (nvals != 5) {
nvals = sscanf(response, "%d %lf %d %d %lf %lf", (int *)moving,
&currentPosition, &enabled, &error, &highLimit, &lowLimit);
if (nvals != 6) {
return pC_->couldNotParseResponse(command, response, axisNo(),
__PRETTY_FUNCTION__, __LINE__);
}
@ -208,8 +209,8 @@ asynStatus beamShiftAxis::doPoll(bool *moving) {
highLimit = highLimit - limitsOffset;
lowLimit = lowLimit + limitsOffset;
// Update the enablement PV. If the error is 1, the axis is not enabled
pl_status = setIntegerParam(pC_->motorEnableRBV(), (error != 1));
// Update the enablement PV.
pl_status = setIntegerParam(pC_->motorEnableRBV(), enabled);
if (pl_status != asynSuccess) {
return pC_->paramLibAccessFailed(pl_status, "motorEnableRBV_", axisNo(),
__PRETTY_FUNCTION__, __LINE__);
@ -309,8 +310,20 @@ asynStatus beamShiftAxis::handleError(int error, char *userMessage,
// No error
break;
case 1:
// Axis is not switched on. This is a normal state which is not
// problematic, it just requires that the user enables the axis.
// Axis is not switched on.
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;
case 2:
// Axis received a new command while it was moving
@ -327,7 +340,7 @@ asynStatus beamShiftAxis::handleError(int error, char *userMessage,
resetError = false;
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.");
status = asynError;
break;
@ -379,6 +392,21 @@ asynStatus beamShiftAxis::handleError(int error, char *userMessage,
"Target position exceeds limits. Please call the support.");
status = asynError;
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:
if (pC_->getMsgPrintControl().shouldBePrinted(keyError, true,
@ -531,6 +559,7 @@ asynStatus beamShiftAxis::enable(bool on) {
asynStatus status = asynSuccess;
int nvals = 0;
int error = 0;
int enabled = 0;
// =========================================================================
@ -538,16 +567,16 @@ asynStatus beamShiftAxis::enable(bool on) {
// message
if (on) {
// Check if the axis is currently switched off
snprintf(command, sizeof(command), "P159");
status = pC_->writeRead(axisNo(), command, response, 1);
snprintf(command, sizeof(command), "P158 P159");
status = pC_->writeRead(axisNo(), command, response, 2);
nvals = sscanf(response, "%d", &error);
if (nvals != 1) {
nvals = sscanf(response, "%d %d", &enabled, &error);
if (nvals != 2) {
return pC_->couldNotParseResponse(command, response, axisNo(),
__PRETTY_FUNCTION__, __LINE__);
}
if (error == 1) {
if (enabled == 0) {
snprintf(command, sizeof(command), "P152=1");
return pC_->writeRead(axisNo(), command, response, 0);
} else {