From a8339b01bf91341639a3f1cb5e0ddbc2cdae1583 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Tue, 5 Apr 2011 02:01:19 +0000 Subject: [PATCH] Remove global variables for setPosSleepTime and doSetPosition; now variables in XPSController class, can be set by iocsh calls --- motorApp/NewportSrc/XPSAxis.cpp | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/motorApp/NewportSrc/XPSAxis.cpp b/motorApp/NewportSrc/XPSAxis.cpp index e92c6ab1..ff46c395 100644 --- a/motorApp/NewportSrc/XPSAxis.cpp +++ b/motorApp/NewportSrc/XPSAxis.cpp @@ -94,6 +94,11 @@ Versions: Release 4-5 and higher. #include "XPSController.h" #include "XPS_C8_drivers.h" +#define XPSC8_END_OF_RUN_MINUS 0x80000100 +#define XPSC8_END_OF_RUN_PLUS 0x80000200 +/** Deadband to use for the velocity comparison with zero. */ +#define XPS_VELOCITY_DEADBAND 0.0000001 + static const char *driverName = "XPSAxis"; typedef enum { none, positionMove, velocityMove, homeReverseMove, homeForwardsMove } moveType; @@ -115,27 +120,6 @@ const static CorrectorTypes_t CorrectorTypes = { "NoCorrector" }; -/** This is controlled via the XPSEnableSetPosition function (available via the IOC shell). */ -static int doSetPosition = 1; - -/** - * Parameter to control the sleep time used when setting position. - * A function called XPSSetPosSleepTime(int) (millisec parameter) - * is available in the IOC shell to control this. - */ -static double setPosSleepTime = 0.5; - -/** Deadband to use for the velocity comparison with zero. */ -#define XPS_VELOCITY_DEADBAND 0.0000001 - -#define XPS_MAX_AXES 8 -#define XPSC8_END_OF_RUN_MINUS 0x80000100 -#define XPSC8_END_OF_RUN_PLUS 0x80000200 - -#define TCP_TIMEOUT 2.0 -#define MAX(a,b) ((a)>(b)? (a): (b)) -#define MIN(a,b) ((a)<(b)? (a): (b)) - extern "C" void shutdownCallback(void *pPvt) { XPSController *pC = static_cast(pPvt); @@ -372,7 +356,7 @@ asynStatus XPSAxis::setPosition(double position) /* If the user has disabled setting the controller position, skip this.*/ - if (!doSetPosition) { + if (!pC_->enableSetPosition_) { asynPrint(pasynUser_, ASYN_TRACE_ERROR, "%s:%s: XPS set position is disabled. Enable it using XPSEnableSetPosition(1).\n", driverName, functionName); @@ -409,7 +393,7 @@ asynStatus XPSAxis::setPosition(double position) /* Wait after axis initialisation (we don't want to set position immediately after * initialisation because the stage can oscillate slightly). */ - epicsThreadSleep(setPosSleepTime); + epicsThreadSleep(pC_->setPositionSettlingTime_); status = GroupReferencingStart(pollSocket_, groupName_); axisIndexInGrp = 0; @@ -456,7 +440,7 @@ asynStatus XPSAxis::setPosition(double position) /* Wait after axis initialisation (we don't want to set position immediately after initialisation because the stage can oscillate slightly).*/ - epicsThreadSleep(setPosSleepTime); + epicsThreadSleep(pC_->setPositionSettlingTime_); status = GroupReferencingStart(pollSocket_, groupName_);