*** empty log message ***

This commit is contained in:
cvs
2000-03-20 07:38:12 +00:00
parent 4dd4d06ba0
commit 72589129c3
12 changed files with 192 additions and 160 deletions

View File

@@ -90,7 +90,7 @@ int instCurve(char *nam, char chan) {
FILE *fil;
int retstat;
logfileOut("install curve %s\n", nam);
logfileOut(LOG_MAIN, "install curve %s\n", nam);
retstat=-2; /* errors in following section are severe */
fil=NULL;
crv=NULL;
@@ -165,10 +165,10 @@ int instCurve(char *nam, char chan) {
sprintf(buf, "INTYPE %c:%s;INCRV %c:%d;DISPFLD %d:%c,1;DISPLAY:%d"
, chan, intype, chan, num, fld, chan, maxfld);
ERR_I(LscCmdChk(ser, buf));
logfileOut("curve %d on channel %c selected\n", num, chan);
logfileOut(LOG_MAIN, "curve %d on channel %c selected\n", num, chan);
} else { /* header does not match -> download */
if (busy) ERR_MSG("busy");
logfileOut("download curve %d\n", num);
logfileOut(LOG_MAIN, "download curve %d\n", num);
sprintf(buf, "INTYPE %c:%s;DISPFLD %d:%c,3;DISPLAY:%d"
, chan, intype, fld, chan, maxfld); /* select sensor type first to display sensor units */
ERR_I(LscCmdChk(ser, buf));
@@ -188,7 +188,7 @@ int instCurve(char *nam, char chan) {
} while (t!=NULL);
sprintf(buf, "CRVHDR %d:%s;INCRV %c:%d;DISPFLD %d:%c,1", num, crv, chan, num, fld, chan); /* write header, select curve */
ERR_I(LscCmdChk(ser, buf));
logfileOut("curve selected on channel %c\n", chan);
logfileOut(LOG_MAIN, "curve selected on channel %c\n", chan);
str_copy(head, crv);
str_upcase(head);
saveIt=1;
@@ -403,7 +403,7 @@ int ReadTemp() {
ERR_P(res=SerCmdC(ser, "DIOST?;HTR?;BUSY?;DOUT 3,29"));
if (0==strcmp(res, "?TMO")) {
if (0==noResp) logfileOut("no response\n");
if (0==noResp) logfileOut(LOG_MAIN ,"no response\n");
noResp=1;
return(0);
}
@@ -450,10 +450,14 @@ int ReadTemp() {
DlogPut(&dset, tim, 2, t2); DlogUpd(&dset);
logTime=(tim/logPeriod+1)*logPeriod;
}
if (nP>0 && nX>0 && controlMode==2) {
if (nP>0 && nX>0 && controlMode==2 && tempC!=0) {
d=tempH-tempX; d=exp(-d*d); /* if d is small, we are far from setpoint */
if (tInt<60000/period) tInt+=d; /* increase integral time until 60 sec. */
p=d/tInt;
if (tInt>d) {
p=d/tInt;
} else {
p=1.0;
}
tShift=tShift*(1.0-p)+p*(tempX-tempP);
ERR_I(SetTemp(0));
}
@@ -492,7 +496,7 @@ int ReadTemp() {
if (key!=0) {
auto_remote_time=tim+600;
if (!(dirtyX || dirtyP)) {
logfileOut("user touched keys\n");
logfileOut(LOG_MAIN ,"user touched keys\n");
}
dirtyX=1; dirtyP=1;
ERR_P(res=SerCmdC(ser, "MODE?"));
@@ -512,10 +516,16 @@ int Settings() {
if (dirtyX || dirtyP) {
if (busy==0 || dirtyX>=0 && dirtyP>=0) { /* do not enter when busy and dirtyX/P indicates error on last time */
if (device[0]=='\0') {
logfileOut("configure inputs for codes %d %d\n", codX, codP);
logfileOut(LOG_MAIN ,"configure inputs for ");
if (manualX) {
logfileOut(LOG_MAIN ,"%s ", deviceX);
} else {
logfileOut("configure inputs for %s\n", device);
logfileOut(LOG_MAIN ,"%+d ", codX);
}
if (manualP) {
logfileOut(LOG_MAIN ,"%s\n", deviceP);
} else {
logfileOut(LOG_MAIN ,"%+d\n", codP);
}
if (dirtyP) {
sprintf(buf, "DISPFLD 2:%c,1;DISPFLD 4:%c,1", channel[1], channel[3]);
@@ -620,12 +630,12 @@ int ExecuteRequest() {
if (tim>auto_remote_time || setFlag) ERR_I(Settings());
if (setFlag) {
if (nX>0) {
if (nX>0 && tempC!=0) {
tInt=0; /* reset integral time */
ERR_I(SetTemp(1));
logfileOut("set point\n");
logfileOut(LOG_MAIN ,"set point\n");
} else {
logfileOut("flag reset\n");
logfileOut(LOG_MAIN ,"flag reset\n");
}
setFlag=0;
}
@@ -682,14 +692,16 @@ int main(int argc, char *argv[])
char *host;
char buf[256], opt;
int port, msecTmo;
int logMask;
logMask=LOG_MAIN;
binDir="";
logDir="";
serverId="tecs";
host="lnsp26";
port=0;
msecTmo=0;
logfileOutTmp("%s ", argv[0]);
logfileOut(LOG_MAIN ,"%s ", argv[0]);
for (i=1;i<argc;i++) {
if (argv[i]!=NULL) {
if (argv[i][0]=='-') {
@@ -699,6 +711,7 @@ int main(int argc, char *argv[])
}
if ('l'==opt) {
logIt=1;
logMask=LOG_ALL;
period=5000;
opt=' ';
} else if ('s'==opt) {
@@ -723,10 +736,10 @@ int main(int argc, char *argv[])
i++;
port=atoi(argv[i]);
} else {
logfileOutTmp("?");
logfileOut(LOG_MAIN ,"?");
}
if (opt!=' ') logfileOutTmp("-%c ", opt);
logfileOutTmp("%s ", argv[i]);
if (opt!=' ') logfileOut(LOG_MAIN ,"-%c ", opt);
logfileOut(LOG_MAIN ,"%s ", argv[i]);
}
}
if (port==0) port=9753;
@@ -736,8 +749,8 @@ int main(int argc, char *argv[])
str_append(buf, serverId);
logfileInit(buf, logIt);
logfileOutTmp("\n");
logfileWriteTmp();
logfileOut(LOG_MAIN ,"\n");
logfileWrite(logMask);
ERR_I(CocInitServer(1024, port));
@@ -749,7 +762,7 @@ int main(int argc, char *argv[])
CocDefInt(controlMode, CocWR);
CocDefInt(quit, CocWR);
ERR_P(ser=SerOpen(host, logIt, msecTmo, idleHdl));
ERR_P(ser=SerOpen(host, msecTmo, idleHdl));
ERR_I(CocHandleRequests(100, 0));
ftime(&tim0);
str_copy(buf, logDir);
@@ -760,12 +773,6 @@ int main(int argc, char *argv[])
ERR_I(DlogCreate(&dset, buf, tim0.time, 2, 24*60*60/logPeriod, logPeriod, 0.0));
}
while (!quit) {
logfileStamp("");
if (logIt) {
logfileWriteTmp();
} else {
logfilePurge();
}
/* read & control temp */
iret=ReadTemp();
if (iret<0) logfileShowErr("ReadTemp");
@@ -773,6 +780,7 @@ int main(int argc, char *argv[])
iret=Settings();
if (iret<0) logfileShowErr("Settings");
}
logfileWrite(logMask);
while (!quit) {
ftime(&tim1);
@@ -784,6 +792,7 @@ int main(int argc, char *argv[])
tim=tim1.time;
iret=ExecuteRequest();
if (iret<0) logfileShowErr("ExecuteRequest");
logfileWrite(logMask);
}
ftime(&tim1);
tdif=((tim1.time-tim0.time)*1000+tim1.millitm-tim0.millitm)/period;
@@ -791,10 +800,10 @@ int main(int argc, char *argv[])
tim0.time+=i / 1000;
tim0.millitm=i % 1000;
if (tdif>1) {
logfileOut("%d cycles lost\n", tdif-1);
logfileOut(LOG_MAIN ,"%d cycles lost\n", tdif-1);
}
}
logfileOut("%s got quit command\n", serverId);
logfileOut(LOG_MAIN ,"%s got quit command\n", serverId);
DlogClose(&dset);
return(1);
OnError: