Added sleep after write commands
See comment in writeRead for explanation.
This commit is contained in:
@@ -207,7 +207,6 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
// Definition of local variables.
|
// Definition of local variables.
|
||||||
asynStatus status = asynSuccess;
|
asynStatus status = asynSuccess;
|
||||||
asynStatus timeoutStatus = asynSuccess;
|
asynStatus timeoutStatus = asynSuccess;
|
||||||
// char fullCommand[MAXBUF_] = {0};
|
|
||||||
char drvMessageText[MAXBUF_] = {0};
|
char drvMessageText[MAXBUF_] = {0};
|
||||||
char modResponse[MAXBUF_] = {0};
|
char modResponse[MAXBUF_] = {0};
|
||||||
int motorStatusProblem = 0;
|
int motorStatusProblem = 0;
|
||||||
@@ -255,6 +254,22 @@ asynStatus turboPmacController::writeRead(int axisNo, const char *command,
|
|||||||
pasynOctetSyncIOipPort(), command, commandLength, response, MAXBUF_,
|
pasynOctetSyncIOipPort(), command, commandLength, response, MAXBUF_,
|
||||||
pTurboPmacC_->comTimeout, &nbytesOut, &nbytesIn, &eomReason);
|
pTurboPmacC_->comTimeout, &nbytesOut, &nbytesIn, &eomReason);
|
||||||
|
|
||||||
|
/*
|
||||||
|
If sth. is written to the controller, it needs some time to process the
|
||||||
|
command. However, the controller returns the acknowledgment via
|
||||||
|
pasynOctetSyncIO->writeRead immediately, signalling to the driver that it is
|
||||||
|
ready to receive the next command. In practice, this can result in commands
|
||||||
|
getting discarded on the driver side or in bringing the driver in undefined
|
||||||
|
states (e.g. stuck in status 1).
|
||||||
|
|
||||||
|
To prevent this, we wait for 20 ms after a write command to give the
|
||||||
|
controller enough time to process everything. A write command can be
|
||||||
|
identified by looking for the equal sign.
|
||||||
|
*/
|
||||||
|
if (strchr(command, '=')) {
|
||||||
|
usleep(20000);
|
||||||
|
}
|
||||||
|
|
||||||
msgPrintControlKey comKey =
|
msgPrintControlKey comKey =
|
||||||
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
msgPrintControlKey(portName, axisNo, __PRETTY_FUNCTION__, __LINE__);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user