Bugfix pmacV3

This commit is contained in:
Michele Brambilla
2022-03-02 11:04:28 +01:00
committed by brambilla_m
parent c805385ad1
commit edc71af235
2 changed files with 50 additions and 16 deletions

View File

@ -143,8 +143,14 @@ class LiftAxis : public pmacAxis
class pmacV3Axis : public pmacAxis { class pmacV3Axis : public pmacAxis {
public: public:
using pmacAxis::pmacAxis; pmacV3AxisAxis(pmacController *pController, int axisNo) : pmacAxis(pController,axisNo, false) {};
protected:
asynStatus getAxisStatus(bool *moving);
friend class pmacController; friend class pmacController;
friend class pmacV3Controller;
}; };
#endif /* pmacAxis_H */ #endif /* pmacAxis_H */

View File

@ -549,14 +549,11 @@ asynStatus SeleneCreateController(const char *portName, const char *lowLevelPort
return asynSuccess; return asynSuccess;
} }
asynStatus pmacV3CreateController(const char *portName, asynStatus pmacV3CreateController(const char *portName, const char *lowLevelPortName, int lowLevelPortAddress,
const char *lowLevelPortName, int numAxes, int movingPollPeriod, int idlePollPeriod)
int lowLevelPortAddress, int numAxes, {
int movingPollPeriod, int idlePollPeriod) {
pmacV3Controller *ppmacController = new pmacV3Controller( pmacController *ppmacController = new pmacV3Controller(portName, lowLevelPortName, lowLevelPortAddress, numAxes, movingPollPeriod/1000., idlePollPeriod/1000.);
portName, lowLevelPortName, lowLevelPortAddress, numAxes,
movingPollPeriod / 1000., idlePollPeriod / 1000.);
ppmacController = NULL; ppmacController = NULL;
return asynSuccess; return asynSuccess;
@ -573,16 +570,15 @@ SeleneController::SeleneController(const char *portName, const char *lowLevelPor
static const char *functionName = "seleneController::seleneController"; static const char *functionName = "seleneController::seleneController";
createParam(MotorSetPositionString, asynParamFloat64, &setMotorPosition_); createParam(MotorSetPositionString, asynParamFloat64, &setMotorPosition_);
callParamCallbacks(); callParamCallbacks();
} }
pmacV3Controller::pmacV3Controller(const char *portName, pmacV3Controller::pmacV3Controller(const char *portName,
const char *lowLevelPortName, const char *lowLevelPortName,
int lowLevelPortAddress, int numAxes, int lowLevelPortAddress, int numAxes,
double movingPollPeriod, double movingPollPeriod,
double idlePollPeriod, double idlePollPeriod,
const int &extraParams){ const int &extraParams) :
pmacController(portName, lowLevelPortName, lowLevelPortAddress, numAxes, pmacController(portName, lowLevelPortName, lowLevelPortAddress, numAxes, movingPollPeriod, idlePollPeriod, extraParams) {
movingPollPeriod, idlePollPeriod, extraParams);
static const char *functionName = "pmacV3Controller::pmacV3Controller"; static const char *functionName = "pmacV3Controller::pmacV3Controller";
createParam(EnableAxisString, asynParamInt32, &enableAxis_); createParam(EnableAxisString, asynParamInt32, &enableAxis_);
callParamCallbacks(); callParamCallbacks();
@ -697,6 +693,34 @@ asynStatus LiftCreateAxis(const char *pmacName, /* specify which control
return asynSuccess; return asynSuccess;
} }
/**
* C wrapper for the pmacV3Axis constructor.
* See pmacAxis::pmacV3Axis.
*
*/
asynStatus pmacV3CreateAxis(
const char *pmacName, /* specify which controller by port name */
int axis) /* axis number (start from 1). */
{
pmacController *pC;
pmacAxis *pAxis;
static const char *functionName = "pmacV3CreateAxis";
pC = (pmacController *)findAsynPortDriver(pmacName);
if (!pC) {
printf("%s:%s: Error port %s not found\n", driverName, functionName,
pmacName);
return asynError;
}
pC->lock();
pAxis = new pmacV3Axis(pC, axis);
pAxis = NULL;
pC->unlock();
return asynSuccess;
}
/** /**
* C Wrapper function for pmacHRPTAxis constructor. * C Wrapper function for pmacHRPTAxis constructor.
* See pmacAxis::pmacAxis. * See pmacAxis::pmacAxis.
@ -794,12 +818,14 @@ asynStatus SeleneController::writeFloat64(asynUser *pasynUser, epicsFloat64 valu
asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) { asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
int function = pasynUser->reason; int function = pasynUser->reason;
asynStatus status = asynError; asynStatus status = asynError;
pmacAxis *pAxis = NULL; pmacV3Axis *pAxis = NULL;
char command[64] = {0};
char response[64] = {0};
static const char *functionName = "pmacV3Controller::writeInt32"; static const char *functionName = "pmacV3Controller::writeInt32";
debugFlow(functionName); debugFlow(functionName);
pAxis = this->getAxis(pasynUser); pAxis = (pmacV3Axis*)this->getAxis(pasynUser);
if (!pAxis) { if (!pAxis) {
return asynError; return asynError;
} }
@ -947,10 +973,12 @@ static void pmacControllerRegister(void)
{ {
iocshRegister(&configpmacCreateController, configpmacCreateControllerCallFunc); iocshRegister(&configpmacCreateController, configpmacCreateControllerCallFunc);
iocshRegister(&configSeleneCreateController, configSeleneCreateControllerCallFunc); iocshRegister(&configSeleneCreateController, configSeleneCreateControllerCallFunc);
iocshRegister(&configpmacV3CreateController, configpmacV3CreateControllerCallFunc);
iocshRegister(&configpmacAxis, configpmacAxisCallFunc); iocshRegister(&configpmacAxis, configpmacAxisCallFunc);
iocshRegister(&configpmacHRPTAxis, configpmacHRPTAxisCallFunc); iocshRegister(&configpmacHRPTAxis, configpmacHRPTAxisCallFunc);
iocshRegister(&configSeleneCreateAxis, configSeleneCreateAxisCallFunc); iocshRegister(&configSeleneCreateAxis, configSeleneCreateAxisCallFunc);
iocshRegister(&configLiftAxis, configLiftAxisCallFunc); iocshRegister(&configLiftAxis, configLiftAxisCallFunc);
iocshRegister(&configpmacV3Axis, configpmacV3AxisCallFunc);
iocshRegister(&configpmacAxes, configpmacAxesCallFunc); iocshRegister(&configpmacAxes, configpmacAxesCallFunc);
} }
epicsExportRegistrar(pmacControllerRegister); epicsExportRegistrar(pmacControllerRegister);