From d8473b91c656e07b0c5e3a4ac4f0a7dc0eee3b2d Mon Sep 17 00:00:00 2001 From: Ron Sluiter Date: Wed, 15 Apr 2009 18:36:18 +0000 Subject: [PATCH] - Prevent moveRequestPending being left nonzero after LOAD_POS command. - Minor compiler warnings eliminated. --- motorApp/MotorSrc/devMotorAsyn.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/motorApp/MotorSrc/devMotorAsyn.c b/motorApp/MotorSrc/devMotorAsyn.c index 615e3254..38840105 100644 --- a/motorApp/MotorSrc/devMotorAsyn.c +++ b/motorApp/MotorSrc/devMotorAsyn.c @@ -11,12 +11,21 @@ * Notwithstanding the above, explicit permission is granted for APS to * redistribute this software. * - * Version: $Revision: 1.27 $ + * Version: $Revision: 1.28 $ * Modified by: $Author: sluiter $ - * Last Modified: $Date: 2009-02-09 19:49:45 $ + * Last Modified: $Date: 2009-04-15 18:36:18 $ * * Original Author: Peter Denison * Current Author: Peter Denison + * + * Modification Log: + * ----------------- + * .01 2009-04-15 rls + * Added logic to asynCallback() to prevent moveRequestPending left nonzero + * after motor record LOAD_POS command before dbScanLockOK is true (i.e., from + * save/restore at boot-up). + * Eliminated compiler warnings. + * */ #include @@ -82,7 +91,7 @@ typedef struct struct motorRecord * pmr; int moveRequestPending; struct MotorStatus status; - motor_cmnd move_cmd; + motorCommand move_cmd; double param; int needUpdate; asynUser *pasynUser; @@ -314,7 +323,8 @@ static RTN_STATUS build_trans( motor_cmnd command, double * param, struct motorRecord * pmr ) { - RTN_STATUS status = OK; + RTN_STATUS rtnind = OK; + asynStatus status; motorAsynPvt *pPvt = (motorAsynPvt *)pmr->dpvt; asynUser *pasynUser = pPvt->pasynUser; motorAsynMessage *pmsg; @@ -432,7 +442,6 @@ static RTN_STATUS build_trans( motor_cmnd command, "devMotorAsyn::send_msg: %s: PRIMITIVE no longer supported\n", pmr->name); return(ERROR); - break; case SET_HIGH_LIMIT: pmsg->command = motorHighLim; pmsg->dvalue = *param; @@ -463,9 +472,9 @@ static RTN_STATUS build_trans( motor_cmnd command, asynPrint(pasynUser, ASYN_TRACE_ERROR, "devMotorAsyn::send_msg: %s error calling queueRequest, %s\n", pmr->name, pasynUser->errorMessage); - return(ERROR); + rtnind = ERROR; } - return(OK); + return(rtnind); } static RTN_STATUS end_trans(struct motorRecord * pmr ) @@ -542,6 +551,12 @@ static void asynCallback(asynUser *pasynUser) } dbScanUnlock((dbCommon *)pmr); } + else if (pmsg->command == motorPosition) + { + pPvt->moveRequestPending--; + if (!pPvt->moveRequestPending) + dbProcess((dbCommon*)pmr); + } pasynManager->memFree(pmsg, sizeof(*pmsg)); status = pasynManager->freeAsynUser(pasynUser);