Inverted the priority of sync and status update in do_work().

Before this fix the SYNC field didn't work for motors with soft-channel device support.
This commit is contained in:
kmpeters
2012-04-10 22:18:12 +00:00
parent 36cbda4b1a
commit 2942e4c73f
+13 -12
View File
@@ -151,6 +151,7 @@ HeadURL: $URL$
* .62 10-20-11 rls - Disable soft travel limit error check during home search.
* - Use home velocity (HVEL), base velocity (BVEL) and accel.
* time (ACCL) fields to calculate home acceleration rate.
* .63 04-10-12 kmp - Inverted the priority of sync and status update in do_work().
*
*/
@@ -2315,6 +2316,18 @@ static RTN_STATUS do_work(motorRecord * pmr, CALLBACK_VALUE proc_ind)
}
}
}
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;
db_post_events(pmr, &pmr->sync, DBE_VAL_LOG);
}
else if (proc_ind == NOTHING_DONE && pmr->stup == motorSTUP_OFF)
{
RTN_STATUS status;
@@ -2330,18 +2343,6 @@ 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;
db_post_events(pmr, &pmr->sync, DBE_VAL_LOG);
}
return(OK);
}