- Added Sycamore protocol and command context to SICS
- Added sinfo to SICS - Added driver for TCP/IP Astrium velocity selector - Added driver for TCP/IP Astrium chopper controller SKIPPED: psi/amor2t.c psi/amorstat.c psi/dornier2.c psi/ecb.c psi/el734hp.c psi/fowrite.c psi/libpsi.a psi/make_gen psi/nextrics.c psi/pardef.c psi/pimotor.c psi/pipiezo.c psi/polterwrite.c psi/psi.c psi/scontroller.c psi/serial.c psi/tasinit.c psi/tasscan.c psi/tcpdocho.c psi/tcpdornier.c psi/tricssupport.c psi/velodornier.c
This commit is contained in:
61
motor.c
61
motor.c
@@ -52,6 +52,7 @@
|
||||
#include "splitter.h"
|
||||
#include "status.h"
|
||||
#include "servlog.h"
|
||||
#include "tclmotdriv.h"
|
||||
#include "site.h"
|
||||
/*-------------------------------------------------------------------------
|
||||
some lokal defines
|
||||
@@ -385,6 +386,12 @@ static void handleMoveCallback(pMotor self, SConnection *pCon)
|
||||
self = (pMotor)sulf;
|
||||
|
||||
status = evaluateStatus(self,pCon);
|
||||
if (self->pDrivInt->drivableStatus!=status) {
|
||||
((SConnection *)pCon)->conEventType=STATUS;
|
||||
((SConnection *)pCon)->conStatus=status;
|
||||
SCWrite(pCon, "", eEvent);
|
||||
self->pDrivInt->drivableStatus=status;
|
||||
}
|
||||
if(status == HWBusy)
|
||||
{
|
||||
handleMoveCallback(self,pCon);
|
||||
@@ -741,7 +748,7 @@ extern void KillPiPiezo(void *pData);
|
||||
iRet = MotorCheckBoundary(self,fNew,&fHard,pBueffel,511);
|
||||
if(!iRet)
|
||||
{
|
||||
SCWrite(pCon,pBueffel,eWarning);
|
||||
SCWrite(pCon,pBueffel,eStatus);
|
||||
SCSetInterrupt(pCon,eAbortOperation);
|
||||
return 0;
|
||||
}
|
||||
@@ -1000,6 +1007,21 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
}else if (strcmp(argv[2],"tclmot") == 0)
|
||||
{
|
||||
pDriver = CreateTclMotDriv(pCon,argc,argv);
|
||||
if(!pDriver)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
/* create the motor */
|
||||
pNew = MotorInit("TCLMOT",argv[1],pDriver);
|
||||
if(!pNew)
|
||||
{
|
||||
sprintf(pBueffel,"Failure to create motor %s",argv[1]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1034,8 +1056,8 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
int i, iLen;
|
||||
|
||||
iLen = ObParLength(self->ParArray);
|
||||
sprintf(pBueffel,"Parameter Listing for motor %s\n",self->name);
|
||||
SCWrite(pCon,pBueffel,eStatus);
|
||||
sprintf(pBueffel,"Parameter Listing for motor %s",self->name);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
snprintf(pBueffel,511,"%s.hardupperlim = %f",self->name,
|
||||
self->pDriver->fUpper);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
@@ -1073,6 +1095,7 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
typedef struct {
|
||||
char *pName;
|
||||
SConnection *pCon;
|
||||
float lastValue;
|
||||
} MotInfo, *pMotInfo;
|
||||
/*-----------------------------------------------------------------------*/
|
||||
static void KillInfo(void *pData)
|
||||
@@ -1088,7 +1111,8 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
free(self);
|
||||
}
|
||||
/*------------------- The CallBack function for interest ------------------*/
|
||||
static int InterestCallback(int iEvent, void *pEvent, void *pUser)
|
||||
static int InterestCallback(int iEvent, void *pEvent, void *pUser,
|
||||
commandContext cc)
|
||||
{
|
||||
pMotInfo pInfo = NULL;
|
||||
char pBueffel[80];
|
||||
@@ -1099,9 +1123,13 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
|
||||
psCall = (MotCallback *)pEvent;
|
||||
pInfo = (MotInfo *)pUser;
|
||||
|
||||
sprintf(pBueffel,"%s.position = %f ", pInfo->pName, psCall->fVal);
|
||||
SCWrite(pInfo->pCon,pBueffel,eValue);
|
||||
|
||||
if (pInfo->lastValue != psCall->fVal) {
|
||||
pInfo->lastValue = psCall->fVal;
|
||||
(pInfo->pCon)->conEventType=POSITION;
|
||||
sprintf(pBueffel,"%s.position = %f ", pInfo->pName, pInfo->lastValue);
|
||||
SCWriteInContext(pInfo->pCon,pBueffel,eEvent,cc);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
@@ -1113,7 +1141,8 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
}
|
||||
}
|
||||
/*------------------------ The endscript callback function ----------------*/
|
||||
static int EndScriptCallback(int iEvent, void *pEvent, void *pUser)
|
||||
static int EndScriptCallback(int iEvent, void *pEvent, void *pUser,
|
||||
commandContext cc)
|
||||
{
|
||||
char *pScript = NULL;
|
||||
MotCallback *psCall;
|
||||
@@ -1178,7 +1207,7 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
if(!iRet)
|
||||
{
|
||||
sprintf(pBueffel,"Error obtaining position for %s",argv[0]);
|
||||
SCWrite(pCon,pBueffel,eValue);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
DeleteTokenList(pList);
|
||||
return 0;
|
||||
}
|
||||
@@ -1220,7 +1249,17 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
}
|
||||
pMoti->pName = strdup(argv[0]);
|
||||
pMoti->pCon = pCon;
|
||||
lID = RegisterCallback(self->pCall, MOTDRIVE, InterestCallback,
|
||||
iRet = MotorGetSoftPosition(self,pCon,&fValue);
|
||||
if(!iRet)
|
||||
{
|
||||
sprintf(pBueffel,"Failed to register interest, Reason:Error obtaining current position for %s",argv[0]);
|
||||
SCWrite(pCon,pBueffel,eError);
|
||||
DeleteTokenList(pList);
|
||||
return 0;
|
||||
}
|
||||
pMoti->lastValue = fValue;
|
||||
|
||||
lID = RegisterCallback(self->pCall, SCGetContext(pCon),MOTDRIVE, InterestCallback,
|
||||
pMoti, KillInfo);
|
||||
SCRegister(pCon,pSics, self->pCall,lID);
|
||||
DeleteTokenList(pList);
|
||||
@@ -1252,7 +1291,7 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray);
|
||||
return 0;
|
||||
}
|
||||
self->endScriptID =
|
||||
RegisterCallback(self->pCall, MOTEND, EndScriptCallback,
|
||||
RegisterCallback(self->pCall, SCGetContext(pCon),MOTEND, EndScriptCallback,
|
||||
strdup(pCurrent->text), KillScript);
|
||||
SCRegister(pCon,pSics, self->pCall,self->endScriptID);
|
||||
DeleteTokenList(pList);
|
||||
|
||||
Reference in New Issue
Block a user