motor: added shell function to XPS model 3 driver to disable auto enable of axes when attempting a move. This is done on a per controller basis. Call XPSDisableAutoEnable(port) at the shell.

This commit is contained in:
mp49
2011-07-29 10:17:08 +00:00
parent 7e3502253c
commit de4040d181
3 changed files with 59 additions and 9 deletions
+14 -8
View File
@@ -211,15 +211,21 @@ asynStatus XPSAxis::move(double position, int relative, double min_velocity, dou
driverName, functionName, pC_->portName, axisNo_, position, min_velocity, max_velocity, acceleration, minJerk, maxJerk);
/* Look at the last poll value of the positioner status. If it is disabled, then enable it */
if (axisStatus_ >= 20 && axisStatus_ <= 36) {
status = GroupMotionEnable(pollSocket_, groupName_);
if (status) {
asynPrint(pasynUser_, ASYN_TRACE_ERROR,
"%s:%s: motorAxisMove[%s,%d]: error performing GroupMotionEnable %d\n",
driverName, functionName, pC_->portName, axisNo_, status);
/* Error -27 is caused when the motor record changes dir i.e. when it aborts a move!*/
return asynError;
/* This can be disabled by calling XPSDisableAutoEnable() at the IOC shell.*/
if (pC_->autoEnable_) {
if (axisStatus_ >= 20 && axisStatus_ <= 36) {
status = GroupMotionEnable(pollSocket_, groupName_);
if (status) {
asynPrint(pasynUser_, ASYN_TRACE_ERROR,
"%s:%s: motorAxisMove[%s,%d]: error performing GroupMotionEnable %d\n",
driverName, functionName, pC_->portName, axisNo_, status);
/* Error -27 is caused when the motor record changes dir i.e. when it aborts a move!*/
return asynError;
}
}
} else {
//Return error if a move is attempted and auto enable is turned off.
return asynError;
}
status = PositionerSGammaParametersSet(pollSocket_,
positionerName_,
+41 -1
View File
@@ -193,6 +193,9 @@ XPSController::XPSController(const char *portName, const char *IPAddress, int IP
epicsThreadGetStackSize(epicsThreadStackMedium),
(EPICSTHREADFUNC)XPSProfileThreadC, (void *)this);
//By default, automatically enable axes that have been disabled.
autoEnable_ = 1;
}
void XPSController::report(FILE *fp, int level)
@@ -1268,6 +1271,14 @@ asynStatus XPSController::readbackProfile()
return status ? asynError : asynSuccess;
}
/* Function to disable the automatic enable of axes when moving */
asynStatus XPSController::disableAutoEnable()
{
autoEnable_ = 0;
return asynSuccess;
}
/** The following functions have C linkage, and can be called directly or from iocsh */
@@ -1332,6 +1343,22 @@ asynStatus XPSConfigProfile(const char *XPSName, /* specify which contro
}
asynStatus XPSDisableAutoEnable(const char *XPSName)
{
XPSController *pC;
static const char *functionName = "XPSDisableAutoEnable";
pC = (XPSController*) findAsynPortDriver(XPSName);
if (!pC) {
printf("%s:%s: Error port %s not found\n",
driverName, functionName, XPSName);
return asynError;
}
return pC->disableAutoEnable();
}
/* Code for iocsh registration */
@@ -1395,13 +1422,26 @@ static void configXPSProfileCallFunc(const iocshArgBuf *args)
{
XPSConfigProfile(args[0].sval, args[1].ival, args[2].sval, args[3].sval);
}
/* XPSDisableAutoEnable */
static const iocshArg XPSDisableAutoEnableArg0 = {"Controller port name", iocshArgString};
static const iocshArg * const XPSDisableAutoEnableArgs[] = {&XPSDisableAutoEnableArg0};
static const iocshFuncDef disableAutoEnable = {"XPSDisableAutoEnable", 1, XPSDisableAutoEnableArgs};
static void disableAutoEnableCallFunc(const iocshArgBuf *args)
{
XPSDisableAutoEnable(args[0].sval);
}
static void XPSRegister3(void)
{
iocshRegister(&configXPS, configXPSCallFunc);
iocshRegister(&configXPSAxis, configXPSAxisCallFunc);
iocshRegister(&configXPSProfile, configXPSProfileCallFunc);
iocshRegister(&disableAutoEnable, disableAutoEnableCallFunc);
}
epicsExportRegistrar(XPSRegister3);
} // extern "C"
+4
View File
@@ -55,6 +55,9 @@ class XPSController : public asynMotorController {
asynStatus processDeferredMoves();
asynStatus processDeferredMovesInGroup(char * groupName);
/*Disable automatic enable of axes.*/
asynStatus disableAutoEnable();
protected:
XPSAxis **pAxes_; /**< Array of pointers to axis objects */
@@ -82,6 +85,7 @@ class XPSController : public asynMotorController {
char firmwareVersion_[100];
int movesDeferred_;
epicsEventId profileExecuteEvent_;
int autoEnable_;
friend class XPSAxis;
};