From 76e4892077d42e69ff3bbeb8cb57811c30172586 Mon Sep 17 00:00:00 2001 From: MarkRivers Date: Tue, 13 Feb 2007 21:41:09 +0000 Subject: [PATCH] Force update when a motor is moved, even if poller says it is not moving --- motorApp/NewportSrc/drvXPSAsyn.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/motorApp/NewportSrc/drvXPSAsyn.c b/motorApp/NewportSrc/drvXPSAsyn.c index 026a002e..b56497ba 100644 --- a/motorApp/NewportSrc/drvXPSAsyn.c +++ b/motorApp/NewportSrc/drvXPSAsyn.c @@ -433,6 +433,9 @@ static int motorAxisMove(AXIS_HDL pAxis, double position, int relative, return MOTOR_AXIS_ERROR; } } + /* Tell paramLib that the motor is moving. + * This will force a callback on the next poll, even if the poll says the motor is already done. */ + motorParam->setInteger(pAxis->params, motorAxisDone, 0); /* Send a signal to the poller task which will make it do a poll, and switch to the moving poll rate */ epicsEventSignal(pAxis->pController->pollEventId); @@ -475,6 +478,9 @@ static int motorAxisHome(AXIS_HDL pAxis, double min_velocity, double max_velocit return MOTOR_AXIS_ERROR; } + /* Tell paramLib that the motor is moving. + * This will force a callback on the next poll, even if the poll says the motor is already done. */ + motorParam->setInteger(pAxis->params, motorAxisDone, 0); /* Send a signal to the poller task which will make it do a poll, and switch to the moving poll rate */ epicsEventSignal(pAxis->pController->pollEventId); PRINT(pAxis->logParam, FLOW, "motorAxisHome: set card %d, axis %d to home\n", @@ -503,6 +509,9 @@ static int motorAxisVelocityMove(AXIS_HDL pAxis, double min_velocity, double vel status); return MOTOR_AXIS_ERROR; } + /* Tell paramLib that the motor is moving. + * This will force a callback on the next poll, even if the poll says the motor is already done. */ + motorParam->setInteger(pAxis->params, motorAxisDone, 0); /* Send a signal to the poller task which will make it do a poll, and switch to the moving poll rate */ epicsEventSignal(pAxis->pController->pollEventId); PRINT(pAxis->logParam, FLOW, "motorAxisVelocityMove card %d, axis %d move velocity=%f, accel=%f\n", @@ -796,9 +805,10 @@ int XPSConfig(int card, /* Controller number */ } /* Set the poll rate on the moveSocket to a negative number, which means that SendAndReceive should do only a write, no read */ TCP_SetTimeout(pAxis->moveSocket, -0.1); - printf("XPSConfig: pollSocket=%d, moveSocket=%d, ip=%s, port=%d," - " axis=%d controller=%d\n", - pAxis->pollSocket, pAxis->moveSocket, ip, port, axis, card); + /* printf("XPSConfig: pollSocket=%d, moveSocket=%d, ip=%s, port=%d," + * " axis=%d controller=%d\n", + * pAxis->pollSocket, pAxis->moveSocket, ip, port, axis, card); + */ pAxis->params = motorParam->create(0, MOTOR_AXIS_NUM_PARAMS + XPS_NUM_PARAMS); }