pmacV3 read axis state
This commit is contained in:
@ -172,7 +172,6 @@ asynStatus pmacAxis::getAxisInitialStatus(void)
|
|||||||
|
|
||||||
// Enable the axis. After startup, the axis are disabled on the controller...
|
// Enable the axis. After startup, the axis are disabled on the controller...
|
||||||
// Warning: Selene lift axis should not be automatically enabled
|
// Warning: Selene lift axis should not be automatically enabled
|
||||||
|
|
||||||
if (autoEnable) {
|
if (autoEnable) {
|
||||||
sprintf(command, "M%2.2d14=1\n", axisNo_);
|
sprintf(command, "M%2.2d14=1\n", axisNo_);
|
||||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Enable axis %d: %s",axisNo_,command);
|
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Enable axis %d: %s",axisNo_,command);
|
||||||
@ -941,6 +940,8 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) {
|
|||||||
previous_position_ = position;
|
previous_position_ = position;
|
||||||
previous_direction_ = direction;
|
previous_direction_ = direction;
|
||||||
|
|
||||||
|
setIntegerParam(pC_->axisStatus_, axStat);
|
||||||
|
|
||||||
// errlogPrintf("Polling, axStat = %d, position = %f\n", axStat, position);
|
// errlogPrintf("Polling, axStat = %d, position = %f\n", axStat, position);
|
||||||
|
|
||||||
/* are we done? */
|
/* are we done? */
|
||||||
@ -1086,30 +1087,4 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) {
|
|||||||
return asynSuccess;
|
return asynSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
// pmacV3Axis::enable(int on) {
|
|
||||||
// char command[pC_->PMAC_MAXBUF_];
|
|
||||||
// char response[pC_->PMAC_MAXBUF_];
|
|
||||||
// int cmdStatus = 0;
|
|
||||||
// static const char *functionName = "pmacV3Axis::enable";
|
|
||||||
|
|
||||||
// pC_->debugFlow(functionName);
|
|
||||||
|
|
||||||
// // Enable the axis. After startup, the axis are disabled on the controller...
|
|
||||||
// sprintf(command, "M%2.2d14=%1.1d", axisNo_, on);
|
|
||||||
// cmdStatus = pC_->lowLevelWriteRead(axisNo_, command, response);
|
|
||||||
// if (cmdStatus) {
|
|
||||||
// if(on) {
|
|
||||||
// asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
|
||||||
// "%s: Error: enabling axis %d failed.\n", functionName, axisNo_);
|
|
||||||
// } else {
|
|
||||||
// asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
|
||||||
// "%s: Error: disabling axis %d failed.\n", functionName, axisNo_);
|
|
||||||
// }
|
|
||||||
// return asynError;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// callParamCallbacks();
|
|
||||||
|
|
||||||
// return asynSuccess;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
class pmacController;
|
class pmacController;
|
||||||
class SeleneController;
|
class SeleneController;
|
||||||
|
|
||||||
#define PMAC_EnableAxis "PMAC_ENABLE_AXIS"
|
|
||||||
|
|
||||||
class pmacAxis : public SINQAxis
|
class pmacAxis : public SINQAxis
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -152,6 +150,8 @@ public:
|
|||||||
asynStatus poll(bool *moving);
|
asynStatus poll(bool *moving);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
int axisState_;
|
||||||
|
|
||||||
asynStatus getAxisStatus(bool *moving);
|
asynStatus getAxisStatus(bool *moving);
|
||||||
|
|
||||||
friend class pmacController;
|
friend class pmacController;
|
||||||
|
@ -472,7 +472,6 @@ asynStatus pmacController::writeInt32(asynUser *pasynUser, epicsInt32 value)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Returns a pointer to an pmacAxis object.
|
/** Returns a pointer to an pmacAxis object.
|
||||||
* Returns NULL if the axis number encoded in pasynUser is invalid.
|
* Returns NULL if the axis number encoded in pasynUser is invalid.
|
||||||
* \param[in] pasynUser asynUser structure that encodes the axis index number. */
|
* \param[in] pasynUser asynUser structure that encodes the axis index number. */
|
||||||
@ -581,6 +580,7 @@ SeleneController::SeleneController(const char *portName, const char *lowLevelPor
|
|||||||
pmacController(portName, lowLevelPortName, lowLevelPortAddress, numAxes, movingPollPeriod, idlePollPeriod, extraParams) {
|
pmacController(portName, lowLevelPortName, lowLevelPortAddress, numAxes, movingPollPeriod, idlePollPeriod, extraParams) {
|
||||||
static const char *functionName = "pmacV3Controller::pmacV3Controller";
|
static const char *functionName = "pmacV3Controller::pmacV3Controller";
|
||||||
createParam(EnableAxisString, asynParamInt32, &enableAxis_);
|
createParam(EnableAxisString, asynParamInt32, &enableAxis_);
|
||||||
|
createParam(AxisStateString, asynParamInt32, &axisState_);
|
||||||
callParamCallbacks();
|
callParamCallbacks();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,6 +854,32 @@ asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asynStatus pmacV3Controller::readInt32(asynUser *pasynUser, epicsInt32 *value) {
|
||||||
|
|
||||||
|
int function = pasynUser->reason;
|
||||||
|
asynStatus status = asynError;
|
||||||
|
pmacAxis *pAxis = NULL;
|
||||||
|
static const char *functionName = "pmacController::readInt32";
|
||||||
|
char command[this->PMAC_MAXBUF_];
|
||||||
|
char response[this->PMAC_MAXBUF_];
|
||||||
|
|
||||||
|
debugFlow(functionName);
|
||||||
|
|
||||||
|
pAxis = this->getAxis(pasynUser);
|
||||||
|
if (!pAxis) {
|
||||||
|
return asynError;
|
||||||
|
}
|
||||||
|
if (function == axisState_) {
|
||||||
|
snprintf(command, sizeof(command), "P%2.2d00", pAxis->axisNo_);
|
||||||
|
status = this->lowLevelWriteRead(axisNo_, command, response);
|
||||||
|
*value = strtol(response, NULL, 10);
|
||||||
|
setIntegerParam(pAxis->axisState_, value);
|
||||||
|
return status
|
||||||
|
}
|
||||||
|
return pmacController::readInt32(pasynUser, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Code for iocsh registration */
|
/* Code for iocsh registration */
|
||||||
|
|
||||||
#ifdef vxWorks
|
#ifdef vxWorks
|
||||||
|
@ -165,6 +165,7 @@ class SeleneController : public pmacController {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define EnableAxisString "ENABLE_AXIS"
|
#define EnableAxisString "ENABLE_AXIS"
|
||||||
|
#define AxisStateString "AXIS_STATE"
|
||||||
|
|
||||||
class pmacV3Controller : public pmacController {
|
class pmacV3Controller : public pmacController {
|
||||||
public:
|
public:
|
||||||
@ -175,6 +176,9 @@ public:
|
|||||||
// overloaded because we want to enable/disable the motor
|
// overloaded because we want to enable/disable the motor
|
||||||
asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
|
asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value);
|
||||||
|
|
||||||
|
// overloaded because we want to read the axis state
|
||||||
|
asynStatus readInt32(asynUser *pasynUser, epicsInt32 *value);
|
||||||
|
|
||||||
friend class pmacV3Axis;
|
friend class pmacV3Axis;
|
||||||
friend class pmacAxis;
|
friend class pmacAxis;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user