minor changes in tecs (M.Z.)
This commit is contained in:
176
tecs/tecs.c
176
tecs/tecs.c
@@ -45,7 +45,7 @@ typedef struct {
|
||||
int dirty; /* input config to be reloaded */
|
||||
int try; /* trial count */
|
||||
int manual; /* manual device */
|
||||
int code, code1; /* device code, buffer for device code */
|
||||
int code, code1, code2; /* device code, buffer for device code */
|
||||
int codChanged; /* code has changed */
|
||||
int codDefined; /* code is not yet confirmed */
|
||||
float scale; /* scale for extreme ranges */
|
||||
@@ -70,6 +70,7 @@ static float
|
||||
full, /* full value for helium level */
|
||||
prop, integ, deriv, /* pid */
|
||||
maxShift=2, /* maximal shift in when controlMode=2 */
|
||||
fbuf, /* float buffer */
|
||||
tInt=0; /* integral time (sec.) for setpoint shift */
|
||||
|
||||
static int
|
||||
@@ -97,10 +98,12 @@ static int
|
||||
configuring=1,
|
||||
stable, /* stable since 2 min. */
|
||||
resist, /* heater resistance */
|
||||
cmode=1, /* 1: manual PID, 5: auto PI */
|
||||
readTemp, /* client requested readTemp */
|
||||
cod1, cod2, out1, out2, /* codes read from digital input/output */
|
||||
iRange, iAmp, /* max. range and max. current code */
|
||||
htrst, htrst0, /* heater status */
|
||||
tuning=0,
|
||||
per; /* effective period */
|
||||
|
||||
static time_t
|
||||
@@ -111,7 +114,7 @@ static time_t
|
||||
static int decod[8]={21,20,17,16,5,4,1,0}; /* for code conversion */
|
||||
|
||||
static char
|
||||
status[132], /* status buffer */
|
||||
status[160], /* status buffer */
|
||||
device[64], /* concatenated device names */
|
||||
buf1[256], buf2[256], buf3[256], buf4[256], /* buffers for temporary use */
|
||||
head[64], /* curve header */
|
||||
@@ -287,8 +290,12 @@ int instCurve(char *nam, char *channel, int dispFld) {
|
||||
if (head[0]!='\0' && LscEqPar(head, chead)) { /* header matches: select sensor type and curve */
|
||||
|
||||
retstat=-1; /* an error could be fixed */
|
||||
ERR_P(LscCmd(ser, "RANGE:0;INTYPE [chan]:[intype];INCRV [chan]:[num]"));
|
||||
ERR_P(LscCmd(ser, "MNMX [chan]:1,1;DISPFLD [fld],[chan],1;DISPLAY [maxfld]"));
|
||||
ERR_P(LscCmd(ser, "RANGE:0"));
|
||||
ERR_P(LscCmd(ser, "INTYPE [chan]:[intype]"));
|
||||
ERR_P(LscCmd(ser, "INCRV [chan]:[num]"));
|
||||
ERR_P(LscCmd(ser, "MNMX [chan]:1,1"));
|
||||
ERR_P(LscCmd(ser, "DISPFLD [fld],[chan],1"));
|
||||
ERR_P(LscCmd(ser, "DISPLAY [maxfld]"));
|
||||
logfileOut(LOG_MAIN, "curve %d on channel %s selected\n", num, chan);
|
||||
Progress(100);
|
||||
|
||||
@@ -300,7 +307,9 @@ int instCurve(char *nam, char *channel, int dispFld) {
|
||||
if (busy) ERR_MSG("busy");
|
||||
logfileOut(LOG_MAIN, "download curve %d\n", num);
|
||||
/* select sensor type first to display sensor units */
|
||||
ERR_P(LscCmd(ser, "RANGE:0;INTYPE [chan]:[intype];DISPLAY:[maxfld]"));
|
||||
ERR_P(LscCmd(ser, "RANGE:0"));
|
||||
ERR_P(LscCmd(ser, "INTYPE [chan]:[intype]"));
|
||||
ERR_P(LscCmd(ser, "DISPLAY:[maxfld]"));
|
||||
Progress(1);
|
||||
|
||||
n=3;
|
||||
@@ -328,8 +337,11 @@ int instCurve(char *nam, char *channel, int dispFld) {
|
||||
|
||||
/* write header, select curve */
|
||||
str_upcase(head, chead);
|
||||
ERR_P(LscCmd(ser, "CRVHDR [num]:[head];INCRV [chan]:[num]"));
|
||||
ERR_P(LscCmd(ser, "MNMX [chan]:1,1;DISPFLD [fld],[chan],1;DISPLAY [maxfld]"));
|
||||
ERR_P(LscCmd(ser, "CRVHDR [num]:[head]"));
|
||||
ERR_P(LscCmd(ser, "INCRV [chan]:[num]"));
|
||||
ERR_P(LscCmd(ser, "MNMX [chan]:1,1"));
|
||||
ERR_P(LscCmd(ser, "DISPFLD [fld],[chan],1"));
|
||||
ERR_P(LscCmd(ser, "DISPLAY [maxfld]"));
|
||||
Progress(1);
|
||||
logfileOut(LOG_MAIN, "curve selected on channel %s\n", chan);
|
||||
saveTime=tim+30;
|
||||
@@ -418,6 +430,7 @@ int configInput(void) {
|
||||
|
||||
i=sscanf(t, "%12s%n", nam, &l);
|
||||
if (i<1) ERR_MSG("missing device name");
|
||||
nam[strlen(nam)-1]='\0'; /* strip off quote */
|
||||
t+=l;
|
||||
|
||||
/* interprete settings until '+' appeares */
|
||||
@@ -437,11 +450,12 @@ int configInput(void) {
|
||||
} else {
|
||||
if (!samp.manual && (NULL!=strchr(chanS,'A') || NULL!=strchr(chanS,'B'))) {
|
||||
samp.dirty=1; /* sample and heat exchanger are on main plug */
|
||||
samp.code=cryo.code;
|
||||
samp.manual=1;
|
||||
str_copy(samp.device, nam);
|
||||
}
|
||||
str_copy(ch, chanM);
|
||||
if (heliumMode==0) {
|
||||
sprintf(helium, "no He-level meter for '%s", nam);
|
||||
sprintf(helium, "no He-level meter for %s", nam);
|
||||
} else {
|
||||
sprintf(helium, "He-level meter not yet read", nam);
|
||||
}
|
||||
@@ -451,7 +465,6 @@ int configInput(void) {
|
||||
if (n==0) return(0);
|
||||
if (n>2) ERR_MSG("no more than 2 channels per plug allowed");
|
||||
|
||||
nam[strlen(nam)-1]='\0'; /* strip off quote */
|
||||
if (!tpoint->manual) { /* set device name */
|
||||
str_copy(tpoint->device, nam);
|
||||
concatDevice();
|
||||
@@ -470,10 +483,11 @@ int configInput(void) {
|
||||
str_copy(chan, ch+1);
|
||||
logfileOut(LOG_MAIN, "auxilliary input on channel %s\n", chan);
|
||||
if (ch[0]>'b') {
|
||||
ERR_P(LscCmd(ser, "INTYPE [chan]:0,1,2,1,13;MNMX [chan]:1,3"));
|
||||
ERR_P(LscCmd(ser, "INTYPE [chan]:0,1,2,1,13"));
|
||||
} else {
|
||||
ERR_P(LscCmd(ser, "INTYPE [chan]:0,1,2,1,12;MNMX [chan]:1,3"));
|
||||
ERR_P(LscCmd(ser, "INTYPE [chan]:0,1,2,1,12"));
|
||||
}
|
||||
ERR_P(LscCmd(ser, "MNMX [chan]:1,3"));
|
||||
tpoint->sensor2->present=2;
|
||||
} else {
|
||||
if (ch[1]<'A' || ch[1]>'D') ERR_MSG("illegal channel");
|
||||
@@ -615,17 +629,17 @@ int ReadTemp(void) {
|
||||
for (i=1; i<=4; i++) {
|
||||
sensor=sensors[i];
|
||||
if (sensor->present) {
|
||||
stat=(sensor->stat1 | sensor->stat2) & 255;
|
||||
stat=(sensor->stat1 | sensor->stat2) & (255-2); /* ignore old reading */
|
||||
if (stat != sensor->readStat) {
|
||||
sensor->readStat=stat;
|
||||
if (stat & 1) logfileOut(LOG_MAIN, "invalid reading %s\n", sensor->ch);
|
||||
if (stat & 2) logfileOut(LOG_MAIN, "old reading %s\n", sensor->ch);
|
||||
/* if (stat & 2) logfileOut(LOG_MAIN, "old reading %s\n", sensor->ch); */
|
||||
if (stat & 12) logfileOut(LOG_MAIN, "unknown reading status %s\n", sensor->ch);
|
||||
if (stat & 16) logfileOut(LOG_MAIN, "temp underrange %s\n", sensor->ch);
|
||||
if (stat & 32) logfileOut(LOG_MAIN, "temp overrange %s\n", sensor->ch);
|
||||
if (stat & 64) logfileOut(LOG_MAIN, "units zero %s\n", sensor->ch);
|
||||
if (stat &128) logfileOut(LOG_MAIN, "units overrange %s\n", sensor->ch);
|
||||
if (stat==0) logfileOut(LOG_MAIN, "reading o.k. %s\n", sensor->ch);
|
||||
if (stat==0) logfileOut(LOG_MAIN, "reading o.k. %s\n", sensor->ch);
|
||||
}
|
||||
if (stat==0) {
|
||||
|
||||
@@ -635,7 +649,7 @@ int ReadTemp(void) {
|
||||
sensor->t = (sensor->t1 + sensor->t2) * 0.5; /* mean of min and max */
|
||||
sensor->band = sensor->band/2;
|
||||
} else { /* probably noisy values */
|
||||
logfileOut(LOG_MAIN, "min/max %s: %f %f\n", sensor->ch, sensor->t1, sensor->t2);
|
||||
/* logfileOut(LOG_MAIN, "min/max %s: %f %f\n", sensor->ch, sensor->t1, sensor->t2); */
|
||||
if (fabs(sensor->t1 - sensor->t) < fabs(sensor->t2 - sensor->t) ) {
|
||||
sensor->t=sensor->t1;
|
||||
sensor->t2 = sensor->t1;
|
||||
@@ -723,14 +737,29 @@ int SetTemp(int switchOn) {
|
||||
tempH=(tempC+tShift)/scale;
|
||||
if (tempH>tLimit) tempH=tLimit;
|
||||
if (tempC==0) {
|
||||
ERR_P(LscCmd(ser, "CSET 1:[chan],1,1,0;RANGE:0;SETP 1:0"));
|
||||
ERR_P(LscCmd(ser, "CSET 1:[chan],1,1,0"));
|
||||
ERR_P(LscCmd(ser, "RANGE:0"));
|
||||
tempH=0;
|
||||
} else if (remoteMode==1) { /* in local mode: do not switch on heater */
|
||||
ERR_P(LscCmd(ser, "SETP 1:[tempH]"));
|
||||
ch=controlChannel;
|
||||
} else if (switchOn || (htrst>=5 && relay==0)) { /* switch on also when bad heater message and no alarms */
|
||||
ERR_P(LscCmd(ser, "CSET 1:[chan],1,1,0;RANGE:[iRange];SETP 1:[tempH]"));
|
||||
} else if (switchOn) { /* switch on also when bad heater message and no alarms: || (htrst>=5 && relay==0)) */
|
||||
ERR_P(LscCmd(ser, "CSET 1:[chan],1,1,0"));
|
||||
ERR_P(LscCmd(ser, "RANGE:[iRange]"));
|
||||
ERR_P(LscCmd(ser, "CMODE 1:[cmode]"));
|
||||
if (cmode>=4) {
|
||||
ERR_P(LscCmd(ser, "PID?1>prop,integ,deriv"));
|
||||
logfileOut(LOG_MAIN, "PID %f,%f,%f\n", prop, integ, deriv);
|
||||
tuning=2;
|
||||
}
|
||||
} else {
|
||||
ERR_P(LscCmd(ser, "CSET 1:[chan],1;SETP 1:[tempH]"));
|
||||
ERR_P(LscCmd(ser, "CSET 1:[chan],1"));
|
||||
}
|
||||
ERR_P(LscCmd(ser, "SETP?1>fbuf"));
|
||||
if (tempH==0 || fbuf/tempH<0.9999 || fbuf/tempH>1.0001) {
|
||||
ERR_P(LscCmd(ser, "SETP 1:[tempH]"));
|
||||
if (controlMode!=2 && !switchOn) {
|
||||
logfileOut(LOG_MAIN, "set %f (on %s) (was changed)\n", tempC, ch);
|
||||
}
|
||||
}
|
||||
if (0!=strcmp(ch, controlChannel) || switchOn) {
|
||||
str_copy(controlChannel, ch);
|
||||
@@ -747,12 +776,17 @@ int PeriodicTask(void) {
|
||||
time_t putTim;
|
||||
float t3[3], p, d, w, t;
|
||||
|
||||
ERR_P(LscCmd(ser, "DIOST?>cod1,out1;DOUT 3,29;HTR?>htr;HTRST?>htrst;RELAYST?1>relay;BUSY?>busy"));
|
||||
ERR_P(LscCmd(ser, "DIOST?>cod1,out1"));
|
||||
if (cryo.codDefined && samp.codDefined) {
|
||||
per=period; /* no timeout on above command and codes are defined: normal period */
|
||||
if (per>logPeriod*1000) per=logPeriod*1000;
|
||||
}
|
||||
|
||||
ERR_P(LscCmd(ser, "DOUT 3,29"));
|
||||
ERR_P(LscCmd(ser, "HTR?>htr"));
|
||||
ERR_P(LscCmd(ser, "HTRST?>htrst"));
|
||||
ERR_P(LscCmd(ser, "RELAYST?1>relay;BUSY?>busy"));
|
||||
|
||||
if (noResp) { /* there was no response on an earlier command, or we are initializing */
|
||||
if (!configuring) remoteMode=2;
|
||||
LscCmd(ser, "MODE:[remoteMode]");
|
||||
@@ -798,7 +832,7 @@ int PeriodicTask(void) {
|
||||
if (cryo.code!=0) str_copy(cryo.device, buf1);
|
||||
cryo.manual=0;
|
||||
}
|
||||
if (buf2[0]=='*') {
|
||||
if (buf2[0]=='*' && buf2[1]!='\0') {
|
||||
str_copy(samp.device, buf2+1);
|
||||
samp.manual=1;
|
||||
} else {
|
||||
@@ -860,6 +894,11 @@ int PeriodicTask(void) {
|
||||
i=0;
|
||||
if (sens1.present) {
|
||||
t3[0]=cryo.temp;
|
||||
/*
|
||||
if (cryo.temp==0) {
|
||||
logfileOut(LOG_MAIN, "zero??\n");
|
||||
}
|
||||
*/
|
||||
i=1;
|
||||
} else {
|
||||
t3[0]=undef;
|
||||
@@ -907,7 +946,9 @@ int PeriodicTask(void) {
|
||||
}
|
||||
}
|
||||
|
||||
ERR_P(LscCmd(ser, "KEYST?>key;DIOST?>cod2,out2;DOUT 3,30"));
|
||||
ERR_P(LscCmd(ser, "KEYST?>key"));
|
||||
ERR_P(LscCmd(ser, "DIOST?>cod2,out2"));
|
||||
ERR_P(LscCmd(ser, "DOUT 3,30"));
|
||||
|
||||
if (busy==0) {
|
||||
if (out1!=30) {
|
||||
@@ -916,7 +957,8 @@ int PeriodicTask(void) {
|
||||
}
|
||||
if (out2!=29) {
|
||||
ERR_P(LscCmd(ser, "DOUT:3,29"));
|
||||
ERR_P(LscCmd(ser, "DIOST?>cod2,out2;DOUT 3,30"));
|
||||
ERR_P(LscCmd(ser, "DIOST?>cod2,out2"));
|
||||
ERR_P(LscCmd(ser, "DOUT 3,30"));
|
||||
}
|
||||
|
||||
if (out1==30 && out2==29) {
|
||||
@@ -926,15 +968,24 @@ int PeriodicTask(void) {
|
||||
for (i=0; i<2; i++) {
|
||||
tpoint=tpoints[i];
|
||||
if (tpoint->code1!=tpoint->code) { /* code has changed -> wait for a confirmation */
|
||||
tpoint->code=tpoint->code1;
|
||||
tpoint->codChanged=1;
|
||||
logfileOut(LOG_MAIN, "%s codes: %d,%d,%d\n", tpoint->tname, tpoint->code, tpoint->code1, tpoint->code2);
|
||||
if (tpoint->code1==tpoint->code2) {
|
||||
tpoint->code=tpoint->code1;
|
||||
tpoint->codChanged=1;
|
||||
} else {
|
||||
tpoint->code2=tpoint->code1;
|
||||
}
|
||||
} else {
|
||||
tpoint->code2=tpoint->code;
|
||||
if (tpoint->codChanged) { /* code change confirmed */
|
||||
tpoint->codChanged=0;
|
||||
Progress(1);
|
||||
tpoint->manual=0;
|
||||
if (tpoint->code1==0) {
|
||||
logfileOut(LOG_MAIN, "%s unplugged\n", tpoint->tname);
|
||||
if (tpoint==&cryo && samp.sensor1->ch[0]<='B') {
|
||||
samp.manual=0; samp.dirty=1;
|
||||
}
|
||||
} else {
|
||||
logfileOut(LOG_MAIN, "plugged %d on %s\n", tpoint->code1, tpoint->tname);
|
||||
}
|
||||
@@ -964,7 +1015,9 @@ int PeriodicTask(void) {
|
||||
ERR_P(LscCmd(ser, "RANGE?>iRange"));
|
||||
if (iRange==0) tempC=0;
|
||||
} else {
|
||||
ERR_P(LscCmd(ser, "RANGE?>iRange;CSET?1>,cod1,;SETP?1>tempC"));
|
||||
ERR_P(LscCmd(ser, "RANGE?>iRange"));
|
||||
ERR_P(LscCmd(ser, "CSET?1>,cod1,"));
|
||||
ERR_P(LscCmd(ser, "SETP?1>tempC"));
|
||||
if (cod1!=1) {
|
||||
tempC=0;
|
||||
logfileOut(LOG_MAIN, "set point was not in K, set to 0\n");
|
||||
@@ -974,6 +1027,16 @@ int PeriodicTask(void) {
|
||||
}
|
||||
}
|
||||
|
||||
if (tuning==2) {
|
||||
ERR_P(LscCmd(ser, "TUNEST?>tuning"));
|
||||
if (tuning==0) tuning=2;
|
||||
} else if (tuning==1) {
|
||||
ERR_P(LscCmd(ser, "TUNEST?>tuning"));
|
||||
if (tuning==0) {
|
||||
ERR_P(LscCmd(ser, "PID?1>prop,integ,deriv"));
|
||||
logfileOut(LOG_MAIN, "@tuned PID %f,%f,%f\n", prop, integ, deriv);
|
||||
}
|
||||
}
|
||||
if (saveTime!=0 && tim>saveTime) {
|
||||
ERR_P(LscCmd(ser, "CRVSAV;BUSY?>busy"));
|
||||
while (!busy) {
|
||||
@@ -996,7 +1059,7 @@ int inputSettings(Testpoint *this) {
|
||||
} else {
|
||||
if (tpoint->code==0) {
|
||||
logfileOut(LOG_MAIN ,"reset %s inputs\n", tpoint->tname);
|
||||
if (cryo.code==0 && samp.code==0) {
|
||||
if (cryo.code==0 && samp.code==0 && cryo.manual==0 && samp.manual==0) {
|
||||
logfileOut(LOG_MAIN, "no more sensor connected\n");
|
||||
}
|
||||
} else {
|
||||
@@ -1046,7 +1109,7 @@ int SetMaxPower(void) {
|
||||
}
|
||||
maxPower=pw;
|
||||
logfileOut(LOG_MAIN, "maxPower %f\n", maxPower, iAmp, iRange);
|
||||
ERR_P(LscCmd(ser, "CDISP 1:1,[resist],1;MOUT 1:0;CMODE 1:1"));
|
||||
ERR_P(LscCmd(ser, "CDISP 1:1,[resist],1;MOUT 1:0"));
|
||||
ERR_P(LscCmd(ser, "CLIMIT 1:[tLimit],0,0,[iAmp],[iRange]"));
|
||||
ERR_I(SetTemp(1));
|
||||
return(0);
|
||||
@@ -1253,7 +1316,9 @@ int mainBody(void)
|
||||
ERR_I(iret=CocHandleRequests(tdif, 0));
|
||||
if (iret==0) { time(&tim); break; } /* timeout */
|
||||
tim=tim1.time;
|
||||
ERR_I(ExecuteRequest());
|
||||
if (ser!=NULL) {
|
||||
ERR_I(ExecuteRequest());
|
||||
}
|
||||
logfileWrite(logMask);
|
||||
}
|
||||
ftime(&tim1);
|
||||
@@ -1265,7 +1330,9 @@ int mainBody(void)
|
||||
logfileOut(LOG_MAIN ,"%d cycles lost\n", tdif-1);
|
||||
}
|
||||
|
||||
ERR_I(PeriodicTask());
|
||||
if (ser!=NULL) {
|
||||
ERR_I(PeriodicTask());
|
||||
}
|
||||
if (remoteMode==2) ERR_I(Settings());
|
||||
|
||||
return(0);
|
||||
@@ -1278,6 +1345,7 @@ int mainBody(void)
|
||||
remoteMode=1;
|
||||
configuring=0;
|
||||
} else {
|
||||
/* logfileShowErr("error"); */
|
||||
logfileOut(LOG_ALL ,"no response\n");
|
||||
noResp=1;
|
||||
per=100; /* try again soon */
|
||||
@@ -1356,7 +1424,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
if (port==0) port=9753;
|
||||
if (msecTmo==0) msecTmo=1000;
|
||||
if (msecTmo==0) msecTmo=2000;
|
||||
if (logPeriod==0) logPeriod=5;
|
||||
|
||||
str_copy(buf, logDir);
|
||||
@@ -1406,6 +1474,7 @@ int main(int argc, char *argv[])
|
||||
CocDefFlt(tLow, CocRD);
|
||||
CocDefFlt(tHigh, CocRD);
|
||||
CocDefFlt(maxShift, CocWR);
|
||||
CocDefFlt(fbuf, CocRD);
|
||||
|
||||
CocDefStr(device, deviceFlag);
|
||||
|
||||
@@ -1437,10 +1506,12 @@ int main(int argc, char *argv[])
|
||||
CocDefInt(remoteMode, CocRD);
|
||||
CocDefInt(heliumMode, CocRD);
|
||||
CocDefInt(htrst, CocRD);
|
||||
CocDefInt(tuning, CocRD);
|
||||
|
||||
CocDefInt(logPeriod, CocWR);
|
||||
CocDefInt(readTemp, CocWR);
|
||||
CocDefInt(controlMode, CocWR);
|
||||
CocDefInt(cmode, CocWR);
|
||||
CocDefInt(int2, CocWR);
|
||||
CocDefInt(busy, CocRD);
|
||||
CocDefInt(relay, CocRD);
|
||||
@@ -1459,7 +1530,10 @@ int main(int argc, char *argv[])
|
||||
CocAlias(set,tempC);
|
||||
CocAlias(int,integ);
|
||||
|
||||
ERR_P(ser=SerOpen(host, msecTmo, idleHdl));
|
||||
ser=SerOpen(host, msecTmo, idleHdl);
|
||||
if (ser==NULL) {
|
||||
logfileShowErr("error in SerOpen");
|
||||
}
|
||||
ERR_I(iret=CocHandleRequests(100, 0));
|
||||
ftime(&tim0);
|
||||
tim=tim0.time;
|
||||
@@ -1476,22 +1550,44 @@ int main(int argc, char *argv[])
|
||||
logfileWrite(logMask);
|
||||
|
||||
remoteMode=2;
|
||||
LscCmd(ser, "MODE?>remoteMode");
|
||||
prop=50;
|
||||
integ=20;
|
||||
deriv=0;
|
||||
LscCmd(ser, "PID?1>prop,integ,deriv");
|
||||
if (ser!=NULL) {
|
||||
LscCmd(ser, "MODE?>remoteMode");
|
||||
LscCmd(ser, "PID?1>prop,integ,deriv");
|
||||
}
|
||||
if (remoteMode!=2) configuring=0;
|
||||
per=1; /* advance fast when initializing */
|
||||
cntError=0;
|
||||
while (!quit) {
|
||||
iret=mainBody();
|
||||
if (iret<0) {
|
||||
if (iret<0 || ser==NULL) {
|
||||
cntError++;
|
||||
if (cntError>10) ERR_MSG("too many errors - quit");
|
||||
logfileShowErr("error in TecsServer/mainBody");
|
||||
if (0==strcmp(ErrMessage, "asynsrv error")) {
|
||||
if (ser!=NULL) SerClose(ser);
|
||||
ser=NULL;
|
||||
}
|
||||
if (cntError<4) {
|
||||
logfileShowErr("error in TecsServer/mainBody");
|
||||
} else if (cntError==4) {
|
||||
logfileOut(LOG_MAIN, "--- too many errors: skip messages ---\n");
|
||||
}
|
||||
if (ser==NULL) {
|
||||
CocHandleRequests(msecTmo, 0);
|
||||
ser=SerOpen(host, msecTmo, idleHdl);
|
||||
if (ser!=NULL) {
|
||||
LscCmd(ser, "MODE?>remoteMode");
|
||||
LscCmd(ser, "PID?1>prop,integ,deriv");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cntError>0) cntError--;
|
||||
if (cntError>0) {
|
||||
if (cntError>4) {
|
||||
cntError=4;
|
||||
}
|
||||
cntError--;
|
||||
}
|
||||
}
|
||||
}
|
||||
LogMinMax(0);
|
||||
|
||||
Reference in New Issue
Block a user