From a14e06dd91e97c9d15b870514dd59ceb8d5fda36 Mon Sep 17 00:00:00 2001 From: koennecke Date: Fri, 22 Apr 2005 14:10:04 +0000 Subject: [PATCH] - Fixed a confusing error message with the SANS-2 velocity selector - Added a parameter DEC to the motor driver which determines the number of decimals on the fucking display screen and made this work too --- dornier2.c | 11 +++++++++++ ecbdriv.c | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dornier2.c b/dornier2.c index 021f1f0..741a02d 100644 --- a/dornier2.c +++ b/dornier2.c @@ -70,6 +70,12 @@ typedef struct __VelSelDriv *pVelSelDriv; has yet been read. Solves a starting problem */ + int firstStatus; /* at times the nvs does not send + the reply to the first status + request after starting. This flag + helps to suppress an error message + which may be confusing to loosers + */ } Dornier, *pDornier; /*------------------------------------------------------------------*/ static int requestDornierStatus(pDornier pDorn){ @@ -271,6 +277,7 @@ static int takeControl(pDornier pDorn){ iRet = transactRS232(pDorn->controller,pCommand,strlen(pCommand), pAnswer,49); setRS232ReplyTerminator(pDorn->controller,"\n"); + pDorn->firstStatus = 1; if(iRet != 1) { if(iRet != INCOMPLETE){ @@ -389,6 +396,10 @@ static int evaluateStatus(pVelSelDriv self, int *iCode){ pDorn->statusMode = STATSEND; status = readAndInterpretStatus(pDorn,&sStatus); if(!status){ + if(pDorn->firstStatus == 1){ + pDorn->firstStatus = 0; + return VSACCEL; + } return VELOFAIL; } diff --git a/ecbdriv.c b/ecbdriv.c index 740b21e..4ec1ca8 100644 --- a/ecbdriv.c +++ b/ecbdriv.c @@ -68,8 +68,9 @@ Parameter indexes in ObPar array and meanings #define DEG2STEP 14 /* conversion factor from degree to encoder digits */ #define BACKLASH 15 /* motor backlash */ #define PORT 17 /* ECB port when multiplexed */ +#define DEC 18 /* Decimals in display */ -#define MAXPAR 19 /* 1 extra for the sentinel, do not forget to initialize! */ +#define MAXPAR 20 /* 1 extra for the sentinel, do not forget to initialize! */ /*------------------------------ ECB defines -------------------------*/ #define MAX_ENCODER 40 @@ -483,6 +484,7 @@ static int loadGearing(pECBMotDriv self){ Ecb_pack data; Z80_reg in, out; + dec = (int)ObVal(self->driverPar,DEC); in.c = self->ecbIndex; dgear = (double) ObVal(self->driverPar,STEPS2DEG);; @@ -1232,6 +1234,7 @@ static void initializeParameters(pECBMotDriv self){ ObParInit(self->driverPar,DEG2STEP,"step2dig",0,usMugger); ObParInit(self->driverPar,BACKLASH,"backlash",0,usMugger); ObParInit(self->driverPar,PORT,"port",0,usMugger); + ObParInit(self->driverPar,DEC,"dec",1,usMugger); ObParInit(self->driverPar,MAXPAR-1,"tueet",-100,-100); /* sentinel! */ } /*=======================================================================*/