Add pmacV3 poll
This commit is contained in:

committed by
brambilla_m

parent
c7fea08718
commit
14bbda3364
@ -46,6 +46,11 @@
|
||||
|
||||
#include "pmacController.h"
|
||||
|
||||
#include <typeinfo>
|
||||
template<typename T>
|
||||
const char* getClassName(T) {
|
||||
return typeid(T).name();
|
||||
}
|
||||
|
||||
#define MULT 1000.
|
||||
|
||||
@ -168,8 +173,6 @@ asynStatus pmacAxis::getAxisInitialStatus(void)
|
||||
// Enable the axis. After startup, the axis are disabled on the controller...
|
||||
// Warning: Selene lift axis should not be automatically enabled
|
||||
|
||||
printf("/nautoEnable: %d\n\n", autoEnable);
|
||||
|
||||
if (autoEnable) {
|
||||
sprintf(command, "M%2.2d14=1\n", axisNo_);
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR, "Enable axis %d: %s",axisNo_,command);
|
||||
@ -307,7 +310,7 @@ asynStatus pmacAxis::poll(bool *moving)
|
||||
pC_->debugFlow(message);
|
||||
|
||||
//Now poll axis status
|
||||
if ((status = getAxisStatus(moving)) != asynSuccess) {
|
||||
if ((status = this->getAxisStatus(moving)) != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"%s: getAxisStatus failed to return asynSuccess. Controller: %s, Axis: %d.\n", functionName, pC_->portName, axisNo_);
|
||||
}
|
||||
@ -382,7 +385,6 @@ asynStatus pmacAxis::getAxisStatus(bool *moving)
|
||||
epicsUInt32 axErr = 0, highLim = 0, lowLim= 0;
|
||||
char message[132], *axMessage;
|
||||
|
||||
|
||||
/* read our status items one by one: our PMAC does not seem to give multiple responses ..*/
|
||||
sprintf(command,"P%2.2d01",axisNo_);
|
||||
cmdStatus = pC_->lowLevelWriteRead(axisNo_,command, response);
|
||||
@ -865,6 +867,40 @@ asynStatus LiftAxis::stop(double acceleration)
|
||||
}
|
||||
/*-------------------------------------------------------------------------------------------------------------*/
|
||||
|
||||
pmacV3Axis::pmacV3Axis(pmacController *pController, int axisNo) : pmacAxis(pController,axisNo, false) { };
|
||||
|
||||
|
||||
asynStatus pmacV3Axis::poll(bool *moving)
|
||||
{
|
||||
int status = 0;
|
||||
static const char *functionName = "pmacV3Axis::poll";
|
||||
char message[132];
|
||||
|
||||
// Protect against excessive polling
|
||||
if(time(NULL) < next_poll){
|
||||
return asynSuccess;
|
||||
}
|
||||
|
||||
sprintf(message, "%s: Polling axis: %d", functionName, this->axisNo_);
|
||||
pC_->debugFlow(message);
|
||||
|
||||
//Now poll axis status
|
||||
if ((status = this->getAxisStatus(moving)) != asynSuccess) {
|
||||
asynPrint(pC_->pasynUserSelf, ASYN_TRACE_ERROR,
|
||||
"%s: getAxisStatus failed to return asynSuccess. Controller: %s, Axis: %d.\n", functionName, pC_->portName, axisNo_);
|
||||
}
|
||||
|
||||
if(*moving){
|
||||
next_poll = time(NULL) + BUSYPOLL;
|
||||
} else {
|
||||
next_poll = time(NULL) + IDLEPOLL;
|
||||
}
|
||||
|
||||
callParamCallbacks();
|
||||
return status ? asynError : asynSuccess;
|
||||
}
|
||||
|
||||
|
||||
asynStatus pmacV3Axis::getAxisStatus(bool *moving) {
|
||||
char command[pC_->PMAC_MAXBUF_];
|
||||
char response[pC_->PMAC_MAXBUF_];
|
||||
|
@ -143,8 +143,13 @@ class LiftAxis : public pmacAxis
|
||||
class pmacV3Axis : public pmacAxis {
|
||||
public:
|
||||
|
||||
pmacV3Axis(pmacController *pController, int axisNo) : pmacAxis(pController,axisNo, false) {};
|
||||
|
||||
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:
|
||||
|
||||
asynStatus getAxisStatus(bool *moving);
|
||||
|
Reference in New Issue
Block a user