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 {
public:
using pmacAxis::pmacAxis;
pmacV3AxisAxis(pmacController *pController, int axisNo) : pmacAxis(pController,axisNo, false) {};
protected:
asynStatus getAxisStatus(bool *moving);
friend class pmacController;
friend class pmacV3Controller;
};
#endif /* pmacAxis_H */

View File

@ -549,17 +549,14 @@ asynStatus SeleneCreateController(const char *portName, const char *lowLevelPort
return asynSuccess;
}
asynStatus pmacV3CreateController(const char *portName,
const char *lowLevelPortName,
int lowLevelPortAddress, int numAxes,
int movingPollPeriod, int idlePollPeriod) {
asynStatus pmacV3CreateController(const char *portName, const char *lowLevelPortName, int lowLevelPortAddress,
int numAxes, int movingPollPeriod, int idlePollPeriod)
{
pmacV3Controller *ppmacController = new pmacV3Controller(
portName, lowLevelPortName, lowLevelPortAddress, numAxes,
movingPollPeriod / 1000., idlePollPeriod / 1000.);
ppmacController = NULL;
pmacController *ppmacController = new pmacV3Controller(portName, lowLevelPortName, lowLevelPortAddress, numAxes, movingPollPeriod/1000., idlePollPeriod/1000.);
ppmacController = NULL;
return asynSuccess;
return asynSuccess;
}
/*---------------------------------------------------------------------------------------------------------------------*/
@ -573,16 +570,15 @@ SeleneController::SeleneController(const char *portName, const char *lowLevelPor
static const char *functionName = "seleneController::seleneController";
createParam(MotorSetPositionString, asynParamFloat64, &setMotorPosition_);
callParamCallbacks();
}
}
pmacV3Controller::pmacV3Controller(const char *portName,
const char *lowLevelPortName,
int lowLevelPortAddress, int numAxes,
double movingPollPeriod,
double idlePollPeriod,
const int &extraParams){
pmacController(portName, lowLevelPortName, lowLevelPortAddress, numAxes,
movingPollPeriod, idlePollPeriod, extraParams);
const int &extraParams) :
pmacController(portName, lowLevelPortName, lowLevelPortAddress, numAxes, movingPollPeriod, idlePollPeriod, extraParams) {
static const char *functionName = "pmacV3Controller::pmacV3Controller";
createParam(EnableAxisString, asynParamInt32, &enableAxis_);
callParamCallbacks();
@ -697,6 +693,34 @@ asynStatus LiftCreateAxis(const char *pmacName, /* specify which control
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.
* See pmacAxis::pmacAxis.
@ -794,12 +818,14 @@ asynStatus SeleneController::writeFloat64(asynUser *pasynUser, epicsFloat64 valu
asynStatus pmacV3Controller::writeInt32(asynUser *pasynUser, epicsInt32 value) {
int function = pasynUser->reason;
asynStatus status = asynError;
pmacAxis *pAxis = NULL;
pmacV3Axis *pAxis = NULL;
char command[64] = {0};
char response[64] = {0};
static const char *functionName = "pmacV3Controller::writeInt32";
debugFlow(functionName);
pAxis = this->getAxis(pasynUser);
pAxis = (pmacV3Axis*)this->getAxis(pasynUser);
if (!pAxis) {
return asynError;
}
@ -947,10 +973,12 @@ static void pmacControllerRegister(void)
{
iocshRegister(&configpmacCreateController, configpmacCreateControllerCallFunc);
iocshRegister(&configSeleneCreateController, configSeleneCreateControllerCallFunc);
iocshRegister(&configpmacV3CreateController, configpmacV3CreateControllerCallFunc);
iocshRegister(&configpmacAxis, configpmacAxisCallFunc);
iocshRegister(&configpmacHRPTAxis, configpmacHRPTAxisCallFunc);
iocshRegister(&configSeleneCreateAxis, configSeleneCreateAxisCallFunc);
iocshRegister(&configLiftAxis, configLiftAxisCallFunc);
iocshRegister(&configpmacV3Axis, configpmacV3AxisCallFunc);
iocshRegister(&configpmacAxes, configpmacAxesCallFunc);
}
epicsExportRegistrar(pmacControllerRegister);