Get initial values from the motor controller to avoid move to zero at startup

This commit is contained in:
Peter Denison
2006-04-19 12:56:35 +00:00
parent a22a5b0a8b
commit ea31f13f13
3 changed files with 21 additions and 6 deletions
+1
View File
@@ -24,6 +24,7 @@ motor_SRCS += devMotorAsyn.c
motor_SRCS += paramLib.c
motor_SRCS += motorUtil.cc motorUtilAux.cc
motor_LIBS += asyn
motor_LIBS += $(EPICS_BASE_IOC_LIBS)
include $(TOP)/configure/RULES
+17 -4
View File
@@ -189,6 +189,22 @@ static long init_record(struct motorRecord * pmr )
pmr->name,pPvt->pasynUser->errorMessage);
}
/* Initiate calls to get the initial motor parameters
Have to do it the long-winded way, because before iocInit, none of the
locks or scan queues are initialised, so calls to scanOnce(),
dbScanLock() etc will fail. */
pasynUser = pasynManager->duplicateAsynUser(pPvt->pasynUser, asynCallback, 0);
pasynUser->reason = motorStatus;
pPvt->pasynInt32->read(pPvt->asynInt32Pvt, pasynUser,
&pPvt->status);
pasynUser->reason = motorPosition;
pPvt->pasynInt32->read(pPvt->asynInt32Pvt, pasynUser,
&pPvt->position);
pasynUser->reason = motorEncoderPosition;
pPvt->pasynInt32->read(pPvt->asynInt32Pvt, pasynUser,
&pPvt->encoder_position);
pasynManager->freeAsynUser(pasynUser);
/* Send the motor resolution to the driver. This should be done in the record
* in the future */
resolution = pmr->mres;
@@ -382,7 +398,6 @@ static void asynCallback(asynUser *pasynUser)
motorAsynPvt *pPvt = (motorAsynPvt *)pasynUser->userPvt;
motorRecord *pmr = pPvt->pmr;
motorAsynMessage *pmsg = pasynUser->userData;
rset *prset = (rset *)pmr->rset;
int status;
asynPrint(pasynUser, ASYN_TRACE_FLOW,
@@ -401,9 +416,7 @@ static void asynCallback(asynUser *pasynUser)
pasynUser->reason = motorEncoderPosition;
pPvt->pasynInt32->read(pPvt->asynInt32Pvt, pasynUser,
&pPvt->encoder_position);
dbScanLock((dbCommon *)pmr);
(*prset->process)(pmr);
dbScanUnlock((dbCommon *)pmr);
scanOnce(pmr);
break;
default:
+3 -2
View File
@@ -513,12 +513,13 @@ static void intCallback(void *axisPvt, unsigned int nChanged,
{
drvmotorAxisPvt *pAxis = (drvmotorAxisPvt *)axisPvt;
drvmotorPvt *pPvt = pAxis->pPvt;
int addr, reason;
int addr;
unsigned int reason;
ELLLIST *pclientList;
interruptNode *pnode;
int ivalue;
double dvalue;
int i, bit_num;
unsigned int i, bit_num;
epicsInt32 changedmask = 0;
/* We are called back with an array of things that have changed.