forked from epics_driver_modules/motorBase
Change initialisation order so that autosave is actually dependent on the
values read back from the controller for asyn motors.
This commit is contained in:
@@ -11,9 +11,9 @@
|
||||
* Notwithstanding the above, explicit permission is granted for APS to
|
||||
* redistribute this software.
|
||||
*
|
||||
* Version: $Revision: 1.22 $
|
||||
* Modified by: $Author: sluiter $
|
||||
* Last Modified: $Date: 2008-04-02 19:47:23 $
|
||||
* Version: $Revision: 1.23 $
|
||||
* Modified by: $Author: peterd $
|
||||
* Last Modified: $Date: 2008-05-19 15:56:01 $
|
||||
*
|
||||
* Original Author: Peter Denison
|
||||
* Current Author: Peter Denison
|
||||
@@ -108,7 +108,7 @@ static long init( int after )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void init_controller(struct motorRecord *pmr )
|
||||
static void init_controller(struct motorRecord *pmr, asynUser *pasynUser )
|
||||
{
|
||||
/* This routine is copied out of the old motordevCom and initialises the controller
|
||||
based on the record values. I think most of it should be transferred to init_record
|
||||
@@ -128,6 +128,10 @@ static void init_controller(struct motorRecord *pmr )
|
||||
build_trans(LOAD_POS, &setPos, pmr);
|
||||
end_trans(pmr);
|
||||
|
||||
asynPrint(pasynUser, ASYN_TRACE_FLOW,
|
||||
"devMotorAsyn::init_controller, %s set position to %f\n",
|
||||
pmr->name, setPos );
|
||||
|
||||
if ( initEvent )
|
||||
{
|
||||
epicsEventMustWait(initEvent);
|
||||
@@ -135,6 +139,11 @@ static void init_controller(struct motorRecord *pmr )
|
||||
pPvt->initEvent = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
asynPrint(pasynUser, ASYN_TRACE_FLOW,
|
||||
"devMotorAsyn::init_controller, %s setting of position not required, position=%f, mres=%f, dval=%f, rdbd=%f",
|
||||
pmr->name, position, pmr->mres, pmr->dval, rdbd );
|
||||
|
||||
}
|
||||
|
||||
static long init_record(struct motorRecord * pmr )
|
||||
@@ -231,12 +240,6 @@ static long init_record(struct motorRecord * pmr )
|
||||
pmr->name, pasynUser->errorMessage);
|
||||
}
|
||||
|
||||
/* Once everything is set-up, we can do the initial setting of position.
|
||||
This should be the first thing that pushes onto the Asyn queue.
|
||||
It needs to be done before we get the initial values back from the
|
||||
controller.*/
|
||||
init_controller(pmr);
|
||||
|
||||
/* 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(),
|
||||
@@ -259,6 +262,17 @@ static long init_record(struct motorRecord * pmr )
|
||||
"%s devMotorAsyn.c::init_record: pasynMotorStatus->read "
|
||||
"returned %s", pmr->name, pasynUser->errorMessage);
|
||||
}
|
||||
|
||||
/* We must get the first set of status values from the controller before
|
||||
* the initial setting of position. Otherwise we won't be able to decide
|
||||
* whether or not to write new position values to the controller.
|
||||
*/
|
||||
init_controller(pmr, pasynUser);
|
||||
/* Do not need to manually retrieve the new status values, as if they are
|
||||
* set, a callback will be generated
|
||||
*/
|
||||
|
||||
/* Finally, indicate to the motor record that these values can be used. */
|
||||
pasynManager->freeAsynUser(pasynUser);
|
||||
pPvt->needUpdate = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user