Compare commits

...

3 Commits

3 changed files with 41 additions and 14 deletions

View File

@ -496,7 +496,7 @@ static int pmacReadReady(pmacPvt *pPmacPvt, asynUser *pasynUser) {
pPmacPvt->portName, thisRead);
} else {
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);
}
return retval;

View File

@ -161,7 +161,15 @@ asynStatus turboPmacAxis::init() {
axisNo_, axisNo_, axisNo_, axisNo_, axisNo_);
status = pC_->writeRead(axisNo_, command, response, 6);
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,
&motorVmax, &motorVelocity, &motorAccel, &acoDelay);
@ -408,12 +416,7 @@ asynStatus turboPmacAxis::doPoll(bool *moving) {
case -6:
// Axis is stopping
// If the axis was already idle during the last poll, it is not moving
if (previousStatusDone == 0) {
*moving = true;
} else {
*moving = false;
}
*moving = true;
break;
case -5:
// Axis is deactivated

View File

@ -226,7 +226,7 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
asynPrint(
this->pasynUser(), ASYN_TRACE_ERROR,
"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__,
msgPrintControl_.getSuffix());
}
@ -239,6 +239,10 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
checkMaxSubsequentTimeouts(timeoutCounter, axis);
timeoutCounter += 1;
if (maxSubsequentTimeoutsExceeded_) {
break;
}
status = pasynOctetSyncIO->writeRead(
pasynOctetSyncIOipPort(), command, commandLength, response,
MAXBUF_, comTimeout_, &nbytesOut, &nbytesIn, &eomReason);
@ -273,17 +277,37 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
if (eomReason != 2) {
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),
"Terminated message due to reason %d (should be 2). Please "
"call the support.",
eomReason);
"Terminated message due to reason %s (should be \"End of "
"string detected\"). Please call the support.",
reasonStringified);
if (msgPrintControl_.shouldBePrinted(terminateKey, true, pasynUser())) {
asynPrint(this->pasynUser(), ASYN_TRACE_ERROR,
"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__,
eomReason, msgPrintControl_.getSuffix());
reasonStringified, msgPrintControl_.getSuffix());
}
} else {
msgPrintControl_.resetCount(terminateKey, pasynUser());