- amilevel lsc30driv lscsupport marked as obsolete and removed from make_gen
- some bug fixes to ease.c fsm.c - added extensions to ighdriv and ipsdriv
This commit is contained in:
@ -4,6 +4,8 @@ amilevel.c
|
||||
Driver for the AMI 135/136 level meter
|
||||
|
||||
Markus Zolliker, May 2007
|
||||
|
||||
OBSOLETE, replaced by scriptcontext driver, May 2016
|
||||
----------------------------------------------------------------------------*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
8
ease.c
8
ease.c
@ -120,6 +120,7 @@ void EaseWrite(EaseBase * eab, char *cmd)
|
||||
int l;
|
||||
|
||||
if (eab->errCode) {
|
||||
FsmStop(eab->task, eab->idle);
|
||||
eab->state = EASE_abort;
|
||||
return;
|
||||
}
|
||||
@ -396,6 +397,9 @@ static long EaseIdle(long pc, void *object)
|
||||
switch (pc) {
|
||||
default: /* FSM BEGIN ****************************** */
|
||||
EasePchk(eab);
|
||||
if (eab->state == EASE_abort) {
|
||||
eab->state = EASE_idle;
|
||||
}
|
||||
|
||||
idle:
|
||||
if (!EaseCheckDoit(eab))
|
||||
@ -408,10 +412,8 @@ static long EaseIdle(long pc, void *object)
|
||||
case __LINE__: /**********************************/
|
||||
|
||||
eab->startOk = 1;
|
||||
if (eab->state == EASE_abort) {
|
||||
eab->state = EASE_idle;
|
||||
}
|
||||
rd:
|
||||
/* rd: */
|
||||
/*
|
||||
if (eab->state == EASE_lost) {
|
||||
snprintf(eab->msg, sizeof eab->msg, "no response from %s",
|
||||
|
6
fsm.c
6
fsm.c
@ -155,7 +155,11 @@ int FsmStop(Fsm * task, FsmFunc func)
|
||||
}
|
||||
if (i == task->sp) { /* not found on stack */
|
||||
if (func != task->func)
|
||||
return 0; /* is also not running function */
|
||||
return 0; /* is also not running function */\
|
||||
/*
|
||||
task->sp = 0;
|
||||
task->func = task->stack[0].func; */ /* pretty unsure about this */
|
||||
|
||||
} else {
|
||||
task->sp = i; /* unwind stack to level i */
|
||||
}
|
||||
|
112
ighdriv.c
112
ighdriv.c
@ -82,6 +82,14 @@ typedef struct {
|
||||
int s; /* moving valve state */
|
||||
int remote;
|
||||
long hrSync;
|
||||
float closedelay; /* if > 0: next valve command is a pulsed opening */
|
||||
int closevalve; /* number of valve to be closed */
|
||||
double opentime; /* time when valve was opened */
|
||||
/* extensions (ext_watchdog Arduino) */
|
||||
int extVersion; /* 0 for no extension, else extension version */
|
||||
int pumpoff; /* pump signal after overpressure switch */
|
||||
float upperN2; /* LN2 trap sensor */
|
||||
float lowerN2;
|
||||
} Igh;
|
||||
|
||||
static ParClass ighClass = { "IGH", sizeof(Igh) };
|
||||
@ -277,6 +285,30 @@ static void IghParDef(void *object)
|
||||
ParPrintf(NULL, eValue, "open valves:%s", vList);
|
||||
}
|
||||
|
||||
ParName("closedelay");
|
||||
ParAccess(usUser);
|
||||
ParSave(1);
|
||||
ParFloat(&drv->closedelay, 0);
|
||||
|
||||
ParName("extVersion");
|
||||
ParAccess(usUser);
|
||||
ParSave(1);
|
||||
ParInt(&drv->extVersion, PAR_LNAN);
|
||||
|
||||
ParName("pumpoff");
|
||||
if (drv->extVersion != 0) ParTail("");
|
||||
ParInt(&drv->pumpoff, PAR_LNAN);
|
||||
|
||||
ParName("upperN2");
|
||||
ParFmt("%.1f");
|
||||
if (drv->extVersion != 0) ParTail("K");
|
||||
ParFloat(&drv->upperN2, PAR_NAN);
|
||||
|
||||
ParName("lowerN2");
|
||||
ParFmt("%.1f");
|
||||
if (drv->extVersion != 0) ParTail("K");
|
||||
ParFloat(&drv->lowerN2, PAR_NAN);
|
||||
|
||||
EaseBasePar(drv);
|
||||
EaseSendPar(drv);
|
||||
if (eab->syntax != OLDIGH) {
|
||||
@ -296,6 +328,13 @@ void IghStatus(Igh * drv)
|
||||
|
||||
if (drv->d.b.state != EASE_read)
|
||||
return;
|
||||
|
||||
if (drv->opentime > 0 &&
|
||||
DoubleTime() > drv->opentime + (double)drv->closedelay - 1) {
|
||||
/* force a call to IghSet */
|
||||
drv->d.b.todo = drv->d.b.doit;
|
||||
}
|
||||
|
||||
ans = drv->d.b.ans;
|
||||
code = &drv->d.b.errCode;
|
||||
if (ans[0] != 'X' ||
|
||||
@ -350,8 +389,10 @@ static long IghRead(long pc, void *object)
|
||||
EaseBase *eab = object;
|
||||
char *p;
|
||||
int l;
|
||||
int switched_off;
|
||||
time_t now;
|
||||
float delta;
|
||||
int up10, lo10;
|
||||
|
||||
switch (pc) {
|
||||
default: /* FSM BEGIN ****************************** */
|
||||
@ -561,6 +602,47 @@ static long IghRead(long pc, void *object)
|
||||
case __LINE__: /**********************************/
|
||||
drv->press[P2] = OxiGet(eab, 1, NULL, drv->press[P2]);
|
||||
|
||||
if (EaseCheckDoit(eab) || drv->extVersion == 0)
|
||||
goto quit;
|
||||
|
||||
EaseWrite(eab, "{r}");
|
||||
return __LINE__;
|
||||
case __LINE__: /**********************************/
|
||||
/* analyze */
|
||||
if (3 == sscanf(drv->d.b.ans, "?{%d,%d,%d}",
|
||||
&l, &up10, &lo10)) {
|
||||
switched_off = (drv->v[HE3] == 1 && l == 1);
|
||||
drv->pumpoff = l;
|
||||
drv->upperN2 = 0.1 * up10;
|
||||
drv->lowerN2 = 0.1 * lo10;
|
||||
} else {
|
||||
drv->pumpoff = PAR_LNAN;
|
||||
drv->upperN2 = PAR_NAN;
|
||||
drv->lowerN2 = PAR_NAN;
|
||||
}
|
||||
if (!switched_off) goto quit;
|
||||
/* veryfy pump control */
|
||||
EaseWrite(eab, "X");
|
||||
return __LINE__;
|
||||
case __LINE__: /**********************************/
|
||||
IghStatus(drv);
|
||||
if (drv->v[HE3] == 0) goto quit; /* switched off intentionally */
|
||||
/* overpressure switch activated: we switch pump control off */
|
||||
EaseWrite(eab, "C3");
|
||||
drv->remote = 2;
|
||||
return __LINE__;
|
||||
case __LINE__: /**********************************/
|
||||
EaseWrite(eab, "P49");
|
||||
return __LINE__;
|
||||
case __LINE__: /**********************************/
|
||||
EaseWrite(eab, "C0");
|
||||
return __LINE__;
|
||||
case __LINE__: /**********************************/
|
||||
drv->remote = 0;
|
||||
ParPrintf(eab, eLogError,
|
||||
"ERROR: overpressure after 3He pump (switched off)");
|
||||
eab->errCode = EASE_FAULT;
|
||||
|
||||
quit:
|
||||
ParLog(drv);
|
||||
fsm_quit:return 0;
|
||||
@ -611,6 +693,7 @@ static long IghSet(long pc, void *object)
|
||||
int upd;
|
||||
int i;
|
||||
float mp;
|
||||
double now, deadline;
|
||||
|
||||
switch (pc) {
|
||||
default: /* FSM BEGIN ****************************** */
|
||||
@ -620,6 +703,12 @@ static long IghSet(long pc, void *object)
|
||||
loop:
|
||||
return __LINE__;
|
||||
case __LINE__: /**********************************/
|
||||
if (drv->opentime > 0) {
|
||||
now = DoubleTime();
|
||||
deadline = drv->opentime + (double)drv->closedelay;
|
||||
if (now > deadline) goto close_valve;
|
||||
if (now > deadline - 1) goto loop;
|
||||
}
|
||||
upd = EaseNextUpdate(drv);
|
||||
if (upd >= VALVE_FLAGS)
|
||||
goto set_valve;
|
||||
@ -783,12 +872,34 @@ static long IghSet(long pc, void *object)
|
||||
|
||||
set_valve:
|
||||
i = upd - VALVE_FLAGS;
|
||||
if (drv->closedelay > 0) {
|
||||
if (drv->v[i]) {
|
||||
if (drv->opentime == 0) {
|
||||
drv->opentime = DoubleTime();
|
||||
drv->closevalve = i;
|
||||
}
|
||||
} else if (drv->closevalve == i) {
|
||||
/* early close by command */
|
||||
drv->opentime = 0;
|
||||
drv->closedelay = 0;
|
||||
}
|
||||
}
|
||||
snprintf(buf, sizeof buf, "P%d", i * 2 + 3 - drv->v[i]);
|
||||
EaseWrite(eab, buf);
|
||||
return __LINE__;
|
||||
case __LINE__: /**********************************/
|
||||
goto loop;
|
||||
|
||||
close_valve:
|
||||
drv->opentime = 0;
|
||||
drv->closedelay = 0;
|
||||
drv->v[drv->closevalve] = 0;
|
||||
snprintf(buf, sizeof buf, "P%d", drv->closevalve * 2 + 3); /* close cmd */
|
||||
EaseWrite(eab, buf);
|
||||
return __LINE__;
|
||||
case __LINE__: /**********************************/
|
||||
goto loop;
|
||||
|
||||
set_mot:
|
||||
i = upd - MOT_FLAGS;
|
||||
if (drv->mv[i] > 99.9) {
|
||||
@ -825,6 +936,7 @@ static int IghInit(SConnection * con, int argc, char *argv[], int dynamic)
|
||||
IghSet);
|
||||
if (drv == NULL)
|
||||
return 0;
|
||||
drv->opentime = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ static void IpsStatus(Ips * drv)
|
||||
switch (ans[1]) {
|
||||
case '0':
|
||||
if (ans[6] > '3') {
|
||||
errmsg = "ERROR: auto-run-down (low He level)";
|
||||
errmsg = "ERROR: auto-run-down (He level is/was low - press SILENCE on ILM after filling)";
|
||||
} else {
|
||||
errmsg = "";
|
||||
}
|
||||
@ -462,7 +462,7 @@ static long IpsRead(long pc, void *object)
|
||||
checktodo:
|
||||
if (eab->msg[0] != '\0') goto quit; /* no action when in error */
|
||||
now = time(NULL);
|
||||
if (drv->persmode == 2) { /* persistent mode off */
|
||||
if (drv->persmode >= 2) { /* persistent mode off */
|
||||
drv->dothis = NOTHING;
|
||||
goto nothing;
|
||||
} else {
|
||||
|
@ -4,6 +4,8 @@ lsc370driv.c
|
||||
Driver for the LakeShore Model 370 AC Resistance Bridge
|
||||
|
||||
Markus Zolliker, July 2006
|
||||
|
||||
OBSOLETE, scriptcontext driver in use May 2016
|
||||
----------------------------------------------------------------------------*/
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
@ -6,6 +6,8 @@ Communication routines for LakeShore equipment
|
||||
Markus Zolliker, July 2006
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
OBSOLETE (scriptcontext driver in use) May 2016
|
||||
|
||||
there is no error return value, eab->errCode is used. On success, eab->errCode
|
||||
is not changed, i.e. an existing errCode is not overwritten.
|
||||
*/
|
||||
|
3
make_gen
3
make_gen
@ -32,8 +32,7 @@ OBJ=psi.o buffer.o ruli.o sps.o pimotor.o \
|
||||
|
||||
MZOBJ=fsm.o sugar.o pardef.o ease.o strobj.o oxinst.o \
|
||||
ipsdriv.o ilmdriv.o itcdriv.o ighdriv.o euro2kdriv.o modbus.o arrobj.o \
|
||||
lscsupport.o lsc370driv.o linadriv.o haakedriv.o amilevel.o \
|
||||
seaclientprot.o dumprot.o
|
||||
linadriv.o haakedriv.o seaclientprot.o dumprot.o
|
||||
|
||||
libpsi.a: $(OBJ)
|
||||
rm -f libpsi.a
|
||||
|
Reference in New Issue
Block a user