From c54e52644ba08de5fdde9798a615bec3a3f881da Mon Sep 17 00:00:00 2001 From: Peter Denison Date: Wed, 6 Sep 2006 12:27:47 +0000 Subject: [PATCH] Oops - copy structures explicitly instead of relying on gcc extension Changed round function to floor(x+0.5) since we seem to be picking up the wrong definition of round() --- motorApp/MotorSrc/devMotorAsyn.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/motorApp/MotorSrc/devMotorAsyn.c b/motorApp/MotorSrc/devMotorAsyn.c index 5f501610..b3290286 100644 --- a/motorApp/MotorSrc/devMotorAsyn.c +++ b/motorApp/MotorSrc/devMotorAsyn.c @@ -11,9 +11,9 @@ * Notwithstanding the above, explicit permission is granted for APS to * redistribute this software. * - * Version: $Revision: 1.13 $ + * Version: $Revision: 1.14 $ * Modified by: $Author: peterd $ - * Last Modified: $Date: 2006-08-10 08:12:47 $ + * Last Modified: $Date: 2006-09-06 12:27:47 $ * * Original Author: Peter Denison * Current Author: Peter Denison @@ -235,8 +235,8 @@ CALLBACK_VALUE update_values(struct motorRecord * pmr) rc = NOTHING_DONE; if ( pPvt->needUpdate ) { - pmr->rmp = (epicsInt32)round(pPvt->status.position); - pmr->rep = (epicsInt32)round(pPvt->status.encoder_posn); + pmr->rmp = (epicsInt32)floor(pPvt->status.position + 0.5); + pmr->rep = (epicsInt32)floor(pPvt->status.encoder_posn + 0.5); /* pmr->rvel = (epicsInt32)round(pPvt->status.velocity); */ pmr->msta = pPvt->status.status; rc = CALLBACK_DATA; @@ -488,14 +488,14 @@ static void statusCallback(void *drvPvt, asynUser *pasynUser, if (dbScanLockOK) { dbScanLock((dbCommon *)pmr); - pPvt->status = *value; + memcpy(&pPvt->status, value, sizeof(struct MotorStatus)); if (!pPvt->needUpdate && !pPvt->moveRequestPending) { pPvt->needUpdate = 1; pmr->rset->process((dbCommon*)pmr); } dbScanUnlock((dbCommon*)pmr); } else { - pPvt->status = *value; + memcpy(&pPvt->status, value, sizeof(struct MotorStatus)); pPvt->needUpdate = 1; } }