diff --git a/amorset.c b/amorset.c index 46af797..401cf22 100644 --- a/amorset.c +++ b/amorset.c @@ -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 detectoroffset %f\n", name, self->detectoroffset); 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,"mono",&self->M); saveAmorComp(fd,name,"ds",&self->DS); @@ -619,6 +621,22 @@ int AmorSetAction(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon,pBueffel,eValue); 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){ if(argc > 2){ if(!SCMatchRights(pCon,usMugger)){ diff --git a/julcho.c b/julcho.c index f8086b6..d9999ef 100644 --- a/julcho.c +++ b/julcho.c @@ -643,7 +643,7 @@ static int ConfigureSingleJulCho(pHdb parent, pJulCho driv, return 0; } AppendHipadabaCallback(child,HCBSET,pCb); - AddHipadabaChild(parent,child); + AddHipadabaChild(parent,child,NULL); child = MakeHipadabaNode("gatewidth",HIPFLOAT,0); if(child == NULL){ @@ -659,7 +659,7 @@ static int ConfigureSingleJulCho(pHdb parent, pJulCho driv, return 0; } AppendHipadabaCallback(child,HCBSET,pCb); - AddHipadabaChild(parent,child); + AddHipadabaChild(parent,child,NULL); if(!AppendJulChoROPar(parent,"nomspeed",HIPINT)){ return 0; @@ -769,7 +769,7 @@ static int InitJulChoPar(pJulCho driv){ if(!ConfigureSingleJulCho(child,driv,"","::::")){ return 0; } - AddHipadabaChild(driv->parNode,child); + AddHipadabaChild(driv->parNode,child,NULL); child = MakeHipadabaNode(CH2N,HIPNONE,0); if(child == NULL){ @@ -797,7 +797,7 @@ static int InitJulChoPar(pJulCho driv){ return 0; } AppendHipadabaCallback(parChild,HCBSET,pCb); - AddHipadabaChild(driv->parNode,child); + AddHipadabaChild(driv->parNode,child,NULL); child = MakeHipadabaNode(CH3N,HIPNONE,0); if(child == NULL){ @@ -806,7 +806,7 @@ static int InitJulChoPar(pJulCho driv){ if(!ConfigureSingleJulCho(child,driv,"::","::")){ return 0; } - AddHipadabaChild(driv->parNode,child); + AddHipadabaChild(driv->parNode,child,NULL); child = MakeHipadabaNode(CH4N,HIPNONE,0); if(child == NULL){ @@ -815,7 +815,7 @@ static int InitJulChoPar(pJulCho driv){ if(!ConfigureSingleJulCho(child,driv,":::",":")){ return 0; } - AddHipadabaChild(driv->parNode,child); + AddHipadabaChild(driv->parNode,child,NULL); child = MakeHipadabaNode(CH5N,HIPNONE,0); if(child == NULL){ @@ -824,7 +824,7 @@ static int InitJulChoPar(pJulCho driv){ if(!ConfigureSingleJulCho(child,driv,"::::","")){ return 0; } - AddHipadabaChild(driv->parNode,child); + AddHipadabaChild(driv->parNode,child,NULL); return 1; } diff --git a/libpsi.a b/libpsi.a index 981de56..c68f0bc 100644 Binary files a/libpsi.a and b/libpsi.a differ diff --git a/pimotor.c b/pimotor.c index bdb07e5..7cd2767 100644 --- a/pimotor.c +++ b/pimotor.c @@ -416,7 +416,7 @@ KillC804(pNew); return NULL; } - SerialConfig(&pNew->pSerial,5000); + SerialConfig(&pNew->pSerial,50000); /* switch on, just to make sure */ iTmo = SerialGetTmo(&pNew->pSerial); diff --git a/tabledrive.c b/tabledrive.c index 90d53f0..9dcb992 100644 --- a/tabledrive.c +++ b/tabledrive.c @@ -86,10 +86,16 @@ static long TableDriveSetValue(void *pData, SConnection *pCon, float fVal){ static int findOrientingMotor(pTableDrive self, ptdMotor moti){ int status; + if(!self->oriInvalid){ + *moti = self->oriMotor; + return 1; + } status = LLDnodePtr2First(self->motorTable); while(status != 0){ LLDnodeDataTo(self->motorTable,moti); if(strcmp(moti->motorName,self->orientMotor) == 0){ + self->oriMotor = *moti; + self->oriInvalid = 0; return 1; } status = LLDnodePtr2Next(self->motorTable); @@ -227,7 +233,8 @@ static float TableDriveGetValue(void *pData, SConnection *pCon){ } value = locatePosition(orient,pCon); checkSync(self,pCon, value); - self->currentPosition = value; + + self->currentPosition = value; return value; } /*-------------------------------------------------------------------------*/ @@ -612,7 +619,8 @@ int TableDriveFactory(SConnection *pCon, SicsInterp *pSics, void *pData, pNew->state = OUTOFSYNC; pNew->tableLength = 0; pNew->targetPosition = 0; - + pNew->oriInvalid = 1; + if(!loadTable(pNew,argv[2],pCon)){ killTableDrive(pNew); return 0; @@ -684,6 +692,7 @@ int TableDriveAction(SConnection *pCon, SicsInterp *pSics, void *pData, return 0; } strncpy(self->orientMotor,argv[2],80); + self->oriInvalid = 1; SCSendOK(pCon); return 1; } else { diff --git a/tabledrive.h b/tabledrive.h index 6cc7f98..5067c89 100644 --- a/tabledrive.h +++ b/tabledrive.h @@ -37,6 +37,8 @@ typedef struct{ int state; char orientMotor[80]; int debug; + tdMotor oriMotor; + int oriInvalid; }TableDrive, *pTableDrive; /*-------------------------------------------------------------------------*/