forked from epics_driver_modules/motorBase
split init string into individual commands; read status before position
This commit is contained in:
@@ -471,12 +471,18 @@ asynStatus omsBaseController::Init(const char* initString, int multiple){
|
||||
/* send InitString */
|
||||
if ((initString != NULL) && (strlen(initString) > 0)) {
|
||||
if (multiple){
|
||||
/* send each commmand in initstring individually */
|
||||
char* tmpout = new char[strlen(initString)+2];
|
||||
char* inittmp = epicsStrDup(initString);
|
||||
for (tokSave = NULL, p = epicsStrtok_r(inittmp, ";", &tokSave);
|
||||
p != NULL; p = epicsStrtok_r(NULL, ";", &tokSave)) {
|
||||
sendOnlyLock(p);
|
||||
strcpy(tmpout, p);
|
||||
strcat(tmpout, ";");
|
||||
sendOnlyLock(tmpout);
|
||||
epicsThreadSleep(0.1);
|
||||
}
|
||||
free(inittmp);
|
||||
delete[] tmpout;
|
||||
}
|
||||
else {
|
||||
sendOnlyLock(initString);
|
||||
@@ -626,28 +632,31 @@ void omsBaseController::omsPoller()
|
||||
|
||||
epicsTimeGetCurrent(&loopStart);
|
||||
|
||||
/* read all axis status values and reset done-field
|
||||
* MDNN,MDNN,PNLN,PNNN,PNLN,PNNN,PNNN,PNNN */
|
||||
retry_count = 0;
|
||||
while ((getAxesPositions(axisPosArr) != asynSuccess) && (retry_count < 5)){
|
||||
while ((getAxesStatus(statusBuffer, sizeof(statusBuffer), &moveDone) != asynSuccess) && (retry_count < 5)){
|
||||
Debug(1, "%s:%s:%s: error reading axes status\n", driverName, functionName, this->portName);
|
||||
epicsThreadSleep(0.1);
|
||||
++retry_count;
|
||||
}
|
||||
|
||||
if (retry_count > 4){
|
||||
errlogPrintf("%s:%s:%s: error reading axis position after %d attempts\n",
|
||||
errlogPrintf("%s:%s:%s: error reading axis status (%d attempts)\n",
|
||||
driverName, functionName, this->portName, retry_count);
|
||||
++loopBreakCount;
|
||||
resetConnection();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (getAxesPositions(axisPosArr) != asynSuccess){
|
||||
Debug(1, "%s:%s:%s: error reading axis positions\n", driverName, functionName, this->portName);
|
||||
++loopBreakCount;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (useEncoder && (getEncoderPositions(encPosArr) != asynSuccess)){
|
||||
Debug(1, "%s:%s:%s: error executing get Encoder Positions\n", driverName, functionName, this->portName);
|
||||
++loopBreakCount;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* read all axis status values and reset done-field
|
||||
* MDNN,MDNN,PNLN,PNNN,PNLN,PNNN,PNNN,PNNN */
|
||||
if (getAxesStatus(statusBuffer, sizeof(statusBuffer), &moveDone) != asynSuccess){
|
||||
Debug(1, "%s:%s:%s: error reading axes status\n", driverName, functionName, this->portName);
|
||||
Debug(1, "%s:%s:%s: error reading encoder positions\n", driverName, functionName, this->portName);
|
||||
++loopBreakCount;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ protected:
|
||||
virtual asynStatus getClosedLoopStatus(int clstatus[OMS_MAX_AXES]);
|
||||
virtual epicsEventWaitStatus waitInterruptible(double timeout);
|
||||
virtual bool watchdogOK();
|
||||
virtual bool resetConnection(){return false;};
|
||||
char* getPortName(){return portName;};
|
||||
bool firmwareMin(int, int, int);
|
||||
static omsBaseController* findController(const char*);
|
||||
|
||||
Reference in New Issue
Block a user