Some cleanup in EL734Driver.cpp
This commit is contained in:
@ -41,7 +41,6 @@ EL734Controller::EL734Controller(const char *portName, const char *EL734PortName
|
|||||||
{
|
{
|
||||||
int axis;
|
int axis;
|
||||||
asynStatus status;
|
asynStatus status;
|
||||||
EL734Axis *pAxis;
|
|
||||||
static const char *functionName = "EL734Controller::EL734Controller";
|
static const char *functionName = "EL734Controller::EL734Controller";
|
||||||
|
|
||||||
|
|
||||||
@ -58,7 +57,7 @@ EL734Controller::EL734Controller(const char *portName, const char *EL734PortName
|
|||||||
switchRemote();
|
switchRemote();
|
||||||
|
|
||||||
for (axis=0; axis<numAxes; axis++) {
|
for (axis=0; axis<numAxes; axis++) {
|
||||||
pAxis = new EL734Axis(this, axis+1);
|
new EL734Axis(this, axis+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
startPoller(1000./1000., IDLEPOLL, 2);
|
startPoller(1000./1000., IDLEPOLL, 2);
|
||||||
@ -114,21 +113,20 @@ EL734Axis* EL734Controller::getAxis(int axisNo)
|
|||||||
void EL734Controller::switchRemote()
|
void EL734Controller::switchRemote()
|
||||||
{
|
{
|
||||||
char command[COMLEN], reply[COMLEN];
|
char command[COMLEN], reply[COMLEN];
|
||||||
int status;
|
|
||||||
size_t in, out;
|
size_t in, out;
|
||||||
int reason;
|
int reason;
|
||||||
|
|
||||||
strcpy(command,"RMT 1");
|
strcpy(command,"RMT 1");
|
||||||
status = pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
||||||
reply,COMLEN, 1.,&out,&in,&reason);
|
reply,COMLEN, 1.,&out,&in,&reason);
|
||||||
strcpy(command,"ECHO 0");
|
strcpy(command,"ECHO 0");
|
||||||
status = pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
||||||
reply,COMLEN, 1.,&out,&in,&reason);
|
reply,COMLEN, 1.,&out,&in,&reason);
|
||||||
strcpy(command,"RMT 1");
|
strcpy(command,"RMT 1");
|
||||||
status = pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
||||||
reply,COMLEN, 1.,&out,&in,&reason);
|
reply,COMLEN, 1.,&out,&in,&reason);
|
||||||
strcpy(command,"ECHO 0");
|
strcpy(command,"ECHO 0");
|
||||||
status = pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
pasynOctetSyncIO->writeRead(pasynUserController_, command, strlen(command),
|
||||||
reply,COMLEN, 1.,&out,&in,&reason);
|
reply,COMLEN, 1.,&out,&in,&reason);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -274,6 +272,7 @@ asynStatus EL734Axis::move(double position, int relative, double minVelocity, do
|
|||||||
}
|
}
|
||||||
oredMSR = 0;
|
oredMSR = 0;
|
||||||
homing = 0;
|
homing = 0;
|
||||||
|
//errlogPrintf("Starting axis %d with destination %f", axisNo_,position/1000);
|
||||||
sprintf(command, "p %d %.3f", axisNo_, position/1000.);
|
sprintf(command, "p %d %.3f", axisNo_, position/1000.);
|
||||||
status = pC_->transactController(axisNo_,command,reply);
|
status = pC_->transactController(axisNo_,command,reply);
|
||||||
setIntegerParam(pC_->motorStatusProblem_, false);
|
setIntegerParam(pC_->motorStatusProblem_, false);
|
||||||
@ -422,8 +421,10 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
comStatus = pC_->transactController(axisNo_,command,reply);
|
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||||
if(comStatus) goto skip;
|
if(comStatus) goto skip;
|
||||||
sscanf(reply,"%x",&msr);
|
sscanf(reply,"%x",&msr);
|
||||||
// errlogPrintf("Axis %d, reply %s, msr %d, position = %lf\n",
|
|
||||||
// axisNo_, reply, msr, position);
|
//errlogPrintf("Axis %d, reply %s, msr %d, oredmsr = %d, position = %lf\n",
|
||||||
|
// axisNo_, reply, msr, oredMSR, position);
|
||||||
|
|
||||||
oredMSR |= msr;
|
oredMSR |= msr;
|
||||||
if( (msr & 0x1) == 0){
|
if( (msr & 0x1) == 0){
|
||||||
// done: check for trouble
|
// done: check for trouble
|
||||||
@ -449,6 +450,7 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
setIntegerParam(pC_->motorStatusProblem_, false);
|
setIntegerParam(pC_->motorStatusProblem_, false);
|
||||||
if(oredMSR & 0x1000){
|
if(oredMSR & 0x1000){
|
||||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
|
// errlogPrintf("Detected air cushion error on %d", axisNo_);
|
||||||
errlogSevPrintf(errlogMajor, "Air cushion problem on %d", axisNo_);
|
errlogSevPrintf(errlogMajor, "Air cushion problem on %d", axisNo_);
|
||||||
updateMsgTxtFromDriver("Air cushion error");
|
updateMsgTxtFromDriver("Air cushion error");
|
||||||
driverError = 1;
|
driverError = 1;
|
||||||
@ -465,7 +467,7 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
*moving = true;
|
*moving = true;
|
||||||
next_poll = -1;
|
next_poll = -1;
|
||||||
setIntegerParam(pC_->motorStatusDone_, false);
|
setIntegerParam(pC_->motorStatusDone_, false);
|
||||||
//updateMsgTxtFromDriver("Creeping");
|
updateMsgTxtFromDriver("Creeping");
|
||||||
}
|
}
|
||||||
|
|
||||||
skip:
|
skip:
|
||||||
|
Reference in New Issue
Block a user