- introduced header file dependency check

- improvements in tecs
This commit is contained in:
zolliker
2009-11-10 10:40:38 +00:00
parent 52cbe619eb
commit 8618a31a31
4 changed files with 77 additions and 14 deletions

View File

@ -365,6 +365,12 @@ $(CFGDIR)x50991.crv: ccrv inp/x50991.inp
$(CFGDIR)x51079.crv: ccrv inp/x51079.inp
$Q -p$(CFGDIR)
$(CFGDIR)x55606.crv: ccrv inp/x55606.inp
$Q -p$(CFGDIR)
$(CFGDIR)x55918.crv: ccrv inp/x55918.inp
$Q -p$(CFGDIR)
$(CFGDIR)z030114.crv: ccrv inp/z030114.inp
$Q -p$(CFGDIR)
@ -491,6 +497,8 @@ all_crv: dev.list \
$(CFGDIR)x50923.crv \
$(CFGDIR)x50991.crv \
$(CFGDIR)x51079.crv \
$(CFGDIR)x55606.crv \
$(CFGDIR)x55918.crv \
$(CFGDIR)z030114.crv \
ALLINP= \
@ -616,5 +624,7 @@ inp/x50921.inp \
inp/x50923.inp \
inp/x50991.inp \
inp/x51079.inp \
inp/x55606.inp \
inp/x55918.inp \
inp/z030114.inp \

View File

@ -21,6 +21,8 @@ TECLI_OBJ =tecs_client.o tecs_plot.o str.o instr_hosts.o \
HARDSUPLIB = ../hardsup/libhlib.a
OBJ = $(SERV_OBJ) $(TECLI_OBJ)
libtecsl.a: $(CLI_OBJ)
rm -f $@
$(AR) $(ARFLAGS) $@ $Q
@ -82,4 +84,4 @@ pg_plus/libpgplus.a:
cd pg_plus; make $(MFLAGS)
clean:
rm -f *.o *.a six keep_running TecsServer TecsClient
rm -f *.o *.a *.d six keep_running TecsServer TecsClient

View File

@ -11,7 +11,7 @@ SICS=..
CC = gcc
FC = g77
CFLAGS = -DLINUX -g $(DFORTIFY) -I../.. -I. -Wall -Wno-missing-braces
CFLAGS = -DLINUX -g $(DFORTIFY) -I../.. -I. -Wall -Wno-missing-braces -MMD
FFLAGS = -Wimplicit -g
ARFLAGS = cr
@ -38,3 +38,6 @@ F=$<
C=$<
include make_gen
-include $(OBJ:.o=.d)

View File

@ -29,6 +29,8 @@
#define LSC_CODES "lsc.codes"
#define LOGLIFETIME 24*3600
#define CELSIUS 2
static SerChannel *ser=NULL;
static char binDir[256]="";
static char logDir[256]="";
@ -109,6 +111,7 @@ static Plug
static float
set, /* set T */
setH, /* set T on heat exchanger */
set2, /* set T of seconds loop in two loop mode */
htr, power=DATA_UNDEF, /* heater current percentage, heater power */
tLimit, /* temperature limit */
tMaxLimit, /* maximal temperature limit */
@ -170,6 +173,7 @@ static int
ibuf, /* temporary int. buffer */
htrst, htrst0, /* heater status */
loop=1, /* active loop */
twoloops=0, /* two active loops */
touched, /* user touched keys */
tim0, /* msec Time */
per, /* effective period */
@ -181,6 +185,7 @@ static int
swRangeOn=60, /* when not happen several times within less than 60 sec. delay,
switch heater range on when controller switched it off */
initMaxPower=0, /* set MaxPower for the first time */
unit=1, /* 1: Kelvin, 2: Celsius */
lockAlarm,
cntError;
@ -444,7 +449,7 @@ int InstalCurve(SensorT *sensor, char *devArg) {
if (!LscEqPar(buf1, intype) || atoi(buf2)!=num || buf3[0]!='1') {
ERR_P(LscCmd(ser, "ANALOG 2:0,3;INSET [chan],1"));
if (chan[1]<='1') ERR_P(LscCmd(ser, "RANGE:0;INTYPE [chan]:[intype]"));
ERR_P(LscCmd(ser, "INCRV [chan]:[num];MNMX [chan]:1,1"));
ERR_P(LscCmd(ser, "INCRV [chan]:[num];MNMX [chan]:1,[unit]"));
logfileOut(LOG_MAIN, "curve %d on channel %s selected\n", num, chan);
} else {
logfileOut(LOG_MAIN, "curve %d on channel %s is already selected\n", num, chan);
@ -494,7 +499,7 @@ int InstalCurve(SensorT *sensor, char *devArg) {
/* write header, select curve */
str_upcase(head, chead);
ERR_P(LscCmd(ser, "CRVHDR [num]:[head];INCRV [chan]:[num];MNMX [chan]:1,1"));
ERR_P(LscCmd(ser, "CRVHDR [num]:[head];INCRV [chan]:[num];MNMX [chan]:1,[unit]"));
logfileOut(LOG_MAIN, "curve %d selected on channel %s\n", num, chan);
saveTime=tim+30;
}
@ -502,7 +507,7 @@ int InstalCurve(SensorT *sensor, char *devArg) {
if (sens->scale != 1.0 || sens->kink != 0.0) { /* scaling for display */
fbuf = sens->kink * (1.0 - sens->scale);
ERR_P(LscCmd(ser, "LINEAR [chan]:1,[sens.scale],1,1,[fbuf]"))
ERR_P(LscCmd(ser, "LINEAR [chan]:1,[sens.scale],[unit],1,[fbuf]"));
}
if (settingsFlag==0) sens->present=1;
/*
@ -631,9 +636,11 @@ again:
keepT=0;
swRangeOn=60;
loop=1;
twoloops=0;
initMaxPower=1;
resist=10;
nScan=0;
unit=1;
} else {
InitSensor(&sensC);
InitSensor(&sensD);
@ -1038,7 +1045,11 @@ int ReadTemp(void) {
}
}
ibuf = iScan-1;
ERR_P(LscCmd(ser, "KRDG?[chan]>fbuf;DOUT 3,[ibuf];XSCAN 1,[iScan];DISPFLD [sens.dispfld],[chan],1"));
if (unit == CELSIUS) {
ERR_P(LscCmd(ser, "CRDG?[chan]>fbuf;DOUT 3,[ibuf];XSCAN 1,[iScan];DISPFLD [sens.dispfld],[chan],[unit]"));
} else {
ERR_P(LscCmd(ser, "KRDG?[chan]>fbuf;DOUT 3,[ibuf];XSCAN 1,[iScan];DISPFLD [sens.dispfld],[chan],[unit]"));
}
lastRead = now;
s->t = fbuf;
}
@ -1068,6 +1079,8 @@ int ReadTemp(void) {
buf[1]='D';
buf[2]='A';
buf[3]='T';
} else if (unit == CELSIUS) {
buf[0]='C'; /* change KRDG to CRDG */
}
doit=1;
}
@ -1152,6 +1165,8 @@ int ReadTemp(void) {
if (s->scale > 1.0 && s->kink != 0) {
if (s->t > s->kink) {
dispfmt='4';
} else if (unit == CELSIUS) {
dispfmt='2';
} else {
dispfmt='1';
}
@ -1321,9 +1336,11 @@ int SetTemp(int switchOn) {
if (switchOn) {
/* switch off other loop */
if (loop==1) {
ERR_P(LscCmd(ser, "CSET 2:[chan],1,0,0"));
if (twoloops==0) {
ERR_P(LscCmd(ser, "CSET 2:[chan],[unit],0,0"));
}
} else {
ERR_P(LscCmd(ser, "CSET 1:[chan],1,0,0"));
ERR_P(LscCmd(ser, "CSET 1:[chan],[unit],0,0"));
}
if (ramp > 0 && set != 0) {
/* take ramp from actual temperature if more than 10 % deviation */
@ -1337,31 +1354,43 @@ int SetTemp(int switchOn) {
fbuf = ctlSens->t;
tr = TrueScale(ctlSens, fbuf);
ERR_P(LscCmd(ser, "SETP [loop],[fbuf];RAMP [loop],0,0;SETP [loop],[fbuf]"));
if (twoloops) {
ERR_P(LscCmd(ser, "SETP 2,[fbuf];RAMP 2,0,0;SETP 2,[fbuf]"));
}
}
}
}
if (set==0) {
mout=0;
ERR_P(LscCmd(ser, "CSET [loop]:[chan],1,1,[keepT];MOUT [loop],0"));
ERR_P(LscCmd(ser, "CSET [loop]:[chan],[unit],1,[keepT];MOUT [loop],0"));
if (twoloops) {
ERR_P(LscCmd(ser, "CSET 2:D,[unit],1,[keepT];MOUT [loop],0"));
}
if (loop==1) {
ERR_P(LscCmd(ser, "RANGE:0"));
jRange=0;
if (twoloops) {
ERR_P(LscCmd(ser, "ANALOG 2:0,0"));
}
} else {
ERR_P(LscCmd(ser, "ANALOG 2:0,0"));
}
setH=0;
} else if (switchOn) { /* switch on also when bad heater message and no alarms: || (htrst>=5 && !relay)) */
ERR_P(LscCmd(ser, "CSET [loop]:[chan],1,1,[keepT]"));
ERR_P(LscCmd(ser, "CSET [loop]:[chan],[unit],1,[keepT]"));
if (loop==1) {
ERR_P(LscCmd(ser, "RANGE:[iRange]"));
jRange=iRange;
if (twoloops) {
ERR_P(LscCmd(ser, "ANALOG 2:0,3"));
}
} else {
ERR_P(LscCmd(ser, "ANALOG 2:0,3"));
}
} else {
ERR_P(LscCmd(ser, "CSET?[loop]>,buf1,"));
if (buf1[0] != '1') {
ERR_P(LscCmd(ser, "CSET [loop]:[chan],1"));
if (buf1[0] != ('0' + unit)) {
ERR_P(LscCmd(ser, "CSET [loop]:[chan],[unit]"));
}
}
showSet=(0!=strcmp(ctlSens->ch, controlChannel) || switchOn);
@ -1370,10 +1399,16 @@ int SetTemp(int switchOn) {
ERR_P(LscCmd(ser, "RAMP?[loop]>buf1,"));
if (buf1[0] != '0') {
ERR_P(LscCmd(ser, "RAMP [loop]:0,[ramp]"));
if (twoloops) {
ERR_P(LscCmd(ser, "RAMP 2:0,[ramp]"));
}
}
ERR_P(LscCmd(ser, "SETP?[loop]>fbuf"));
if (fabsf(setH-fbuf) >= (fbuf+setH)*1.0e-5) {
ERR_P(LscCmd(ser, "SETP [loop]:[setH]"));
if (twoloops) {
ERR_P(LscCmd(ser, "SETP 2:[set2]"));
}
if (!doubleControl && !showSet) {
logfileOut(LOG_MAIN, "set %g (on %s) (was changed %g -> %g)\n", set, ctlSens->ch, fbuf, setH);
}
@ -1400,6 +1435,9 @@ int SetTemp(int switchOn) {
fbuf = fbuf / ctlSens->scale;
if (fbuf<0.1) fbuf=0.1;
ERR_P(LscCmd(ser, "RAMP [loop]:1,[fbuf];SETP [loop],[setH]"));
if (twoloops) {
ERR_P(LscCmd(ser, "RAMP 2:1,[fbuf];SETP 2,[set2]"));
}
ERR_P(LscCmd(ser, "SETP?[loop]>fbuf"));
tr=TrueScale(ctlSens, fbuf);
if (showSet) {
@ -1617,6 +1655,9 @@ int SetMaxPower(void) {
cod1=1;
}
ERR_P(LscCmd(ser, "CDISP 1:[loop],[resist],1;MOUT [loop]:0;CMODE [loop]:[cod1]"));
if (twoloops) {
ERR_P(LscCmd(ser, "CDISP 2:3,[resist],1;MOUT 2:0;CMODE 2:[cod1]"));
}
mout=0;
jRange=0;
if (slope<0) slope=-slope;
@ -1630,6 +1671,9 @@ int SetMaxPower(void) {
prop=prop*lastCurrent/maxCurrent;
}
ERR_P(LscCmd(ser, "CLIMIT 1:[fbuf],[slope],0,[iAmp],[iRange];PID [loop],[prop]"));
if (twoloops) {
ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0"));
}
} else {
ERR_P(LscCmd(ser, "CLIMIT 2:[fbuf],[slope],0"));
}
@ -1655,7 +1699,7 @@ int ConfigAlarms(float genLimit) {
if (s->customAlarm==0 && genLimit>0.0) s->alarm=genLimit;
if (s->present==1 && s->alarm>0) {
r1=FakeScale(s, s->alarm);
ERR_P(LscCmd(ser, "ALARM [buf1]:1,1,[r1],0,1,1"));
ERR_P(LscCmd(ser, "ALARM [buf1]:1,[unit],[r1],0,1,1"));
alarmList[k]=s->ch;
k++;
} else if (i != 4) { /* do not switch off A0 alarm */
@ -1687,7 +1731,7 @@ int DisplayFmt(SensorT *s, SensorT *fields[], int *dispfld) {
s->dispfmt='4';
} else {
if (s->scale == 1.0 || s->kink > 0.0) {
s->dispfmt='1';
s->dispfmt='0' + unit;
} else {
s->dispfmt='4';
}
@ -3391,6 +3435,7 @@ int main(int argc, char *argv[]) {
CocDefFlt(integ, RW); CocHdl(PidHdl);
CocDefFlt(deriv, RW); CocHdl(PidHdl);
CocDefFlt(set, RW); CocHdl(SetHdl);
CocDefFlt(set2, RW); CocHdl(SetHdl);
CocDefFlt(ramp, RW); CocHdl(SetHdl);
CocDefFlt(still, RW); CocHdl(StillHdl);
CocDefFlt(power, RW); CocHdl(PowerHdl);
@ -3476,6 +3521,7 @@ int main(int argc, char *argv[]) {
CocDefInt(manual, RW); CocHdl(ManualHdl);
CocDefInt(htrst, RD);
CocDefInt(loop, RW);
CocDefInt(twoloops, RW);
CocDefInt(rdTim, RD);
CocDefInt(tim0, RD);
CocDefInt(ibuf, RD);
@ -3492,6 +3538,7 @@ int main(int argc, char *argv[]) {
CocDefInt(keepT, RW);
CocDefInt(swRangeOn, RW);
CocDefInt(doubleControl, RW);
CocDefInt(unit, RW);
CocDefStr(controlSensor, RW); CocHdl(SetHdl);
@ -3638,6 +3685,7 @@ int main(int argc, char *argv[]) {
ERR_P(DataCreateSet(NULL, "ScanChan", &scanChan, logPeriod, LOGLIFETIME, tim));
DataUndef(0);
ERR_P(DataCreateSet(NULL, "Set", &set, logPeriod, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "Set2", &set2, logPeriod, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "shiftUp", &shiftUp, logPeriod, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "shiftLow", &shiftLow, logPeriod, LOGLIFETIME, tim));
ERR_P(DataCreateSet(NULL, "state", &state, logPeriod, LOGLIFETIME, tim));