From 86f584ea45b75b512d71d1db595143114e3cd480 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Tue, 20 Mar 2007 11:20:29 +1100 Subject: [PATCH] Refactoring: We would like motor objects to allow getting of non-float parameters. Call "GetDriverTextPar" if defined by a driver. See SICS-10 on Jira. r1676 | ffr | 2007-03-20 11:20:29 +1100 (Tue, 20 Mar 2007) | 4 lines --- motor.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/motor.c b/motor.c index e427f41e..aeaacf70 100644 --- a/motor.c +++ b/motor.c @@ -1195,9 +1195,10 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray); TokenList *pList = NULL; TokenList *pCurrent; TokenList *pName; - int iRet; + int iRet, iRet2=0; pMotor self; float fValue; + char textValue[TEXTPARLEN]; long lID; pMotInfo pMoti = NULL; @@ -1352,7 +1353,10 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray); return 1; } iRet = MotorGetPar(self,pName->text,&fValue); - if(!iRet) + + if(self->pDriver->GetDriverTextPar != NULL) + iRet2 = self->pDriver->GetDriverTextPar(self->pDriver, pName->text, textValue); + if(!(iRet || iRet2)) { sprintf(pBueffel,"Parameter %s not found ",pName->text); SCWrite(pCon,pBueffel,eValue); @@ -1361,7 +1365,10 @@ extern MotorDriver *MakePiPiezo(Tcl_Interp *pTcl, char *pArray); } else { - sprintf(pBueffel, "%s.%s = %f",self->name,pName->text,fValue); + if (iRet) + sprintf(pBueffel, "%s.%s = %f",self->name,pName->text,fValue); + else if (iRet2) + sprintf(pBueffel, "%s.%s = %s",self->name,pName->text,textValue); SCWrite(pCon,pBueffel,eValue); DeleteTokenList(pList); return 1;