From 1918b8c682be9bf998e2ef8b0a8720b598c3053e Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Thu, 18 Jun 2009 19:30:56 +0000 Subject: [PATCH] Matthew Pearson's fix for record seeing motorAxisDone True on 1st status update after a move. --- motorApp/AttocubeSrc/drvANC150Asyn.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/motorApp/AttocubeSrc/drvANC150Asyn.cc b/motorApp/AttocubeSrc/drvANC150Asyn.cc index fef48b3e..c1ca8078 100644 --- a/motorApp/AttocubeSrc/drvANC150Asyn.cc +++ b/motorApp/AttocubeSrc/drvANC150Asyn.cc @@ -3,9 +3,9 @@ FILENAME... drvANC150Asyn.cc USAGE... asyn motor driver support for attocube systems AG ANC150 Piezo Step Controller. -Version: $Revision: 1.7 $ +Version: $Revision: 1.8 $ Modified By: $Author: sluiter $ -Last Modified: $Date: 2009-02-18 21:39:00 $ +Last Modified: $Date: 2009-06-18 19:30:56 $ */ @@ -48,6 +48,11 @@ Last Modified: $Date: 2009-02-18 21:39:00 $ * .04 02-18-09 rls Copied Matthew Pearson's (Diamond) fix on XPS for; * - idle polling interfering with setting position. * - auto save/restore not working. + * .05 06-11-09 rls - Matthew Pearson's fix for record seeing motorAxisDone True + * on 1st status update after a move; set motorAxisDone False + * in motorAxisDrvSET_t functions that start motion + * (motorAxisHome, motorAxisMove, motorAxisVelocityMove) and + * force a status update with a call to callCallback(). * */ @@ -295,7 +300,6 @@ static int motorAxisSetCallback(AXIS_HDL pAxis, motorAxisCallbackFunc callback, static int motorAxisSetDouble(AXIS_HDL pAxis, motorAxisParam_t function, double value) { int ret_status = MOTOR_AXIS_ERROR; - int status; if (pAxis == NULL) return(MOTOR_AXIS_ERROR); @@ -443,8 +447,16 @@ static int motorAxisMove(AXIS_HDL pAxis, double position, int relative, if (status) return(MOTOR_AXIS_ERROR); - /* Set direction indicator. */ - motorParam->setInteger(pAxis->params, motorAxisDirection, posdir); + if (epicsMutexLock(pAxis->mutexId) == epicsMutexLockOK) + { + /* Set direction indicator. */ + motorParam->setInteger(pAxis->params, motorAxisDirection, posdir); + + /* Insure that the motor record's next status update sees motorAxisDone = False. */ + motorParam->setInteger(pAxis->params, motorAxisDone, 0); + motorParam->callCallback(pAxis->params); + epicsMutexUnlock(pAxis->mutexId); + } /* Send a signal to the poller task which will make it do a poll, and switch to the moving poll rate. */