From aa1e0c27641f970084a67f2dbeb5c2e96a13d8fe Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Wed, 12 Jul 2006 20:23:56 +0000 Subject: [PATCH] Added read of current limit values before setting. Otherwise could never set if one was currently invalid --- motorApp/NewportSrc/drvXPSAsyn.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/motorApp/NewportSrc/drvXPSAsyn.c b/motorApp/NewportSrc/drvXPSAsyn.c index 85b8bf13..8eae0a58 100644 --- a/motorApp/NewportSrc/drvXPSAsyn.c +++ b/motorApp/NewportSrc/drvXPSAsyn.c @@ -251,6 +251,14 @@ static int motorAxisSetDouble(AXIS_HDL pAxis, motorAxisParam_t function, double case motorAxisLowLimit: { deviceValue = value*pAxis->stepSize; + /* We need to read the current highLimit because otherwise we could be setting it to an invalid value */ + status = PositionerUserTravelLimitsGet(pAxis->pollSocket, + pAxis->positionerName, + &pAxis->lowLimit, &pAxis->highLimit); + if (status != 0) { + PRINT(pAxis->logParam, ERROR, "motorAxisSetDouble: error performing PositionerUserTravelLimitsGet " + "for high limit=%f, status=%d\n", deviceValue, status); + } status = PositionerUserTravelLimitsSet(pAxis->pollSocket, pAxis->positionerName, deviceValue, pAxis->highLimit); @@ -267,6 +275,14 @@ static int motorAxisSetDouble(AXIS_HDL pAxis, motorAxisParam_t function, double case motorAxisHighLimit: { deviceValue = value*pAxis->stepSize; + /* We need to read the current highLimit because otherwise we could be setting it to an invalid value */ + status = PositionerUserTravelLimitsGet(pAxis->pollSocket, + pAxis->positionerName, + &pAxis->lowLimit, &pAxis->highLimit); + if (status != 0) { + PRINT(pAxis->logParam, ERROR, "motorAxisSetDouble: error performing PositionerUserTravelLimitsGet " + "for high limit=%f, status=%d\n", deviceValue, status); + } status = PositionerUserTravelLimitsSet(pAxis->pollSocket, pAxis->positionerName, pAxis->lowLimit, deviceValue);