Fixed a bug with inproperly cleared MsgTxt in SINQAxis
Extended pmacAxis to properly deal with HRPT pmac motors which have an extra error condition
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
file "$(MOTOR)/db/basic_asyn_motor.db"
|
qfile "$(MOTOR)/db/basic_asyn_motor.db"
|
||||||
{
|
{
|
||||||
pattern
|
pattern
|
||||||
{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT}
|
{P, N, M, DTYP, PORT, ADDR, DESC, EGU, DIR, VELO, VBAS, ACCL, BDST, BVEL, BACC, MRES, PREC, DHLM, DLLM, INIT}
|
||||||
|
@ -345,7 +345,7 @@ asynStatus EL734Axis::setPosition(double position)
|
|||||||
//static const char *functionName = "EL734Axis::setPosition";
|
//static const char *functionName = "EL734Axis::setPosition";
|
||||||
char command[COMLEN], reply[COMLEN];
|
char command[COMLEN], reply[COMLEN];
|
||||||
|
|
||||||
sprintf(command, "P %d %f", axisNo_, position/1000.);
|
sprintf(command, "U %d %f", axisNo_, position/1000.);
|
||||||
status = pC_->transactController(axisNo_,command,reply);
|
status = pC_->transactController(axisNo_,command,reply);
|
||||||
next_poll = -1;
|
next_poll = -1;
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ asynStatus EL734Axis::poll(bool *moving)
|
|||||||
} else if(strstr(reply,"?BSY") != NULL){
|
} else if(strstr(reply,"?BSY") != NULL){
|
||||||
*moving = true;
|
*moving = true;
|
||||||
setIntegerParam(pC_->motorStatusDone_, false);
|
setIntegerParam(pC_->motorStatusDone_, false);
|
||||||
updateMsgTxtFromDriver(NULL);
|
updateMsgTxtFromDriver("");
|
||||||
goto skip;
|
goto skip;
|
||||||
}
|
}
|
||||||
count = sscanf(reply,"%lf", &position);
|
count = sscanf(reply,"%lf", &position);
|
||||||
|
@ -12,6 +12,7 @@ SINQAxis::SINQAxis(class SINQController *pC, int axis)
|
|||||||
: asynMotorAxis((asynMotorController *)pC, axis),
|
: asynMotorAxis((asynMotorController *)pC, axis),
|
||||||
pC_(pC)
|
pC_(pC)
|
||||||
{
|
{
|
||||||
|
updateMsgTxtFromDriver("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ void SINQAxis::updateMsgTxtFromDriver(const char *value)
|
|||||||
setStringParam(pC_->motorMessageText_,value);
|
setStringParam(pC_->motorMessageText_,value);
|
||||||
} else {
|
} else {
|
||||||
pC_->setIntegerParam(axisNo_,pC_->motorMessageIsFromDriver_, 0);
|
pC_->setIntegerParam(axisNo_,pC_->motorMessageIsFromDriver_, 0);
|
||||||
|
setStringParam(pC_->motorMessageText_,"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,8 +218,6 @@ asynStatus pmacAxis::home(double min_velocity, double max_velocity, double accel
|
|||||||
asynStatus pmacAxis::moveVelocity(double min_velocity, double max_velocity, double acceleration)
|
asynStatus pmacAxis::moveVelocity(double min_velocity, double max_velocity, double acceleration)
|
||||||
{
|
{
|
||||||
asynStatus status = asynError;
|
asynStatus status = asynError;
|
||||||
char command[128] = {0};
|
|
||||||
char response[32] = {0};
|
|
||||||
static const char *functionName = "pmacAxis::moveVelocity";
|
static const char *functionName = "pmacAxis::moveVelocity";
|
||||||
|
|
||||||
pC_->debugFlow(functionName);
|
pC_->debugFlow(functionName);
|
||||||
@ -334,12 +332,9 @@ asynStatus pmacAxis::getAxisStatus(bool *moving)
|
|||||||
int cmdStatus = 0;;
|
int cmdStatus = 0;;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
double position = 0;
|
double position = 0;
|
||||||
double enc_position = 0;
|
|
||||||
int nvals = 0;
|
int nvals = 0;
|
||||||
int axisProblemFlag = 0;
|
int axisProblemFlag = 0;
|
||||||
int limitsDisabledBit = 0;
|
|
||||||
epicsUInt32 axErr = 0, axStat = 0, highLim = 0, lowLim= 0;
|
epicsUInt32 axErr = 0, axStat = 0, highLim = 0, lowLim= 0;
|
||||||
int errorPrintMin = 10000;
|
|
||||||
char message[132], *axMessage;
|
char message[132], *axMessage;
|
||||||
|
|
||||||
|
|
||||||
@ -521,3 +516,30 @@ asynStatus pmacAxis::getAxisStatus(bool *moving)
|
|||||||
return asynSuccess;
|
return asynSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asynStatus pmacHRPTAxis::getAxisStatus(bool *moving)
|
||||||
|
{
|
||||||
|
char command[pC_->PMAC_MAXBUF_];
|
||||||
|
char response[pC_->PMAC_MAXBUF_];
|
||||||
|
int cmdStatus = 0, nvals, crashSignal;
|
||||||
|
|
||||||
|
asynStatus result = pmacAxis::getAxisStatus(moving);
|
||||||
|
sprintf(command,"P%2.2d53",axisNo_);
|
||||||
|
cmdStatus = pC_->lowLevelWriteRead(axisNo_,command,response);
|
||||||
|
nvals = sscanf(response,"%d",&crashSignal);
|
||||||
|
if(cmdStatus || nvals != 1){
|
||||||
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
|
"drvPmacAxisGetStatus: Failed to read crash flag Status: %d\nCommand :%s\nResponse:%s\n",
|
||||||
|
cmdStatus, command, response );
|
||||||
|
}
|
||||||
|
if(crashSignal == 1) {
|
||||||
|
updateMsgTxtFromDriver("HSC: HRPT Slit Crash!!");
|
||||||
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||||
|
"drvPmacAxisGetStatus: HRPT Slit CRASH detected");
|
||||||
|
*moving = false;
|
||||||
|
setIntegerParam(pC_->motorStatusMoving_, false);
|
||||||
|
setIntegerParam(pC_->motorStatusDone_, true);
|
||||||
|
setIntegerParam(pC_->motorStatusProblem_, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -33,7 +33,7 @@ class pmacAxis : public SINQAxis
|
|||||||
asynStatus poll(bool *moving);
|
asynStatus poll(bool *moving);
|
||||||
asynStatus setPosition(double position);
|
asynStatus setPosition(double position);
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
pmacController *pC_;
|
pmacController *pC_;
|
||||||
|
|
||||||
asynStatus getAxisStatus(bool *moving);
|
asynStatus getAxisStatus(bool *moving);
|
||||||
@ -60,5 +60,19 @@ class pmacAxis : public SINQAxis
|
|||||||
friend class pmacController;
|
friend class pmacController;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class pmacHRPTAxis : public pmacAxis
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
pmacHRPTAxis(pmacController *pController, int axisNo) : pmacAxis(pController,axisNo) {};
|
||||||
|
/**
|
||||||
|
* Override getAxisStatus in order to read the special parameter indicating a
|
||||||
|
* slit blade crash at HRPT
|
||||||
|
*/
|
||||||
|
asynStatus getAxisStatus(bool *moving);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
friend class pmacController;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* pmacAxis_H */
|
#endif /* pmacAxis_H */
|
||||||
|
@ -558,9 +558,35 @@ asynStatus pmacCreateAxis(const char *pmacName, /* specify which control
|
|||||||
pC->unlock();
|
pC->unlock();
|
||||||
return asynSuccess;
|
return asynSuccess;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* C wrapper for the pmacHRPTAxis constructor.
|
||||||
|
* See pmacHRPTAxis::pmacHRPTAxis.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
asynStatus pmacCreateHRPTAxis(const char *pmacName, /* specify which controller by port name */
|
||||||
|
int axis) /* axis number (start from 1). */
|
||||||
|
{
|
||||||
|
pmacController *pC;
|
||||||
|
pmacAxis *pAxis;
|
||||||
|
|
||||||
|
static const char *functionName = "pmacCreateHRPTAxis";
|
||||||
|
|
||||||
|
pC = (pmacController*) findAsynPortDriver(pmacName);
|
||||||
|
if (!pC) {
|
||||||
|
printf("%s:%s: Error port %s not found\n",
|
||||||
|
driverName, functionName, pmacName);
|
||||||
|
return asynError;
|
||||||
|
}
|
||||||
|
|
||||||
|
pC->lock();
|
||||||
|
pAxis = new pmacHRPTAxis(pC, axis);
|
||||||
|
pAxis = NULL;
|
||||||
|
pC->unlock();
|
||||||
|
return asynSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C Wrapper function for pmacAxis constructor.
|
* C Wrapper function for pmacHRPTAxis constructor.
|
||||||
* See pmacAxis::pmacAxis.
|
* See pmacAxis::pmacAxis.
|
||||||
* This function allows creation of multiple pmacAxis objects with axis numbers 1 to numAxes.
|
* This function allows creation of multiple pmacAxis objects with axis numbers 1 to numAxes.
|
||||||
* @param pmacName Asyn port name for the controller (const char *)
|
* @param pmacName Asyn port name for the controller (const char *)
|
||||||
@ -628,6 +654,18 @@ static void configpmacAxisCallFunc(const iocshArgBuf *args)
|
|||||||
pmacCreateAxis(args[0].sval, args[1].ival);
|
pmacCreateAxis(args[0].sval, args[1].ival);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* pmacCreateHRPTAxis */
|
||||||
|
static const iocshArg pmacCreateHRPTAxisArg0 = {"Controller port name", iocshArgString};
|
||||||
|
static const iocshArg pmacCreateHRPTAxisArg1 = {"Axis number", iocshArgInt};
|
||||||
|
static const iocshArg * const pmacCreateHRPTAxisArgs[] = {&pmacCreateAxisArg0,
|
||||||
|
&pmacCreateAxisArg1};
|
||||||
|
static const iocshFuncDef configpmacHRPTAxis = {"pmacCreateHRPTAxis", 2, pmacCreateHRPTAxisArgs};
|
||||||
|
|
||||||
|
static void configpmacHRPTAxisCallFunc(const iocshArgBuf *args)
|
||||||
|
{
|
||||||
|
pmacCreateHRPTAxis(args[0].sval, args[1].ival);
|
||||||
|
}
|
||||||
|
|
||||||
/* pmacCreateAxes */
|
/* pmacCreateAxes */
|
||||||
static const iocshArg pmacCreateAxesArg0 = {"Controller port name", iocshArgString};
|
static const iocshArg pmacCreateAxesArg0 = {"Controller port name", iocshArgString};
|
||||||
static const iocshArg pmacCreateAxesArg1 = {"Num Axes", iocshArgInt};
|
static const iocshArg pmacCreateAxesArg1 = {"Num Axes", iocshArgInt};
|
||||||
@ -646,6 +684,7 @@ static void pmacControllerRegister(void)
|
|||||||
{
|
{
|
||||||
iocshRegister(&configpmacCreateController, configpmacCreateControllerCallFunc);
|
iocshRegister(&configpmacCreateController, configpmacCreateControllerCallFunc);
|
||||||
iocshRegister(&configpmacAxis, configpmacAxisCallFunc);
|
iocshRegister(&configpmacAxis, configpmacAxisCallFunc);
|
||||||
|
iocshRegister(&configpmacHRPTAxis, configpmacHRPTAxisCallFunc);
|
||||||
iocshRegister(&configpmacAxes, configpmacAxesCallFunc);
|
iocshRegister(&configpmacAxes, configpmacAxesCallFunc);
|
||||||
}
|
}
|
||||||
epicsExportRegistrar(pmacControllerRegister);
|
epicsExportRegistrar(pmacControllerRegister);
|
||||||
|
@ -136,6 +136,7 @@ class pmacController : public SINQController {
|
|||||||
static const epicsUInt32 PMAX_AXIS_GENERAL_PROB2;
|
static const epicsUInt32 PMAX_AXIS_GENERAL_PROB2;
|
||||||
|
|
||||||
friend class pmacAxis;
|
friend class pmacAxis;
|
||||||
|
friend class pmacHRPTAxis;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ registrar(EL734Register)
|
|||||||
registrar(PhytronRegister)
|
registrar(PhytronRegister)
|
||||||
registrar(NanotecRegister)
|
registrar(NanotecRegister)
|
||||||
registrar(pmacControllerRegister)
|
registrar(pmacControllerRegister)
|
||||||
|
registrar(pmacAsynIPPortRegister)
|
||||||
|
|
||||||
#--------------------------------------------------------
|
#--------------------------------------------------------
|
||||||
# With the PSI module build system, including these items actually
|
# With the PSI module build system, including these items actually
|
||||||
|
Reference in New Issue
Block a user