diff --git a/motorApp/Db/HXP_extra.db b/motorApp/Db/HXP_extra.db index d9d273e9..0a159a48 100644 --- a/motorApp/Db/HXP_extra.db +++ b/motorApp/Db/HXP_extra.db @@ -1,7 +1,7 @@ grecord(mbbo,"$(P)$(R)CS") { field(DESC,"Coordinate System") field(DTYP, "asynInt32") - field(OUT,"@asynMask($(PORT) $(CHAN) 0xFFFF)HXP_MOVE_COORD_SYS") + field(OUT,"@asynMask($(PORT) 0 0xFFFF)HXP_MOVE_COORD_SYS") field(ZRVL,"0") field(ZRST,"Work") field(ONVL,"1") @@ -16,5 +16,14 @@ grecord(ai,"$(P)$(R)STATUS") { field(PINI, "1") field(PREC,"0") field(SCAN, "I/O Intr") - field(INP,"@asyn($(PORT),$(CHAN))HXP_STATUS") + field(INP,"@asyn($(PORT),0)HXP_STATUS") +} + +grecord(ai,"$(P)$(R)ERROR") { + field(DESC,"HXP Group Error") + field(DTYP, "asynInt32") + field(PINI, "1") + field(PREC,"0") + field(SCAN, "I/O Intr") + field(INP,"@asyn($(PORT),0)HXP_ERROR") } diff --git a/motorApp/NewportSrc/HXPDriver.cpp b/motorApp/NewportSrc/HXPDriver.cpp index 65df832c..cd52a28d 100644 --- a/motorApp/NewportSrc/HXPDriver.cpp +++ b/motorApp/NewportSrc/HXPDriver.cpp @@ -25,7 +25,6 @@ Note: This driver was tested with the v1.3.x of the firmware #define NINT(f) (int)((f)>0 ? (f)+0.5 : (f)-0.5) #define NUM_AXES 6 #define GROUP "HEXAPOD" -#define CS "Work" #define MRES 0.00001 static const char *driverName = "HXPDriver"; @@ -57,6 +56,7 @@ HXPController::HXPController(const char *portName, const char *IPAddress, int IP createParam(HXPMoveCoordSysString, asynParamInt32, &HXPMoveCoordSys_); createParam(HXPStatusString, asynParamInt32, &HXPStatus_); + createParam(HXPErrorString, asynParamInt32, &HXPError_); // This socket is used for polling by the controller and all axes pollSocket_ = HXPTCP_ConnectToServer((char *)IPAddress, IPPort, HXP_POLL_TIMEOUT); @@ -189,6 +189,7 @@ asynStatus HXPAxis::move(double position, int relative, double baseVelocity, dou double *pos; int coordSys; // 0 = work, 1 = tool static const char *functionName = "HXPAxis::move"; + asynStatus retval = asynSuccess; pC_->getIntegerParam(pC_->HXPMoveCoordSys_, &coordSys); @@ -210,7 +211,7 @@ asynStatus HXPAxis::move(double position, int relative, double baseVelocity, dou "%s:%s: Error performing HexapodMoveIncremental[%s,%d] %d\n", driverName, functionName, pC_->portName, axisNo_, status); /* Error -27 is caused when the motor record changes dir i.e. when it aborts a move! */ - return asynError; + retval = asynError; } } else { // get current positions before moving (could an error overflow the array?) @@ -247,11 +248,24 @@ asynStatus HXPAxis::move(double position, int relative, double baseVelocity, dou "%s:%s: Error performing HexapodMoveAbsolute[%s,%d] %d\n", driverName, functionName, pC_->portName, axisNo_, status); /* Error -27 is caused when the motor record changes dir i.e. when it aborts a move! */ - return asynError; + retval = asynError; } } - return asynSuccess; + if (status < 0) + { + /* Set the error */ + pC_->setIntegerParam(pC_->HXPError_, status); + } + else + { + /* Clear the error */ + pC_->setIntegerParam(pC_->HXPError_, 0); + } + callParamCallbacks(); + + return retval; + } asynStatus HXPAxis::home(double baseVelocity, double slewVelocity, double acceleration, int forwards) diff --git a/motorApp/NewportSrc/HXPDriver.h b/motorApp/NewportSrc/HXPDriver.h index 9f253d85..5be5eb7e 100644 --- a/motorApp/NewportSrc/HXPDriver.h +++ b/motorApp/NewportSrc/HXPDriver.h @@ -14,6 +14,7 @@ USAGE... Motor driver support for the Newport Hexapod controller. // drvInfo strings for extra parameters that the HXP controller supports #define HXPMoveCoordSysString "HXP_MOVE_COORD_SYS" #define HXPStatusString "HXP_STATUS" +#define HXPErrorString "HXP_ERROR" class HXPAxis : public asynMotorAxis { @@ -54,7 +55,8 @@ protected: #define FIRST_HXP_PARAM HXPMoveCoordSys_ int HXPMoveCoordSys_; int HXPStatus_; - #define LAST_HXP_PARAM HXPStatus_ + int HXPError_; + #define LAST_HXP_PARAM HXPError_ #define NUM_HXP_PARAMS ((int) (&LAST_HXP_PARAM - &FIRST_HXP_PARAM + 1))