pmac Enable PV successfully tested
This commit is contained in:

committed by
brambilla_m

parent
fbf2331a05
commit
403eecafae
@ -909,9 +909,13 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) {
|
||||
double position = 0;
|
||||
int nvals = 0;
|
||||
int axisProblemFlag = 0;
|
||||
epicsUInt32 axErr = 0, axStat = 0, highLim = 0, lowLim = 0, axDone = 0;
|
||||
epicsUInt32 axErr = 0, highLim = 0, lowLim = 0, axDone = 0;
|
||||
int axStat=0;
|
||||
char message[132], *axMessage;
|
||||
|
||||
static const char *functionName = "pmacV3Axis::getAxisStatus";
|
||||
|
||||
pmacV3Controller* p3C_ = (pmacV3Controller*)pC_;
|
||||
sprintf(command, "Q%2.2d10 P%2.2d00 P%2.2d23", axisNo_, axisNo_, axisNo_);
|
||||
cmdStatus = pC_->lowLevelWriteRead(axisNo_, command, response);
|
||||
nvals = sscanf(response, "%lf %d %d", &position, &axStat, &axDone);
|
||||
@ -923,6 +927,9 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) {
|
||||
updateMsgTxtFromDriver("Cannot read Axis position and status");
|
||||
}
|
||||
|
||||
// printf("axStat: %d\n", axStat);
|
||||
setIntegerParam(p3C_->axisState_, axStat);
|
||||
|
||||
setDoubleParam(pC_->motorPosition_, position * MULT);
|
||||
setDoubleParam(pC_->motorEncoderPosition_, position * MULT);
|
||||
|
||||
@ -940,8 +947,6 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) {
|
||||
previous_position_ = position;
|
||||
previous_direction_ = direction;
|
||||
|
||||
setIntegerParam(pC_->axisStatus_, axStat);
|
||||
|
||||
// errlogPrintf("Polling, axStat = %d, position = %f\n", axStat, position);
|
||||
|
||||
/* are we done? */
|
||||
@ -1059,10 +1064,11 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) {
|
||||
/* Set any axis specific general problem bits. */
|
||||
}
|
||||
|
||||
if (axStat < 0 || axErr != 0) {
|
||||
if ((axStat < 0 && axStat != -3) || axErr != 0) {
|
||||
axisProblemFlag = 1;
|
||||
if (axisErrorCount < 10) {
|
||||
axMessage = translateAxisError(axErr);
|
||||
printf("axErr: %d\taxStat: %d\taxMessage: %s\n", axErr, axStat, axMessage);
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"drvPmacAxisGetStatus: Axis %d is in deep trouble: axis error "
|
||||
"code %d, translated: %s:, status code = %d\n",
|
||||
@ -1084,6 +1090,7 @@ asynStatus pmacV3Axis::getAxisStatus(bool *moving) {
|
||||
}
|
||||
setIntegerParam(pC_->motorStatusProblem_, axisProblemFlag);
|
||||
|
||||
callParamCallbacks();
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@ protected:
|
||||
bool autoEnable;
|
||||
|
||||
friend class pmacController;
|
||||
friend class pmacV3Controller;
|
||||
};
|
||||
/*----------------------------------------------------------------------------------------------*/
|
||||
class pmacHRPTAxis : public pmacAxis
|
||||
@ -142,16 +143,10 @@ class pmacV3Axis : public pmacAxis {
|
||||
public:
|
||||
|
||||
pmacV3Axis(pmacController *pController, int axisNo);
|
||||
/* : pmacAxis(pController,axisNo, false) { */
|
||||
/* printf("\n*************************\n\n"); */
|
||||
/* printf("class name: %s", getClassName(*this)); */
|
||||
/* printf("\n*************************\n\n"); */
|
||||
/* }; */
|
||||
|
||||
asynStatus poll(bool *moving);
|
||||
protected:
|
||||
|
||||
int axisState_;
|
||||
|
||||
asynStatus getAxisStatus(bool *moving);
|
||||
|
||||
friend class pmacController;
|
||||
|
@ -858,23 +858,25 @@ 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_];
|
||||
pmacV3Axis *pAxis = NULL;
|
||||
static const char *functionName = "pmacV3Controller::readInt32";
|
||||
char command[128];
|
||||
char response[128];
|
||||
|
||||
debugFlow(functionName);
|
||||
|
||||
pAxis = this->getAxis(pasynUser);
|
||||
pAxis = (pmacV3Axis*)(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);
|
||||
status = this->lowLevelWriteRead(pAxis->axisNo_, command, response);
|
||||
*value = strtol(response, NULL, 10);
|
||||
setIntegerParam(pAxis->axisState_, value);
|
||||
return status
|
||||
|
||||
setIntegerParam(axisState_, *value);
|
||||
callParamCallbacks();
|
||||
return status;
|
||||
}
|
||||
return pmacController::readInt32(pasynUser, value);
|
||||
}
|
||||
|
@ -183,7 +183,10 @@ public:
|
||||
friend class pmacAxis;
|
||||
|
||||
protected:
|
||||
pmacV3Axis **pAxes_; /**< Array of pointers to axis objects */
|
||||
|
||||
int enableAxis_;
|
||||
int axisState_;
|
||||
};
|
||||
|
||||
#endif /* pmacController_H */
|
||||
|
Reference in New Issue
Block a user