.
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
|
||||
statusBuf[132], /* phase status */
|
||||
error[128], /* error message */
|
||||
status[1000], /* status summary */
|
||||
pid[128], /* PID summary */
|
||||
device[64], /* concatenated device names */
|
||||
@ -2962,6 +2963,18 @@ int ShowSensor(StrBuf *buf, SensorT *s, char *name, char *units, char lim) {
|
||||
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 i;
|
||||
StrBuf buf;
|
||||
@ -2973,13 +2986,9 @@ int StatusHdl(int mode, void *base, int fd) {
|
||||
StrLink(&buf, status);
|
||||
StrClear(&buf);
|
||||
ERR_I(StrPut(&buf, "\n", StrNONE));
|
||||
if (noResp==3) {
|
||||
ERR_I(StrPut(&buf, "no connection or controller switched off", StrNONE));
|
||||
goto EndStatus;
|
||||
}
|
||||
if (statusBuf[0]!='\0') {
|
||||
ERR_I(StrPut(&buf, "configuring:", ' '));
|
||||
ERR_I(StrPut(&buf, statusBuf, StrNONE));
|
||||
ErrorHdl(mode, base, fd);
|
||||
if (error[0] != '\0') {
|
||||
ERR_I(StrPut(&buf, error, StrNONE));
|
||||
goto EndStatus;
|
||||
}
|
||||
CocShowHandlers(pendAct, sizeof(pendAct));
|
||||
@ -2992,10 +3001,6 @@ int StatusHdl(int mode, void *base, int fd) {
|
||||
goto EndStatus;
|
||||
}
|
||||
}
|
||||
if (device[0]=='\0') {
|
||||
ERR_I(StrPut(&buf, "no device selected", ' '));
|
||||
goto EndStatus;
|
||||
}
|
||||
if (remoteMode==1) {
|
||||
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(heUnits, RD);
|
||||
CocDefStr(intype, RD);
|
||||
CocDefStr(error, RD); CocHdl(ErrorHdl);
|
||||
CocDefStr(status, RD); CocHdl(StatusHdl);
|
||||
CocDefStr(pid, RD); CocHdl(PidSumHdl);
|
||||
CocDefStr(config, RD);
|
||||
|
Reference in New Issue
Block a user