diff --git a/ease.c b/ease.c index 8af3132..722c3a3 100644 --- a/ease.c +++ b/ease.c @@ -92,7 +92,7 @@ void EaseWriteError(EaseBase * eab) case EASE_DEV_CHANGED: ParPrintf(eab, eError, "ERROR: controller was exchanged on %s", eab->p.name); - EaseStop(eab); + /* EaseStop(eab); */ break; case EASE_FAULT: ParPrintf(eab, eError, "ERROR: error on %s", eab->p.name); @@ -268,7 +268,9 @@ int EaseHandler(EaseBase * eab) eab->state = EASE_notconnected; return 0; } else { - eab->tmo = 20; + if (eab->tmo > 20) { + eab->tmo = 20; + } snprintf(eab->msg, sizeof eab->msg, "get a first answer from %s", eab->p.name); eab->state = EASE_idle; diff --git a/haakedriv.c b/haakedriv.c index 4ce231e..d5d8e88 100644 --- a/haakedriv.c +++ b/haakedriv.c @@ -80,23 +80,33 @@ int HaakeHandler(void *object) } goto quit; } - l = strlen(eab->ans) - 1; - if (l >= 0 && eab->ans[l] != '$') { /* end char is not $ -> send again */ - ParPrintf(eab, -2, "ans: %s", eab->ans); - if (drv->errcnt < 10) { - eab->state = EASE_read; - EaseWrite(eab, NULL); /* send the same command again */ - drv->errcnt++; - return 0; - } - eab->errCode = EASE_ILL_ANS; - eab->state = EASE_idle; - goto error; - } else { - drv->errcnt = 0; - } if (iret == 1) { ParPrintf(eab, -2, "ans: %s", eab->ans); + + if (eab->state == EASE_lost) { + if (strcmp(eab->ans, "F001") == 0) { + EaseWrite(eab, "V"); + } + goto quit; + } + l = strlen(eab->ans) - 1; + if (l >= 0 && eab->ans[l] != '$') { + /* end char is not $ -> send again */ + ParPrintf(eab, -2, "ans: %s", eab->ans); + if (drv->errcnt < 10) { + eab->state = EASE_read; + EaseWrite(eab, NULL); /* send the same command again */ + drv->errcnt++; + return 0; + } + eab->errCode = EASE_ILL_ANS; + eab->state = EASE_idle; + goto error; + } else { + drv->errcnt = 0; + } + + if (eab->state == EASE_lost) { goto quit; } else if (eab->cmd[0] == 'V') { @@ -112,7 +122,7 @@ int HaakeHandler(void *object) eab->state = EASE_idle; goto quit; } else { - eab->tmo = 120; + /* eab->tmo = 20; no need to change the timeout ? */ } } if (iret != 1) { @@ -126,12 +136,10 @@ int HaakeHandler(void *object) eab->state = EASE_lost; } } else if (eab->state == EASE_lost) { -/* if (time(NULL) > eab->cmdtime) { EaseWrite(eab, "check"); eab->state = EASE_lost; } -*/ } goto quit; error: diff --git a/linadriv.c b/linadriv.c index 9fd0b0d..6e36c63 100644 --- a/linadriv.c +++ b/linadriv.c @@ -59,11 +59,14 @@ int LinaHandler(void *object) if (iret == 1) { ParPrintf(eab, -2, "ans: %s", eab->ans); if (eab->state == EASE_lost) { + if (strcmp(eab->ans, "6,0") == 0) { + EaseWrite(eab, "ID"); + } goto quit; } else if (strncmp(eab->cmd, "ID", 2) == 0) { if (strcmp(eab->ans, eab->version) == 0) { /* we are still connected with the same device */ - } else if (*eab->version == '\0') { + } else if (*eab->version == '\0' && strcmp(eab->ans, "7265") == 0) { strncat(eab->version, eab->ans, sizeof(eab->version) - 1); } else { /* version (and therefore device) changed */ eab->errCode = EASE_DEV_CHANGED; @@ -73,7 +76,7 @@ int LinaHandler(void *object) eab->state = EASE_idle; goto quit; } else { - eab->tmo = 120; + eab->tmo = 10; } } if (iret != 1) { @@ -87,12 +90,10 @@ int LinaHandler(void *object) eab->state = EASE_lost; } } else if (eab->state == EASE_lost) { -/* if (time(NULL) > eab->cmdtime) { EaseWrite(eab, "RS"); eab->state = EASE_lost; } -*/ } goto quit; error: diff --git a/lsc370driv.c b/lsc370driv.c index 1edc348..a824eb9 100644 --- a/lsc370driv.c +++ b/lsc370driv.c @@ -257,6 +257,7 @@ static void Lsc370ParDef(void *object) ParName("maxPower"); ParTail("mW"); power = Lsc370Power(drv, 100.0); + ParFmt("%.0g"); ParFloat(&power, 0.0); ParName("power"); @@ -349,9 +350,11 @@ static long Lsc370Read(long pc, void *object) goto skipHtrRng; if (1 == sscanf(eab->ans, "%d", &rng)) { drv->htrRange = rng; +/* if (rng == 0) { drv->set = 0; } +*/ } skipHtrRng: diff --git a/make_gen b/make_gen index db48f44..16a188d 100644 --- a/make_gen +++ b/make_gen @@ -37,8 +37,7 @@ libpsi.a: $(OBJ) ranlib libpsi.a clean: - rm -f *.a - rm -f *.o + rm -f *.a *.o *.d SINQOPT=-DGRAPH_MHC3 -DUSE_MULTICAST -DSEND_PORT=0xABCB -DSERVER_HOST="\"acslg1\"" dgrambroadcast.o: dgrambroadcast.h dgrambroadcast.c diff --git a/makefile_linux b/makefile_linux index 056eb20..e35d8b5 100644 --- a/makefile_linux +++ b/makefile_linux @@ -11,9 +11,11 @@ include ../sllinux_def CC = gcc CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -Ihardsup \ - -I.. -DCYGNUS -DNONINTF -g $(DFORTIFY) \ + -I.. -MMD -DCYGNUS -DNONINTF -g $(DFORTIFY) \ -Wall -Wno-unused -Wunused-value -Wno-comment -Wno-switch -Werror EXTRA=nintf.o include make_gen + +-include $(OBJ:.o=.d) diff --git a/oxinst.c b/oxinst.c index a8b6129..1940b64 100644 --- a/oxinst.c +++ b/oxinst.c @@ -100,7 +100,7 @@ int OxiHandler(void *object) goto quit; } else if (eab->cmd[2] == 'k') { /* ?ck */ } else { - eab->tmo = 120; + eab->tmo = 120; /* long timeout: the user may block the response with the adjust keys */ if (eab->syntax <= -8) { corr = OxiCorrect(eab->ans); if (corr) { diff --git a/pardef.c b/pardef.c index 8adbe5f..ec000c1 100644 --- a/pardef.c +++ b/pardef.c @@ -25,6 +25,7 @@ Markus Zolliker, March 2005 #define ILLPRIV -5 #define BADLOG -6 #define UNKPAR -7 +#define PARUNDEF -8 typedef enum { NO_OP, FMT_OP, SET_OP, GET_OP, INIT_OP } ParOp; @@ -392,11 +393,10 @@ static int ParOutError(SConnection * con, ParData * o) SCPrintf(con, eError, "ERROR: %s %s is unknown", o->name, ctx->thisPar); break; - /* - case BUSY: - SCPrintf(con, eError, "ERROR: %s busy", o->name); - break; - */ + case PARUNDEF: + SCPrintf(con, eError, "ERROR: %s %s is undefined", + o->name, ctx->thisPar); + break; default: if (ctx->returnValue < 0) { return -1; @@ -1199,10 +1199,11 @@ void ParFloat(float *value, float defValue) case FMT_OP: if (*value == PAR_NAN) { ctx->fmt = NULL; - ParOut(""); /* undefined */ + /* ctx->returnValue = PARUNDEF; */ + ParOut(""); } else { if (ctx->fmt == NULL) { - ctx->fmt = "%#.5g"; + ctx->fmt = "%.5g"; } snprintf(buf, sizeof buf, ctx->fmt, *value); ctx->fmt = NULL; @@ -1249,7 +1250,8 @@ void ParInt(int *value, int defValue) /* fall through */ case FMT_OP: if (*value == PAR_LNAN) { - ParOut(""); /* undefined */ + /* ctx->returnValue = PARUNDEF; */ + ParOut(""); /* undefined */ } else { snprintf(buf, sizeof buf, "%d", *value); ParOut(buf); diff --git a/tasscan.c b/tasscan.c index 73ee611..6a09716 100644 --- a/tasscan.c +++ b/tasscan.c @@ -745,7 +745,7 @@ static int TASScanCount(pScanData self, int iPoint) */ fVal = GetCounterPreset(self->pCounterData); eOld = GetStatus(); - status = DoCount(self->pCounterData, fVal, self->pCon, 1); + status = DoCount(self->pCounterData, fVal, self->pCon, 2); iRet = Wait4Success(GetExecutor()); if (iRet == DEVINT) { SCWrite(self->pCon, "Counting aborted due to Interrupt", eLog); @@ -1322,6 +1322,10 @@ int TASScan(SConnection * pCon, SicsInterp * pSics, void *pData, if (!SCMatchRights(pCon, usUser)) return 0; + if (pTAS->pScan->iActive) { + SCWrite(pCon, "ERROR: a scan is still running", eError); + return 0; + } /* check if we are a fast scan or a normal scan */ diff --git a/tecsdriv.c b/tecsdriv.c index 960026a..f05c172 100644 --- a/tecsdriv.c +++ b/tecsdriv.c @@ -113,9 +113,7 @@ int TecsWrapper(SConnection * pCon, SicsInterp * pSics, void *pData, assert(pD); pMe = pD->pPrivate; assert(pMe); - strcpy(pBueffel, " "); - strcat(pBueffel, argv[1]); - strcat(pBueffel, " "); + snprintf(pBueffel, sizeof pBueffel, " %s ", argv[1]); strtolower(pBueffel); if (0 == strcmp(pBueffel, " targetvalue ")) { if (argc == 2) {