From 1409d6323f5694ebda27aadc4be690c86a1ec377 Mon Sep 17 00:00:00 2001 From: mp49 Date: Thu, 18 Jul 2013 19:59:06 +0000 Subject: [PATCH] XPSController and XPSAxis: moved some defines from the source file to the header file in XPSController. Added support for reading the XPS positioner status string in XPSAxis, and adding it to the parameter library. --- motorApp/NewportSrc/XPSAxis.cpp | 13 ++++++++++--- motorApp/NewportSrc/XPSController.cpp | 7 +------ motorApp/NewportSrc/XPSController.h | 8 ++++++++ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/motorApp/NewportSrc/XPSAxis.cpp b/motorApp/NewportSrc/XPSAxis.cpp index 17f970b2..3004ea01 100644 --- a/motorApp/NewportSrc/XPSAxis.cpp +++ b/motorApp/NewportSrc/XPSAxis.cpp @@ -556,11 +556,17 @@ asynStatus XPSAxis::poll(bool *moving) { int status; char readResponse[25]; + char statusString[MAX_MESSAGE_LEN] = {0}; static const char *functionName = "poll"; status = GroupStatusGet(pollSocket_, groupName_, &axisStatus_); + if (!status) { + status = GroupStatusStringGet(pollSocket_, + axisStatus_, + statusString); + } if (status) { asynPrint(pasynUser_, ASYN_TRACE_ERROR, "%s:%s: [%s,%d]: error calling GroupStatusGet status=%d\n", @@ -568,11 +574,12 @@ asynStatus XPSAxis::poll(bool *moving) goto done; } asynPrint(pasynUser_, ASYN_TRACE_FLOW, - "%s:%s: [%s,%d]: %s axisStatus=%d\n", - driverName, functionName, pC_->portName, axisNo_, positionerName_, axisStatus_); + "%s:%s: [%s,%d]: %s axisStatus=%d, statusString=%s\n", + driverName, functionName, pC_->portName, axisNo_, positionerName_, axisStatus_, statusString); /* Set the status */ setIntegerParam(pC_->XPSStatus_, axisStatus_); - + setStringParam(pC_->XPSStatusString_, statusString); + /* Previously we set the motion done flag by seeing if axisStatus_ was >=43 && <= 48, which means moving, * homing, jogging, etc. However, this information is about the group, not the axis, so if one * motor in the group was moving, then they all appeared to be moving. This is not what we want, because diff --git a/motorApp/NewportSrc/XPSController.cpp b/motorApp/NewportSrc/XPSController.cpp index c678132e..75586902 100644 --- a/motorApp/NewportSrc/XPSController.cpp +++ b/motorApp/NewportSrc/XPSController.cpp @@ -116,12 +116,6 @@ const static CorrectorTypes_t CorrectorTypes = { "NoCorrector" }; -/* Constants used for FTP to the XPS */ -#define TRAJECTORY_DIRECTORY "/Admin/Public/Trajectories" -#define MAX_FILENAME_LEN 256 -#define MAX_MESSAGE_LEN 256 -#define MAX_GROUPNAME_LEN 64 - /* The maximum size of the item names in gathering, e.g. "GROUP2.POSITIONER1.CurrentPosition" */ #define MAX_GATHERING_AXIS_STRING 60 /* Number of items per axis */ @@ -169,6 +163,7 @@ XPSController::XPSController(const char *portName, const char *IPAddress, int IP createParam(XPSProfileGroupNameString, asynParamOctet, &XPSProfileGroupName_); createParam(XPSTrajectoryFileString, asynParamOctet, &XPSTrajectoryFile_); createParam(XPSStatusString, asynParamInt32, &XPSStatus_); + createParam(XPSStatusStringString, asynParamOctet, &XPSStatusString_); createParam(XPSTclScriptString, asynParamOctet, &XPSTclScript_); createParam(XPSTclScriptExecuteString, asynParamInt32, &XPSTclScriptExecute_); diff --git a/motorApp/NewportSrc/XPSController.h b/motorApp/NewportSrc/XPSController.h index a74023cd..2b1533e9 100644 --- a/motorApp/NewportSrc/XPSController.h +++ b/motorApp/NewportSrc/XPSController.h @@ -15,6 +15,12 @@ USAGE... Newport XPS EPICS asyn motor device driver #define XPS_MOVE_TIMEOUT 100000.0 // "Forever" #define XPS_MIN_PROFILE_ACCEL_TIME 0.25 +/* Constants used for FTP to the XPS */ +#define TRAJECTORY_DIRECTORY "/Admin/Public/Trajectories" +#define MAX_FILENAME_LEN 256 +#define MAX_MESSAGE_LEN 256 +#define MAX_GROUPNAME_LEN 64 + // drvInfo strings for extra parameters that the XPS controller supports #define XPSMinJerkString "XPS_MIN_JERK" #define XPSMaxJerkString "XPS_MAX_JERK" @@ -25,6 +31,7 @@ USAGE... Newport XPS EPICS asyn motor device driver #define XPSProfileGroupNameString "XPS_PROFILE_GROUP_NAME" #define XPSTrajectoryFileString "XPS_TRAJECTORY_FILE" #define XPSStatusString "XPS_STATUS" +#define XPSStatusStringString "XPS_STATUS_STRING" #define XPSTclScriptString "XPS_TCL_SCRIPT" #define XPSTclScriptExecuteString "XPS_TCL_SCRIPT_EXECUTE" @@ -81,6 +88,7 @@ class XPSController : public asynMotorController { int XPSProfileGroupName_; int XPSTrajectoryFile_; int XPSStatus_; + int XPSStatusString_; int XPSTclScript_; int XPSTclScriptExecute_; #define LAST_XPS_PARAM XPSTclScriptExecute_