- New batch file management module
- New oscillator module - Bug fixes
This commit is contained in:
57
swmotor2.c
57
swmotor2.c
@ -11,6 +11,10 @@
|
||||
motor drivers.
|
||||
|
||||
Mark Koennecke, August 2003
|
||||
|
||||
Modified to do all the switching and reference running in Tcl
|
||||
|
||||
Mark Koennecke, August 2004
|
||||
--------------------------------------------------------------------------*/
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
@ -167,59 +171,6 @@ static long SWSetValue(void *pData, SConnection *pCon, float fVal)
|
||||
}
|
||||
self->selectedMotor[0] = self->myNumber;
|
||||
|
||||
/*
|
||||
switch done! Start a reference run
|
||||
*/
|
||||
SicsWait(10);
|
||||
SCWrite(pCon,"Standby, starting reference run... ", eWarning);
|
||||
pElli = (EL734Driv *)self->pMaster->pDriver;
|
||||
sprintf(pCommand,"R %d\r",pElli->iMotor);
|
||||
setRS232Timeout(pElli->controller,4000);
|
||||
status = transactRS232(pElli->controller,pCommand,strlen(pCommand),
|
||||
pError,131);
|
||||
if(status != 1)
|
||||
{
|
||||
getRS232Error(status,pError,131);
|
||||
sprintf(pCommand,"ERROR: %s while trying to start reference run",
|
||||
pError);
|
||||
SCWrite(pCon,pCommand,eError);
|
||||
self->errCode = -1002;
|
||||
return HWFault;
|
||||
}
|
||||
/*
|
||||
now loop forever until reference run is done. This is either when the
|
||||
motors stops being busy or when the user interrupts.
|
||||
*/
|
||||
sprintf(pCommand,"SS %d\r",pElli->iMotor);
|
||||
for( ; ;)
|
||||
{
|
||||
status = transactRS232(pElli->controller,pCommand,strlen(pCommand),
|
||||
pError,131);
|
||||
if(status != 1)
|
||||
{
|
||||
getRS232Error(status,pError,131);
|
||||
sprintf(pCommand,"ERROR: %s during reference run",
|
||||
pError);
|
||||
SCWrite(pCon,pCommand,eError);
|
||||
self->errCode = -1003;
|
||||
return HWFault;
|
||||
}
|
||||
if(strstr(pError,"?BSY") == NULL)
|
||||
break;
|
||||
if(SCGetInterrupt(pCon) != eContinue)
|
||||
{
|
||||
self->errCode = -1004;
|
||||
SCWrite(pCon,"ERROR: user interrupted reference run",eError);
|
||||
return HWFault;
|
||||
}
|
||||
SicsWait(2);
|
||||
}
|
||||
|
||||
/*
|
||||
now this is finished. We can really start driving the motor
|
||||
*/
|
||||
SCWrite(pCon,"Reference run completed, starting to drive motor..",
|
||||
eWarning);
|
||||
return self->pMaster->pDrivInt->SetValue(self->pMaster,pCon,fVal);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user