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