From ea063f5f7387008c5d72bcf30011049730eca477 Mon Sep 17 00:00:00 2001 From: Peter Denison Date: Tue, 29 Apr 2008 15:45:00 +0000 Subject: [PATCH] Support externally initiated moves * When processing, if moving and DMOV true then set DMOV false, set post-process true (so that at the end of the move, the VAL/DVAL will be updated) and set the internal state to a new MIP_EXTERNAL. --- motorApp/MotorSrc/motorRecord.cc | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc index 4fbe189a..b7e85601 100644 --- a/motorApp/MotorSrc/motorRecord.cc +++ b/motorApp/MotorSrc/motorRecord.cc @@ -2,9 +2,9 @@ FILENAME... motorRecord.cc USAGE... Motor Record Support. -Version: $Revision: 1.45 $ -Modified By: $Author: sluiter $ -Last Modified: $Date: 2008-03-26 15:59:22 $ +Version: $Revision: 1.46 $ +Modified By: $Author: peterd $ +Last Modified: $Date: 2008-04-29 15:45:00 $ */ /* @@ -225,6 +225,7 @@ fields. ('pmr' is a pointer to motorRecord.) #define MIP_JOG_REQ 0x1000 /* Jog Request. */ #define MIP_JOG_STOP 0x2000 /* Stop jogging. */ #define MIP_JOG_BL2 0x4000 /* 2nd phase take out backlash. */ +#define MIP_EXTERNAL 0x8000 /* Move started by external source */ /******************************************************************************* Support for keeping track of which record fields have been changed, so we can @@ -1002,6 +1003,7 @@ LOGIC: Set process reason indicator to CALLBACK_DATA. Call process_motor_info(). IF motor-in-motion indicator (MOVN) is true. + Set the Done Moving field (DMOV) FALSE, and mark it as changed, if not already IF new target position in opposite direction of current motion. [Sign of RDIF is NOT the same as sign of CDIR], AND, [Dist. to target {DIFF} > (NTMF x (|BDST| + RDBD)], AND, @@ -1129,6 +1131,18 @@ static long process(dbCommon *arg) int sign_rdif = (pmr->rdif < 0) ? 0 : 1; double ntm_deadband = pmr->ntmf * (fabs(pmr->bdst) + pmr->rdbd); + /* Since other sources can now initiate motor moves (e.g. Asyn + * motors, written to by other records), make dmov track the state + * of movn (inverted). + */ + if (pmr->dmov) { + pmr->dmov = FALSE; + MARK(M_DMOV); + pmr->mip |= MIP_EXTERNAL; + MARK(M_MIP); + pmr->pp = TRUE; + } + /* Test for new target position in opposite direction of current motion. */