From d5e994aa39c0e658923d20988b6b6466bf3939ea Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Wed, 18 Feb 2009 21:39:40 +0000 Subject: [PATCH] Matthew Pearson's (Diamond) "set position" fix. --- motorApp/AttocubeSrc/drvANC150Asyn.cc | 17 +++++++++++++---- motorApp/MotorSimSrc/drvMotorSim.c | 18 ++++++++++++------ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/motorApp/AttocubeSrc/drvANC150Asyn.cc b/motorApp/AttocubeSrc/drvANC150Asyn.cc index e6b59fca..fef48b3e 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.6 $ +Version: $Revision: 1.7 $ Modified By: $Author: sluiter $ -Last Modified: $Date: 2008-11-24 22:25:32 $ +Last Modified: $Date: 2009-02-18 21:39:00 $ */ @@ -45,6 +45,10 @@ Last Modified: $Date: 2008-11-24 22:25:32 $ * - support enable/disable "torque". * - zero move bug fix. * - set firmwareVersion. + * .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. + * */ @@ -297,6 +301,7 @@ static int motorAxisSetDouble(AXIS_HDL pAxis, motorAxisParam_t function, double return(MOTOR_AXIS_ERROR); else { + epicsMutexLock(pAxis->mutexId); switch (function) { case motorAxisPosition: @@ -342,9 +347,13 @@ static int motorAxisSetDouble(AXIS_HDL pAxis, motorAxisParam_t function, double "motorAxisSetDouble: unknown function %d\n", function); break; } + if (ret_status == MOTOR_AXIS_OK ) + { + motorParam->setDouble(pAxis->params, function, value); + motorParam->callCallback(pAxis->params); + } + epicsMutexUnlock(pAxis->mutexId); } - if (ret_status != MOTOR_AXIS_ERROR) - status = motorParam->setDouble(pAxis->params, function, value); return(ret_status); } diff --git a/motorApp/MotorSimSrc/drvMotorSim.c b/motorApp/MotorSimSrc/drvMotorSim.c index f78282e2..a726a010 100644 --- a/motorApp/MotorSimSrc/drvMotorSim.c +++ b/motorApp/MotorSimSrc/drvMotorSim.c @@ -2,9 +2,9 @@ FILENAME... drvMotorSim.c USAGE... Simulated Motor Support. -Version: $Revision: 1.8 $ -Modified By: $Author: mp49 $ -Last Modified: $Date: 2008-11-28 17:36:59 $ +Version: $Revision: 1.9 $ +Modified By: $Author: sluiter $ +Last Modified: $Date: 2009-02-18 21:39:40 $ */ /* @@ -12,7 +12,8 @@ Last Modified: $Date: 2008-11-28 17:36:59 $ * * Modification Log: * ----------------- - * 20060506 npr Added prolog + * 2006-05-06 npr Added prolog + * 2009-02-11 rls lock/unlock motorAxisSetDouble(). */ #include @@ -226,6 +227,7 @@ static int motorAxisSetDouble( AXIS_HDL pAxis, motorAxisParam_t function, double if (pAxis == NULL) return MOTOR_AXIS_ERROR; else { + epicsMutexLock(pAxis->axisMutex); switch (function) { case motorAxisPosition: @@ -278,8 +280,12 @@ static int motorAxisSetDouble( AXIS_HDL pAxis, motorAxisParam_t function, double status = MOTOR_AXIS_ERROR; break; } - - if (status != MOTOR_AXIS_ERROR ) status = motorParam->setDouble( pAxis->params, function, value ); + if (status == MOTOR_AXIS_OK ) + { + motorParam->setDouble(pAxis->params, function, value); + motorParam->callCallback(pAxis->params); + } + epicsMutexUnlock(pAxis->axisMutex); } return status; }