- Added another slit for AMOR

- Fixed timeout for pimotor
- Fixed a bug which could cause tabledrive to go into an endless loop
This commit is contained in:
koennecke
2006-12-07 14:05:35 +00:00
parent ee7592b46c
commit a91056837e
6 changed files with 39 additions and 10 deletions

View File

@ -380,6 +380,8 @@ static int amorSetSave(void *data, char *name,FILE *fd){
fprintf(fd,"%s dspar %f\n", name, self->dspar); fprintf(fd,"%s dspar %f\n", name, self->dspar);
fprintf(fd,"%s detectoroffset %f\n", name, self->detectoroffset); fprintf(fd,"%s detectoroffset %f\n", name, self->detectoroffset);
fprintf(fd,"%s verbose %d\n", name, self->verbose); fprintf(fd,"%s verbose %d\n", name, self->verbose);
fprintf(fd,"%s targets %f %f %f\n", name, self->targetath, self->targetm2t,
self->targets2t);
saveAmorComp(fd,name,"chopper",&self->chopper); saveAmorComp(fd,name,"chopper",&self->chopper);
saveAmorComp(fd,name,"mono",&self->M); saveAmorComp(fd,name,"mono",&self->M);
saveAmorComp(fd,name,"ds",&self->DS); saveAmorComp(fd,name,"ds",&self->DS);
@ -619,6 +621,22 @@ int AmorSetAction(SConnection *pCon, SicsInterp *pSics, void *pData,
SCWrite(pCon,pBueffel,eValue); SCWrite(pCon,pBueffel,eValue);
return 1; return 1;
} }
}else if(strcmp(argv[1],"targets") == 0){
if(argc >= 5){
if(!SCMatchRights(pCon,usMugger)){
return 0;
}
self->targetath = atof(argv[2]);
self->targetm2t = atof(argv[3]);
self->targets2t = atof(argv[4]);
SCSendOK(pCon);
return 1;
} else {
snprintf(pBueffel,131,"%s targets = %f %f %F", argv[0],
self->targetath, self->targetm2t, self->targets2t);
SCWrite(pCon,pBueffel,eValue);
return 1;
}
}else if(strcmp(argv[1],"verbose") == 0){ }else if(strcmp(argv[1],"verbose") == 0){
if(argc > 2){ if(argc > 2){
if(!SCMatchRights(pCon,usMugger)){ if(!SCMatchRights(pCon,usMugger)){

View File

@ -643,7 +643,7 @@ static int ConfigureSingleJulCho(pHdb parent, pJulCho driv,
return 0; return 0;
} }
AppendHipadabaCallback(child,HCBSET,pCb); AppendHipadabaCallback(child,HCBSET,pCb);
AddHipadabaChild(parent,child); AddHipadabaChild(parent,child,NULL);
child = MakeHipadabaNode("gatewidth",HIPFLOAT,0); child = MakeHipadabaNode("gatewidth",HIPFLOAT,0);
if(child == NULL){ if(child == NULL){
@ -659,7 +659,7 @@ static int ConfigureSingleJulCho(pHdb parent, pJulCho driv,
return 0; return 0;
} }
AppendHipadabaCallback(child,HCBSET,pCb); AppendHipadabaCallback(child,HCBSET,pCb);
AddHipadabaChild(parent,child); AddHipadabaChild(parent,child,NULL);
if(!AppendJulChoROPar(parent,"nomspeed",HIPINT)){ if(!AppendJulChoROPar(parent,"nomspeed",HIPINT)){
return 0; return 0;
@ -769,7 +769,7 @@ static int InitJulChoPar(pJulCho driv){
if(!ConfigureSingleJulCho(child,driv,"","::::")){ if(!ConfigureSingleJulCho(child,driv,"","::::")){
return 0; return 0;
} }
AddHipadabaChild(driv->parNode,child); AddHipadabaChild(driv->parNode,child,NULL);
child = MakeHipadabaNode(CH2N,HIPNONE,0); child = MakeHipadabaNode(CH2N,HIPNONE,0);
if(child == NULL){ if(child == NULL){
@ -797,7 +797,7 @@ static int InitJulChoPar(pJulCho driv){
return 0; return 0;
} }
AppendHipadabaCallback(parChild,HCBSET,pCb); AppendHipadabaCallback(parChild,HCBSET,pCb);
AddHipadabaChild(driv->parNode,child); AddHipadabaChild(driv->parNode,child,NULL);
child = MakeHipadabaNode(CH3N,HIPNONE,0); child = MakeHipadabaNode(CH3N,HIPNONE,0);
if(child == NULL){ if(child == NULL){
@ -806,7 +806,7 @@ static int InitJulChoPar(pJulCho driv){
if(!ConfigureSingleJulCho(child,driv,"::","::")){ if(!ConfigureSingleJulCho(child,driv,"::","::")){
return 0; return 0;
} }
AddHipadabaChild(driv->parNode,child); AddHipadabaChild(driv->parNode,child,NULL);
child = MakeHipadabaNode(CH4N,HIPNONE,0); child = MakeHipadabaNode(CH4N,HIPNONE,0);
if(child == NULL){ if(child == NULL){
@ -815,7 +815,7 @@ static int InitJulChoPar(pJulCho driv){
if(!ConfigureSingleJulCho(child,driv,":::",":")){ if(!ConfigureSingleJulCho(child,driv,":::",":")){
return 0; return 0;
} }
AddHipadabaChild(driv->parNode,child); AddHipadabaChild(driv->parNode,child,NULL);
child = MakeHipadabaNode(CH5N,HIPNONE,0); child = MakeHipadabaNode(CH5N,HIPNONE,0);
if(child == NULL){ if(child == NULL){
@ -824,7 +824,7 @@ static int InitJulChoPar(pJulCho driv){
if(!ConfigureSingleJulCho(child,driv,"::::","")){ if(!ConfigureSingleJulCho(child,driv,"::::","")){
return 0; return 0;
} }
AddHipadabaChild(driv->parNode,child); AddHipadabaChild(driv->parNode,child,NULL);
return 1; return 1;
} }

BIN
libpsi.a

Binary file not shown.

View File

@ -416,7 +416,7 @@
KillC804(pNew); KillC804(pNew);
return NULL; return NULL;
} }
SerialConfig(&pNew->pSerial,5000); SerialConfig(&pNew->pSerial,50000);
/* switch on, just to make sure */ /* switch on, just to make sure */
iTmo = SerialGetTmo(&pNew->pSerial); iTmo = SerialGetTmo(&pNew->pSerial);

View File

@ -86,10 +86,16 @@ static long TableDriveSetValue(void *pData, SConnection *pCon, float fVal){
static int findOrientingMotor(pTableDrive self, ptdMotor moti){ static int findOrientingMotor(pTableDrive self, ptdMotor moti){
int status; int status;
if(!self->oriInvalid){
*moti = self->oriMotor;
return 1;
}
status = LLDnodePtr2First(self->motorTable); status = LLDnodePtr2First(self->motorTable);
while(status != 0){ while(status != 0){
LLDnodeDataTo(self->motorTable,moti); LLDnodeDataTo(self->motorTable,moti);
if(strcmp(moti->motorName,self->orientMotor) == 0){ if(strcmp(moti->motorName,self->orientMotor) == 0){
self->oriMotor = *moti;
self->oriInvalid = 0;
return 1; return 1;
} }
status = LLDnodePtr2Next(self->motorTable); status = LLDnodePtr2Next(self->motorTable);
@ -227,7 +233,8 @@ static float TableDriveGetValue(void *pData, SConnection *pCon){
} }
value = locatePosition(orient,pCon); value = locatePosition(orient,pCon);
checkSync(self,pCon, value); checkSync(self,pCon, value);
self->currentPosition = value;
self->currentPosition = value;
return value; return value;
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
@ -612,7 +619,8 @@ int TableDriveFactory(SConnection *pCon, SicsInterp *pSics, void *pData,
pNew->state = OUTOFSYNC; pNew->state = OUTOFSYNC;
pNew->tableLength = 0; pNew->tableLength = 0;
pNew->targetPosition = 0; pNew->targetPosition = 0;
pNew->oriInvalid = 1;
if(!loadTable(pNew,argv[2],pCon)){ if(!loadTable(pNew,argv[2],pCon)){
killTableDrive(pNew); killTableDrive(pNew);
return 0; return 0;
@ -684,6 +692,7 @@ int TableDriveAction(SConnection *pCon, SicsInterp *pSics, void *pData,
return 0; return 0;
} }
strncpy(self->orientMotor,argv[2],80); strncpy(self->orientMotor,argv[2],80);
self->oriInvalid = 1;
SCSendOK(pCon); SCSendOK(pCon);
return 1; return 1;
} else { } else {

View File

@ -37,6 +37,8 @@ typedef struct{
int state; int state;
char orientMotor[80]; char orientMotor[80];
int debug; int debug;
tdMotor oriMotor;
int oriInvalid;
}TableDrive, *pTableDrive; }TableDrive, *pTableDrive;
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/