.
This commit is contained in:
28
tecs/tecs.c
28
tecs/tecs.c
@@ -188,6 +188,7 @@ static int decod[8]={21,20,17,16,5,4,1,0}; /* for code conversion */
|
|||||||
|
|
||||||
static char
|
static char
|
||||||
statusBuf[132], /* phase status */
|
statusBuf[132], /* phase status */
|
||||||
|
error[128], /* error message */
|
||||||
status[1000], /* status summary */
|
status[1000], /* status summary */
|
||||||
pid[128], /* PID summary */
|
pid[128], /* PID summary */
|
||||||
device[64], /* concatenated device names */
|
device[64], /* concatenated device names */
|
||||||
@@ -2962,6 +2963,18 @@ int ShowSensor(StrBuf *buf, SensorT *s, char *name, char *units, char lim) {
|
|||||||
OnError: return -1;
|
OnError: return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ErrorHdl(int mode, void *base, int fd) {
|
||||||
|
error[0]='\0';
|
||||||
|
if (noResp==3) {
|
||||||
|
snprintf(error, sizeof(error), "no connection or controller switched off");
|
||||||
|
} else if (statusBuf[0] != '\0') {
|
||||||
|
snprintf(error, sizeof(error), "configuring: %s", statusBuf);
|
||||||
|
} else if (device[0] == '\0') {
|
||||||
|
snprintf(error, sizeof(error), "no device selected");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int StatusHdl(int mode, void *base, int fd) {
|
int StatusHdl(int mode, void *base, int fd) {
|
||||||
int i;
|
int i;
|
||||||
StrBuf buf;
|
StrBuf buf;
|
||||||
@@ -2973,13 +2986,9 @@ int StatusHdl(int mode, void *base, int fd) {
|
|||||||
StrLink(&buf, status);
|
StrLink(&buf, status);
|
||||||
StrClear(&buf);
|
StrClear(&buf);
|
||||||
ERR_I(StrPut(&buf, "\n", StrNONE));
|
ERR_I(StrPut(&buf, "\n", StrNONE));
|
||||||
if (noResp==3) {
|
ErrorHdl(mode, base, fd);
|
||||||
ERR_I(StrPut(&buf, "no connection or controller switched off", StrNONE));
|
if (error[0] != '\0') {
|
||||||
goto EndStatus;
|
ERR_I(StrPut(&buf, error, StrNONE));
|
||||||
}
|
|
||||||
if (statusBuf[0]!='\0') {
|
|
||||||
ERR_I(StrPut(&buf, "configuring:", ' '));
|
|
||||||
ERR_I(StrPut(&buf, statusBuf, StrNONE));
|
|
||||||
goto EndStatus;
|
goto EndStatus;
|
||||||
}
|
}
|
||||||
CocShowHandlers(pendAct, sizeof(pendAct));
|
CocShowHandlers(pendAct, sizeof(pendAct));
|
||||||
@@ -2992,10 +3001,6 @@ int StatusHdl(int mode, void *base, int fd) {
|
|||||||
goto EndStatus;
|
goto EndStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (device[0]=='\0') {
|
|
||||||
ERR_I(StrPut(&buf, "no device selected", ' '));
|
|
||||||
goto EndStatus;
|
|
||||||
}
|
|
||||||
if (remoteMode==1) {
|
if (remoteMode==1) {
|
||||||
ERR_I(StrPut(&buf, "LOCAL mode, enter 'remote' to enable remote control", '\n'));
|
ERR_I(StrPut(&buf, "LOCAL mode, enter 'remote' to enable remote control", '\n'));
|
||||||
}
|
}
|
||||||
@@ -3375,6 +3380,7 @@ int main(int argc, char *argv[]) {
|
|||||||
CocDefStr(helium, RD);
|
CocDefStr(helium, RD);
|
||||||
CocDefStr(heUnits, RD);
|
CocDefStr(heUnits, RD);
|
||||||
CocDefStr(intype, RD);
|
CocDefStr(intype, RD);
|
||||||
|
CocDefStr(error, RD); CocHdl(ErrorHdl);
|
||||||
CocDefStr(status, RD); CocHdl(StatusHdl);
|
CocDefStr(status, RD); CocHdl(StatusHdl);
|
||||||
CocDefStr(pid, RD); CocHdl(PidSumHdl);
|
CocDefStr(pid, RD); CocHdl(PidSumHdl);
|
||||||
CocDefStr(config, RD);
|
CocDefStr(config, RD);
|
||||||
|
|||||||
Reference in New Issue
Block a user