Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
4a1d6524a7 | |||
370aef212e | |||
3b39d724db |
@ -496,7 +496,7 @@ static int pmacReadReady(pmacPvt *pPmacPvt, asynUser *pasynUser) {
|
|||||||
pPmacPvt->portName, thisRead);
|
pPmacPvt->portName, thisRead);
|
||||||
} else {
|
} else {
|
||||||
asynPrint(pasynUser, ASYN_TRACE_ERROR,
|
asynPrint(pasynUser, ASYN_TRACE_ERROR,
|
||||||
"%s read pmacReadReady failed status=%d,retval=%d\n",
|
"%s read pmacReadReady failed status=%d, retval=%d\n",
|
||||||
pPmacPvt->portName, status, retval);
|
pPmacPvt->portName, status, retval);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -161,7 +161,15 @@ asynStatus turboPmacAxis::init() {
|
|||||||
axisNo_, axisNo_, axisNo_, axisNo_, axisNo_);
|
axisNo_, axisNo_, axisNo_, axisNo_, axisNo_);
|
||||||
status = pC_->writeRead(axisNo_, command, response, 6);
|
status = pC_->writeRead(axisNo_, command, response, 6);
|
||||||
if (status != asynSuccess) {
|
if (status != asynSuccess) {
|
||||||
return status;
|
asynPrint(
|
||||||
|
pC_->pasynUser(), ASYN_TRACE_ERROR,
|
||||||
|
"Controller \"%s\", axis %d => %s, line %d\nCould not communicate "
|
||||||
|
"with controller during IOC initialization. Check if you used "
|
||||||
|
"\"pmacAsynIPPortConfigure\" instead of the standard "
|
||||||
|
"\"drvAsynIPPortConfigure\" function in the .cmd file in order to "
|
||||||
|
"create the port driver.\nTerminating IOC.\n",
|
||||||
|
pC_->portName, axisNo(), __PRETTY_FUNCTION__, __LINE__);
|
||||||
|
exit(-1);
|
||||||
}
|
}
|
||||||
nvals = sscanf(response, "%d %lf %lf %lf %lf %d", &axStatus, &motorPos,
|
nvals = sscanf(response, "%d %lf %lf %lf %lf %d", &axStatus, &motorPos,
|
||||||
&motorVmax, &motorVelocity, &motorAccel, &acoDelay);
|
&motorVmax, &motorVelocity, &motorAccel, &acoDelay);
|
||||||
@ -408,12 +416,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
|
|||||||
case -6:
|
case -6:
|
||||||
// Axis is stopping
|
// Axis is stopping
|
||||||
|
|
||||||
// If the axis was already idle during the last poll, it is not moving
|
*moving = true;
|
||||||
if (previousStatusDone == 0) {
|
|
||||||
*moving = true;
|
|
||||||
} else {
|
|
||||||
*moving = false;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case -5:
|
case -5:
|
||||||
// Axis is deactivated
|
// Axis is deactivated
|
||||||
|
@ -226,7 +226,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
asynPrint(
|
asynPrint(
|
||||||
this->pasynUser(), ASYN_TRACE_ERROR,
|
this->pasynUser(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nTimeout while "
|
"Controller \"%s\", axis %d => %s, line %d\nTimeout while "
|
||||||
"writing to the MCU.%s\n",
|
"writing to the controller. Retrying ...%s\n",
|
||||||
portName, axisNo, __PRETTY_FUNCTION__, __LINE__,
|
portName, axisNo, __PRETTY_FUNCTION__, __LINE__,
|
||||||
msgPrintControl_.getSuffix());
|
msgPrintControl_.getSuffix());
|
||||||
}
|
}
|
||||||
@ -239,6 +239,10 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
checkMaxSubsequentTimeouts(timeoutCounter, axis);
|
||||||
timeoutCounter += 1;
|
timeoutCounter += 1;
|
||||||
|
|
||||||
|
if (maxSubsequentTimeoutsExceeded_) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
status = pasynOctetSyncIO->writeRead(
|
status = pasynOctetSyncIO->writeRead(
|
||||||
pasynOctetSyncIOipPort(), command, commandLength, response,
|
pasynOctetSyncIOipPort(), command, commandLength, response,
|
||||||
MAXBUF_, comTimeout_, &nbytesOut, &nbytesIn, &eomReason);
|
MAXBUF_, comTimeout_, &nbytesOut, &nbytesIn, &eomReason);
|
||||||
@ -273,17 +277,37 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
if (eomReason != 2) {
|
if (eomReason != 2) {
|
||||||
status = asynError;
|
status = asynError;
|
||||||
|
|
||||||
|
char reasonStringified[30] = {0};
|
||||||
|
switch (eomReason) {
|
||||||
|
case 0:
|
||||||
|
snprintf(reasonStringified, sizeof(reasonStringified), "Timeout");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
snprintf(reasonStringified, sizeof(reasonStringified),
|
||||||
|
"Request count reached");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
snprintf(reasonStringified, sizeof(reasonStringified),
|
||||||
|
"End of string detected");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
snprintf(reasonStringified, sizeof(reasonStringified),
|
||||||
|
"End indicator detected");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(drvMessageText, sizeof(drvMessageText),
|
snprintf(drvMessageText, sizeof(drvMessageText),
|
||||||
"Terminated message due to reason %d (should be 2). Please "
|
"Terminated message due to reason %s (should be \"End of "
|
||||||
"call the support.",
|
"string detected\"). Please call the support.",
|
||||||
eomReason);
|
reasonStringified);
|
||||||
|
|
||||||
if (msgPrintControl_.shouldBePrinted(terminateKey, true, pasynUser())) {
|
if (msgPrintControl_.shouldBePrinted(terminateKey, true, pasynUser())) {
|
||||||
|
|
||||||
asynPrint(this->pasynUser(), ASYN_TRACE_ERROR,
|
asynPrint(this->pasynUser(), ASYN_TRACE_ERROR,
|
||||||
"Controller \"%s\", axis %d => %s, line %d\nMessage "
|
"Controller \"%s\", axis %d => %s, line %d\nMessage "
|
||||||
"terminated due to reason %i.%s\n",
|
"terminated due to reason %s.%s\n",
|
||||||
portName, axisNo, __PRETTY_FUNCTION__, __LINE__,
|
portName, axisNo, __PRETTY_FUNCTION__, __LINE__,
|
||||||
eomReason, msgPrintControl_.getSuffix());
|
reasonStringified, msgPrintControl_.getSuffix());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msgPrintControl_.resetCount(terminateKey, pasynUser());
|
msgPrintControl_.resetCount(terminateKey, pasynUser());
|
||||||
|
Reference in New Issue
Block a user