From 807d8c1d980b596555dc2a8e737b465aa6ffad55 Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Wed, 2 Jan 2013 22:51:49 +0000 Subject: [PATCH] Support for motor record raw actual velocity (RVEL). --- motorApp/MotorSrc/devMotorAsyn.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/motorApp/MotorSrc/devMotorAsyn.c b/motorApp/MotorSrc/devMotorAsyn.c index 431fd29f..da12689c 100644 --- a/motorApp/MotorSrc/devMotorAsyn.c +++ b/motorApp/MotorSrc/devMotorAsyn.c @@ -30,6 +30,10 @@ * Fix for motor simulator stuck in Moving state after multiple LOAD_POS * commands to the same position; set needUpdate = 1 in asynCallback() before * dbProcess. + * + * .03 2013-01-02 rls + * Support for motor record raw actual velocity (RVEL). + * */ #include @@ -46,6 +50,7 @@ #include #include #include /* !! for callocMustSucceed() */ +#include #include #include @@ -393,10 +398,18 @@ CALLBACK_VALUE update_values(struct motorRecord * pmr) "%s devMotorAsyn::update_values, needUpdate=%d\n", pmr->name, pPvt->needUpdate); if ( pPvt->needUpdate ) { + epicsInt32 rawvel; pmr->rmp = (epicsInt32)floor(pPvt->status.position + 0.5); pmr->rep = (epicsInt32)floor(pPvt->status.encoderPosition + 0.5); /* pmr->rvel = (epicsInt32)round(pPvt->status.velocity); */ pmr->msta = pPvt->status.status; + rawvel = (epicsInt32)floor(pPvt->status.velocity); + if (pmr->rvel != rawvel) + { + pmr->rvel = rawvel; + db_post_events(pmr, &pmr->rvel, DBE_VAL_LOG); + } + rc = CALLBACK_DATA; pPvt->needUpdate = 0; }