- cleaned up makefiles
- polished code to avoid warnings
This commit is contained in:
43
tecs/tecs.c
43
tecs/tecs.c
@@ -147,7 +147,6 @@ static int
|
||||
maxfld, /* last used display field */
|
||||
busy, /* busy after CRVSAV */
|
||||
relay, relay0, /* relay status */
|
||||
deviceFlag, /* device given via net */
|
||||
num, /* curve number */
|
||||
key, /* key status */
|
||||
serialNo=340000, /* initialize with a valid, but not existing value */
|
||||
@@ -284,9 +283,8 @@ int InstalCurve(SensorT *sensor, char *devArg) {
|
||||
char *crv, *entry, *points, *start,
|
||||
*s, /* start of found entry */
|
||||
*e, /* cache part after found entry */
|
||||
*res, *t;
|
||||
int i, n, c1, c2;
|
||||
char ch;
|
||||
*t;
|
||||
int i, n;
|
||||
char used[60];
|
||||
FILE *fil;
|
||||
|
||||
@@ -690,7 +688,7 @@ again:
|
||||
s->typ=typ;
|
||||
s->band=10;
|
||||
if (s->scale==0.0) s->scale=1.0;
|
||||
if (s->alarm==0.0 && typ=='m' || typ=='s') {
|
||||
if ((s->alarm==0.0 && typ=='m') || typ=='s') {
|
||||
s->alarm=tLimit;
|
||||
s->customAlarm=0;
|
||||
} else {
|
||||
@@ -1017,7 +1015,7 @@ int ReadTemp(void) {
|
||||
}
|
||||
|
||||
stat=(s->stat1 & s->stat2) & (255-3); /* ignore "old reading" and "invalid reading", error must be on min & max */
|
||||
if (stat > s->readStat || stat==0 && s->readStat>0) {
|
||||
if (stat > s->readStat || (stat==0 && s->readStat>0)) {
|
||||
err=LscReadStat(stat);
|
||||
if (*err=='\0') {
|
||||
logfileOut(LOG_MAIN, "reading o.k. %s\n", s->ch);
|
||||
@@ -1302,8 +1300,8 @@ int SetTemp(int switchOn) {
|
||||
}
|
||||
|
||||
void CalcMaxPower(void) {
|
||||
int i, j, vmax;
|
||||
float pa, pr, pw, quo, p, pl, plim, h;
|
||||
int i, j;
|
||||
float pa, pr, pw, quo, p, plim, h;
|
||||
|
||||
iAmp=1; iRange=0;
|
||||
maxCurrent=0;
|
||||
@@ -1346,7 +1344,6 @@ void CalcMaxPower(void) {
|
||||
|
||||
int PutFloat(StrBuf *buf, int prec, float f) {
|
||||
char num[32], fmt[32];
|
||||
int l;
|
||||
|
||||
if (f == DATA_UNDEF) {
|
||||
return StrPut(buf, "NaN", StrNONE);
|
||||
@@ -1393,7 +1390,7 @@ int PidSumHdl(int mode, void *base, int fd) {
|
||||
int SetMaxPower(void) {
|
||||
/* static float p0; */
|
||||
static float lastCurrent, limCurrent, pold;
|
||||
float plim;
|
||||
/* float plim; */
|
||||
|
||||
if (loop == 1) {
|
||||
if (initMaxPower) {
|
||||
@@ -1719,7 +1716,7 @@ int ConfigByCode(int plugNr) {
|
||||
while (p!=NULL && plug->code != c1 && plug->code != c2) {
|
||||
if (*p != '#') {
|
||||
c1=0; c2=0;
|
||||
sscanf(buf, "%15s %d %d", &nam, &c1, &c2);
|
||||
sscanf(buf, "%15s %d %d", nam, &c1, &c2);
|
||||
}
|
||||
p=fgets(buf, sizeof(buf), fil);
|
||||
}
|
||||
@@ -1764,8 +1761,8 @@ int PeriodicTask(void) {
|
||||
static int lastIntTim;
|
||||
char buf[256], lbuf[16];
|
||||
char *next, *alms;
|
||||
int i, k, iret, cnt;
|
||||
float t3[3], p, d, w, t, dif, htr0, mstep, fdif;
|
||||
int i, k, cnt;
|
||||
float p, d, w, t, dif, htr0, mstep, fdif;
|
||||
|
||||
if (nScan==0) {
|
||||
ERR_P(LscCmd(ser, "DIOST?>cod1,out1;DOUT 3,29;BUSY?>busy"));
|
||||
@@ -1773,7 +1770,7 @@ int PeriodicTask(void) {
|
||||
cod1=0;
|
||||
ERR_P(LscCmd(ser, "BUSY?>busy"));
|
||||
}
|
||||
if (plug0.codDefined && plug1.codDefined || nScan>0) {
|
||||
if ((plug0.codDefined && plug1.codDefined) || nScan>0) {
|
||||
per=period; /* no timeout on above command and codes are defined: normal period */
|
||||
if (per>logPeriod*1000) per=logPeriod*1000;
|
||||
}
|
||||
@@ -1976,8 +1973,8 @@ int PeriodicTask(void) {
|
||||
}
|
||||
fdif=FakeScale(ctlSens, tr)-t;
|
||||
fbuf=htr-mout-prop/6*fdif; /* value of integrator (assume deriv=0) */
|
||||
if (fbuf > 99.8 && mout < 0 && fdif > 0 ||
|
||||
fbuf < 0.2 && mout > 0 && fdif < 0) { /* probably integrator overflow */
|
||||
if ((fbuf > 99.8 && mout < 0 && fdif > 0) ||
|
||||
(fbuf < 0.2 && mout > 0 && fdif < 0)) { /* probably integrator overflow */
|
||||
if (lastIntTim > 0) {
|
||||
mout += fdif*prop*integ/3000*(rdTim-lastIntTim); /* use mout for integral */
|
||||
if (mout < -100) mout=-100;
|
||||
@@ -2105,7 +2102,7 @@ int PeriodicTask(void) {
|
||||
}
|
||||
|
||||
int DeviceHdl(int mode, void *base, int fd) {
|
||||
char *t, *res;
|
||||
char *t;
|
||||
int do0, do1;
|
||||
|
||||
if (mode==COC_WR) {
|
||||
@@ -2212,7 +2209,7 @@ int SwapHdl(int mode, void *base, int fd) {
|
||||
}
|
||||
|
||||
int SetPower(float setpower) {
|
||||
float htr1, htr0, diff, dist;
|
||||
float htr1, htr0;
|
||||
int cnt;
|
||||
|
||||
logfileOut(LOG_MAIN,"SetPower\n");
|
||||
@@ -2401,7 +2398,6 @@ int LogHdl(int mode, void *base, int fd) {
|
||||
data->logpos=logfileGetLines(data->logpos, 25, data->logline, sizeof(data->logline));
|
||||
}
|
||||
return 0;
|
||||
OnError: return -1;
|
||||
}
|
||||
|
||||
int PltHdl(int mode, void *base, int fd) {
|
||||
@@ -2413,8 +2409,7 @@ int PltHdl(int mode, void *base, int fd) {
|
||||
}
|
||||
|
||||
int GraHdl(int mode, void *base, int fd) {
|
||||
ClientData *data;
|
||||
int l, i;
|
||||
int l;
|
||||
char names[64];
|
||||
long startTime, endTime, step;
|
||||
|
||||
@@ -2466,10 +2461,9 @@ int ShowSensor(StrBuf *buf, SensorT *s, char *name, char *units, char lim) {
|
||||
}
|
||||
|
||||
int StatusHdl(int mode, void *base, int fd) {
|
||||
int i, stat, typ;
|
||||
int i;
|
||||
StrBuf buf;
|
||||
float tM, tS;
|
||||
SensorT *s;
|
||||
char pendAct[256];
|
||||
char *p;
|
||||
|
||||
@@ -2654,7 +2648,6 @@ int UpdateHdl(int mode, void *base, int fd) {
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
OnError: return -1;
|
||||
}
|
||||
|
||||
int RemoteHdl(int mode, void *base, int fd) {
|
||||
@@ -2726,7 +2719,7 @@ int ExecuteRequest(void) {
|
||||
}
|
||||
|
||||
int MainBody(void) {
|
||||
int i, iret, tdif;
|
||||
int iret, tdif;
|
||||
|
||||
logfileWrite(logMask);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user