- introduced header file dependency check

- improvements in ease drivers
- no "Counting finished" message in tas scan
This commit is contained in:
zolliker
2009-11-10 10:40:14 +00:00
parent 4aca8c9e94
commit 3021eda66f
10 changed files with 59 additions and 40 deletions

6
ease.c
View File

@ -92,7 +92,7 @@ void EaseWriteError(EaseBase * eab)
case EASE_DEV_CHANGED: case EASE_DEV_CHANGED:
ParPrintf(eab, eError, "ERROR: controller was exchanged on %s", ParPrintf(eab, eError, "ERROR: controller was exchanged on %s",
eab->p.name); eab->p.name);
EaseStop(eab); /* EaseStop(eab); */
break; break;
case EASE_FAULT: case EASE_FAULT:
ParPrintf(eab, eError, "ERROR: error on %s", eab->p.name); ParPrintf(eab, eError, "ERROR: error on %s", eab->p.name);
@ -268,7 +268,9 @@ int EaseHandler(EaseBase * eab)
eab->state = EASE_notconnected; eab->state = EASE_notconnected;
return 0; return 0;
} else { } else {
eab->tmo = 20; if (eab->tmo > 20) {
eab->tmo = 20;
}
snprintf(eab->msg, sizeof eab->msg, snprintf(eab->msg, sizeof eab->msg,
"get a first answer from %s", eab->p.name); "get a first answer from %s", eab->p.name);
eab->state = EASE_idle; eab->state = EASE_idle;

View File

@ -80,23 +80,33 @@ int HaakeHandler(void *object)
} }
goto quit; 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) { if (iret == 1) {
ParPrintf(eab, -2, "ans: %s", eab->ans); 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) { if (eab->state == EASE_lost) {
goto quit; goto quit;
} else if (eab->cmd[0] == 'V') { } else if (eab->cmd[0] == 'V') {
@ -112,7 +122,7 @@ int HaakeHandler(void *object)
eab->state = EASE_idle; eab->state = EASE_idle;
goto quit; goto quit;
} else { } else {
eab->tmo = 120; /* eab->tmo = 20; no need to change the timeout ? */
} }
} }
if (iret != 1) { if (iret != 1) {
@ -126,12 +136,10 @@ int HaakeHandler(void *object)
eab->state = EASE_lost; eab->state = EASE_lost;
} }
} else if (eab->state == EASE_lost) { } else if (eab->state == EASE_lost) {
/*
if (time(NULL) > eab->cmdtime) { if (time(NULL) > eab->cmdtime) {
EaseWrite(eab, "check"); EaseWrite(eab, "check");
eab->state = EASE_lost; eab->state = EASE_lost;
} }
*/
} }
goto quit; goto quit;
error: error:

View File

@ -59,11 +59,14 @@ int LinaHandler(void *object)
if (iret == 1) { if (iret == 1) {
ParPrintf(eab, -2, "ans: %s", eab->ans); ParPrintf(eab, -2, "ans: %s", eab->ans);
if (eab->state == EASE_lost) { if (eab->state == EASE_lost) {
if (strcmp(eab->ans, "6,0") == 0) {
EaseWrite(eab, "ID");
}
goto quit; goto quit;
} else if (strncmp(eab->cmd, "ID", 2) == 0) { } else if (strncmp(eab->cmd, "ID", 2) == 0) {
if (strcmp(eab->ans, eab->version) == 0) { if (strcmp(eab->ans, eab->version) == 0) {
/* we are still connected with the same device */ /* 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); strncat(eab->version, eab->ans, sizeof(eab->version) - 1);
} else { /* version (and therefore device) changed */ } else { /* version (and therefore device) changed */
eab->errCode = EASE_DEV_CHANGED; eab->errCode = EASE_DEV_CHANGED;
@ -73,7 +76,7 @@ int LinaHandler(void *object)
eab->state = EASE_idle; eab->state = EASE_idle;
goto quit; goto quit;
} else { } else {
eab->tmo = 120; eab->tmo = 10;
} }
} }
if (iret != 1) { if (iret != 1) {
@ -87,12 +90,10 @@ int LinaHandler(void *object)
eab->state = EASE_lost; eab->state = EASE_lost;
} }
} else if (eab->state == EASE_lost) { } else if (eab->state == EASE_lost) {
/*
if (time(NULL) > eab->cmdtime) { if (time(NULL) > eab->cmdtime) {
EaseWrite(eab, "RS"); EaseWrite(eab, "RS");
eab->state = EASE_lost; eab->state = EASE_lost;
} }
*/
} }
goto quit; goto quit;
error: error:

View File

@ -257,6 +257,7 @@ static void Lsc370ParDef(void *object)
ParName("maxPower"); ParName("maxPower");
ParTail("mW"); ParTail("mW");
power = Lsc370Power(drv, 100.0); power = Lsc370Power(drv, 100.0);
ParFmt("%.0g");
ParFloat(&power, 0.0); ParFloat(&power, 0.0);
ParName("power"); ParName("power");
@ -349,9 +350,11 @@ static long Lsc370Read(long pc, void *object)
goto skipHtrRng; goto skipHtrRng;
if (1 == sscanf(eab->ans, "%d", &rng)) { if (1 == sscanf(eab->ans, "%d", &rng)) {
drv->htrRange = rng; drv->htrRange = rng;
/*
if (rng == 0) { if (rng == 0) {
drv->set = 0; drv->set = 0;
} }
*/
} }
skipHtrRng: skipHtrRng:

View File

@ -37,8 +37,7 @@ libpsi.a: $(OBJ)
ranlib libpsi.a ranlib libpsi.a
clean: clean:
rm -f *.a rm -f *.a *.o *.d
rm -f *.o
SINQOPT=-DGRAPH_MHC3 -DUSE_MULTICAST -DSEND_PORT=0xABCB -DSERVER_HOST="\"acslg1\"" SINQOPT=-DGRAPH_MHC3 -DUSE_MULTICAST -DSEND_PORT=0xABCB -DSERVER_HOST="\"acslg1\""
dgrambroadcast.o: dgrambroadcast.h dgrambroadcast.c dgrambroadcast.o: dgrambroadcast.h dgrambroadcast.c

View File

@ -11,9 +11,11 @@ include ../sllinux_def
CC = gcc CC = gcc
CFLAGS = -I$(HDFROOT)/include -DHDF4 -DHDF5 $(NI) -Ihardsup \ 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 -Wall -Wno-unused -Wunused-value -Wno-comment -Wno-switch -Werror
EXTRA=nintf.o EXTRA=nintf.o
include make_gen include make_gen
-include $(OBJ:.o=.d)

View File

@ -100,7 +100,7 @@ int OxiHandler(void *object)
goto quit; goto quit;
} else if (eab->cmd[2] == 'k') { /* ?ck */ } else if (eab->cmd[2] == 'k') { /* ?ck */
} else { } else {
eab->tmo = 120; eab->tmo = 120; /* long timeout: the user may block the response with the adjust keys */
if (eab->syntax <= -8) { if (eab->syntax <= -8) {
corr = OxiCorrect(eab->ans); corr = OxiCorrect(eab->ans);
if (corr) { if (corr) {

View File

@ -25,6 +25,7 @@ Markus Zolliker, March 2005
#define ILLPRIV -5 #define ILLPRIV -5
#define BADLOG -6 #define BADLOG -6
#define UNKPAR -7 #define UNKPAR -7
#define PARUNDEF -8
typedef enum { NO_OP, FMT_OP, SET_OP, GET_OP, INIT_OP } ParOp; 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, SCPrintf(con, eError, "ERROR: %s %s is unknown", o->name,
ctx->thisPar); ctx->thisPar);
break; break;
/* case PARUNDEF:
case BUSY: SCPrintf(con, eError, "ERROR: %s %s is undefined",
SCPrintf(con, eError, "ERROR: %s busy", o->name); o->name, ctx->thisPar);
break; break;
*/
default: default:
if (ctx->returnValue < 0) { if (ctx->returnValue < 0) {
return -1; return -1;
@ -1199,10 +1199,11 @@ void ParFloat(float *value, float defValue)
case FMT_OP: case FMT_OP:
if (*value == PAR_NAN) { if (*value == PAR_NAN) {
ctx->fmt = NULL; ctx->fmt = NULL;
ParOut(""); /* undefined */ /* ctx->returnValue = PARUNDEF; */
ParOut("");
} else { } else {
if (ctx->fmt == NULL) { if (ctx->fmt == NULL) {
ctx->fmt = "%#.5g"; ctx->fmt = "%.5g";
} }
snprintf(buf, sizeof buf, ctx->fmt, *value); snprintf(buf, sizeof buf, ctx->fmt, *value);
ctx->fmt = NULL; ctx->fmt = NULL;
@ -1249,7 +1250,8 @@ void ParInt(int *value, int defValue)
/* fall through */ /* fall through */
case FMT_OP: case FMT_OP:
if (*value == PAR_LNAN) { if (*value == PAR_LNAN) {
ParOut(""); /* undefined */ /* ctx->returnValue = PARUNDEF; */
ParOut(""); /* undefined */
} else { } else {
snprintf(buf, sizeof buf, "%d", *value); snprintf(buf, sizeof buf, "%d", *value);
ParOut(buf); ParOut(buf);

View File

@ -745,7 +745,7 @@ static int TASScanCount(pScanData self, int iPoint)
*/ */
fVal = GetCounterPreset(self->pCounterData); fVal = GetCounterPreset(self->pCounterData);
eOld = GetStatus(); eOld = GetStatus();
status = DoCount(self->pCounterData, fVal, self->pCon, 1); status = DoCount(self->pCounterData, fVal, self->pCon, 2);
iRet = Wait4Success(GetExecutor()); iRet = Wait4Success(GetExecutor());
if (iRet == DEVINT) { if (iRet == DEVINT) {
SCWrite(self->pCon, "Counting aborted due to Interrupt", eLog); 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)) if (!SCMatchRights(pCon, usUser))
return 0; 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 check if we are a fast scan or a normal scan
*/ */

View File

@ -113,9 +113,7 @@ int TecsWrapper(SConnection * pCon, SicsInterp * pSics, void *pData,
assert(pD); assert(pD);
pMe = pD->pPrivate; pMe = pD->pPrivate;
assert(pMe); assert(pMe);
strcpy(pBueffel, " "); snprintf(pBueffel, sizeof pBueffel, " %s ", argv[1]);
strcat(pBueffel, argv[1]);
strcat(pBueffel, " ");
strtolower(pBueffel); strtolower(pBueffel);
if (0 == strcmp(pBueffel, " targetvalue ")) { if (0 == strcmp(pBueffel, " targetvalue ")) {
if (argc == 2) { if (argc == 2) {