diff --git a/motorApp/MotorSrc/motorRecord.cc b/motorApp/MotorSrc/motorRecord.cc index 96afd97c..982f3a92 100644 --- a/motorApp/MotorSrc/motorRecord.cc +++ b/motorApp/MotorSrc/motorRecord.cc @@ -138,6 +138,8 @@ HeadURL: $URL$ * - removed depreciated RES field. * - changed MDEL/ADEL support for RBV so that record behaves * the same as before when MDEL and ADEL are zero. + * .58 04-15-10 rls - Added SYNC field to synchronize VAL/DVAL/RVAL with + * RBV/DRBV/RRBV * */ @@ -2316,6 +2318,18 @@ static RTN_STATUS do_work(motorRecord * pmr, CALLBACK_VALUE proc_ind) else SEND_MSG(); } + else if (pmr->sync != 0 && pmr->mip == MIP_DONE) + { + /* Sync target positions with readbacks. */ + pmr->val = pmr->lval = pmr->rbv; + MARK(M_VAL); + pmr->dval = pmr->ldvl = pmr->drbv; + MARK(M_DVAL); + pmr->rval = pmr->lrvl = NINT(pmr->dval / pmr->mres); + MARK(M_RVAL); + pmr->sync = 0; + } + return(OK); } diff --git a/motorApp/MotorSrc/motorRecord.dbd b/motorApp/MotorSrc/motorRecord.dbd index 618ab1f8..3ba0aaa9 100644 --- a/motorApp/MotorSrc/motorRecord.dbd +++ b/motorApp/MotorSrc/motorRecord.dbd @@ -783,4 +783,9 @@ recordtype(motor) { special(SPC_NOMOD) interest(3) } + field(SYNC,DBF_SHORT) { + prompt("Sync position") + pp(TRUE) + interest(1) + } }