Fixed bugs in EL734
Phytron motor driver is now working May be fixed inverted limits on pmac
This commit is contained in:
@@ -60,7 +60,6 @@ PhytronController::PhytronController(const char *portName, const char *PhytronPo
|
||||
: SINQController(portName, PhytronPortName,2)
|
||||
{
|
||||
asynStatus status;
|
||||
PhytronAxis *pAxis;
|
||||
static const char *functionName = "PhytronController::PhytronController";
|
||||
char etx[2];
|
||||
|
||||
@@ -78,8 +77,8 @@ PhytronController::PhytronController(const char *portName, const char *PhytronPo
|
||||
pasynOctetSyncIO->setOutputEos(pasynUserController_,etx,strlen(etx));
|
||||
pasynOctetSyncIO->setInputEos(pasynUserController_,etx,strlen(etx));
|
||||
|
||||
pAxis = new PhytronAxis(this, 1, encX);
|
||||
pAxis = new PhytronAxis(this, 2, encY);
|
||||
new PhytronAxis(this, 1, encX);
|
||||
new PhytronAxis(this, 2, encY);
|
||||
|
||||
startPoller(1000./1000., IDLEPOLL, 2);
|
||||
}
|
||||
@@ -94,9 +93,7 @@ PhytronController::PhytronController(const char *portName, const char *PhytronPo
|
||||
extern "C" int PhytronCreateController(const char *portName, const char *PhytronPortName, const char *selector,
|
||||
int encX, int encY)
|
||||
{
|
||||
PhytronController *pPhytronController
|
||||
= new PhytronController(portName, PhytronPortName,selector, encX, encY);
|
||||
pPhytronController = NULL;
|
||||
new PhytronController(portName, PhytronPortName,selector, encX, encY);
|
||||
return(asynSuccess);
|
||||
}
|
||||
|
||||
@@ -210,7 +207,6 @@ PhytronAxis::PhytronAxis(PhytronController *pC, int axisNo, int enc)
|
||||
} else {
|
||||
phytronChar = 'Y';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +261,11 @@ asynStatus PhytronAxis::home(double minVelocity, double maxVelocity, double acce
|
||||
|
||||
updateMsgTxtFromDriver("");
|
||||
|
||||
sprintf(command, "%s%cO-",pC_->selector,phytronChar);
|
||||
if(forwards){
|
||||
sprintf(command, "%s%cO+",pC_->selector,phytronChar);
|
||||
} else {
|
||||
sprintf(command, "%s%cO-",pC_->selector,phytronChar);
|
||||
}
|
||||
homing = 1;
|
||||
next_poll= -1;
|
||||
status = pC_->transactController(axisNo_,command,reply);
|
||||
@@ -353,7 +353,7 @@ asynStatus PhytronAxis::setClosedLoop(bool closedLoop)
|
||||
* \param[out] moving A flag that is set indicating that the axis is moving (true) or done (false). */
|
||||
asynStatus PhytronAxis::poll(bool *moving)
|
||||
{
|
||||
asynStatus comStatus;
|
||||
asynStatus comStatus = asynSuccess;
|
||||
char command[COMLEN], reply[COMLEN];
|
||||
double lowlim;
|
||||
|
||||
@@ -364,6 +364,7 @@ asynStatus PhytronAxis::poll(bool *moving)
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
setIntegerParam(pC_->motorStatusProblem_, false);
|
||||
// Read the current motor position
|
||||
if(encoder) {
|
||||
sprintf(command,"%s%cP22R",pC_->selector,phytronChar);
|
||||
@@ -372,13 +373,16 @@ asynStatus PhytronAxis::poll(bool *moving)
|
||||
}
|
||||
|
||||
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||
if(comStatus) goto skip;
|
||||
|
||||
if(comStatus == asynError) {
|
||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
updateMsgTxtFromDriver("No connection to phytron controller");
|
||||
goto skip;
|
||||
}
|
||||
if(strstr(reply,"NACK") != NULL){
|
||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
errlogSevPrintf(errlogMajor, "Bad reply for position on %d", axisNo_);
|
||||
updateMsgTxtFromDriver("Bad reply reading position");
|
||||
goto skip;
|
||||
goto skip;
|
||||
}
|
||||
/*
|
||||
read over the ACK
|
||||
@@ -392,7 +396,11 @@ asynStatus PhytronAxis::poll(bool *moving)
|
||||
// Read the moving status of this motor
|
||||
sprintf(command,"%s%c=H",pC_->selector,phytronChar);
|
||||
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||
if(comStatus) goto skip;
|
||||
if(comStatus == asynError){
|
||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
updateMsgTxtFromDriver("No connection to phytron controller");
|
||||
goto skip;
|
||||
}
|
||||
/* errlogPrintf("Axis %d, status reply %s, position %lf\n", axisNo_, reply, position); */
|
||||
if(strstr(reply,"ACKN") != NULL){
|
||||
*moving = true;
|
||||
@@ -416,10 +424,16 @@ asynStatus PhytronAxis::poll(bool *moving)
|
||||
*/
|
||||
sprintf(command,"%s%c=I+",pC_->selector,phytronChar);
|
||||
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||
if(comStatus) goto skip;
|
||||
if(comStatus == asynError) {
|
||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
updateMsgTxtFromDriver("No connection to phytron controller");
|
||||
goto skip;
|
||||
}
|
||||
if(strstr(reply,"ACKE") != NULL){
|
||||
setIntegerParam(pC_->motorStatusHighLimit_, true);
|
||||
updateMsgTxtFromDriver("High Limit Hit");
|
||||
updateMsgTxtFromDriver("Hit High Limit");
|
||||
comStatus = asynError;
|
||||
goto skip;
|
||||
} else {
|
||||
setIntegerParam(pC_->motorStatusHighLimit_, false);
|
||||
}
|
||||
@@ -429,10 +443,16 @@ asynStatus PhytronAxis::poll(bool *moving)
|
||||
*/
|
||||
sprintf(command,"%s%c=I-",pC_->selector,phytronChar);
|
||||
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||
if(comStatus) goto skip;
|
||||
if(comStatus == asynError){
|
||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
updateMsgTxtFromDriver("No connection to phytron controller");
|
||||
goto skip;
|
||||
}
|
||||
if(strstr(reply,"ACKE") != NULL){
|
||||
setIntegerParam(pC_->motorStatusLowLimit_, true);
|
||||
updateMsgTxtFromDriver("Low Limit Hit");
|
||||
comStatus = asynError;
|
||||
goto skip;
|
||||
} else {
|
||||
setIntegerParam(pC_->motorStatusLowLimit_, false);
|
||||
}
|
||||
@@ -442,11 +462,17 @@ asynStatus PhytronAxis::poll(bool *moving)
|
||||
*/
|
||||
sprintf(command,"%s%c=E",pC_->selector,phytronChar);
|
||||
comStatus = pC_->transactController(axisNo_,command,reply);
|
||||
if(comStatus) goto skip;
|
||||
if(comStatus == asynError) {
|
||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
updateMsgTxtFromDriver("No connection to phytron controller");
|
||||
goto skip;
|
||||
}
|
||||
if(strstr(reply,"ACKE") != NULL){
|
||||
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||
errlogSevPrintf(errlogMajor, "Electronics on %d", axisNo_);
|
||||
updateMsgTxtFromDriver("Electronics error");
|
||||
comStatus = asynError;
|
||||
goto skip;
|
||||
} else {
|
||||
setIntegerParam(pC_->motorStatusProblem_, false);
|
||||
}
|
||||
@@ -455,9 +481,8 @@ asynStatus PhytronAxis::poll(bool *moving)
|
||||
|
||||
|
||||
skip:
|
||||
setIntegerParam(pC_->motorStatusProblem_, comStatus ? 1:0);
|
||||
callParamCallbacks();
|
||||
return comStatus ? asynError : asynSuccess;
|
||||
return comStatus;
|
||||
}
|
||||
|
||||
/** Code for iocsh registration */
|
||||
|
||||
Reference in New Issue
Block a user