Commit 22973be7 authored by benjamin.franksen's avatar benjamin.franksen
Browse files

fixed inactive mode bug (cvtRecordApp)


Siehe auch Ticket #405 im BESSY II Operations Trac.
parent 36ef1f33
......@@ -127,7 +127,7 @@ typedef double cvt_subroutine(double,double,void**);
#define DRTY_ISTA 0x04
static void alarm(struct cvtRecord *pcvt);
static long readInputs(struct cvtRecord *pcvt);
static long readInputs(struct cvtRecord *pcvt, short *pinactive);
static long convert(struct cvtRecord *pcvt);
static void monitor(struct cvtRecord *pcvt);
static long checkInit(struct cvtRecord *pcvt);
......@@ -180,6 +180,7 @@ static long init_record(struct cvtRecord *pcvt, int pass)
static long process(struct cvtRecord *pcvt)
{
long status = 0;
short inactive;
pcvt->pact = TRUE;
status = dbGetLink(&pcvt->inil, DBR_UCHAR, &pcvt->init, 0, 0);
......@@ -197,14 +198,16 @@ static long process(struct cvtRecord *pcvt)
}
pcvt->pact = TRUE;
status = readInputs(pcvt);
status = readInputs(pcvt, &inactive);
pcvt->pact = FALSE;
if (status) {
goto error;
}
status = convert(pcvt);
if (!inactive) {
status = convert(pcvt);
}
error:
alarm(pcvt);
......@@ -438,11 +441,10 @@ static void alarm(struct cvtRecord *pcvt)
pcvt->lalm = val;
}
static long readInputs(struct cvtRecord *pcvt)
static long readInputs(struct cvtRecord *pcvt, short *pinactive)
{
long status;
double old;
short inactive = 0;
old = pcvt->x;
status = dbGetLink(&pcvt->inpx, DBR_DOUBLE, &pcvt->x, 0, 0);
......@@ -466,14 +468,14 @@ static long readInputs(struct cvtRecord *pcvt)
/* get inactive mode specifier via inlink */
if (pcvt->iaml.type == CONSTANT) {
if (sscanf(pcvt->iaml.value.constantStr,"%hi",&inactive)!=1) {
if (sscanf(pcvt->iaml.value.constantStr,"%hi",pinactive)!=1) {
recGblSetSevr(pcvt, LINK_ALARM, INVALID_ALARM);
errmsg("invalid constant link IAML");
return -1;
}
}
else {
status = dbGetLink(&pcvt->iaml, DBR_SHORT, &inactive, 0, 0);
status = dbGetLink(&pcvt->iaml, DBR_SHORT, pinactive, 0, 0);
if (status) {
recGblSetSevr(pcvt, LINK_ALARM, INVALID_ALARM);
errmsg("invalid pv link IAML");
......@@ -481,7 +483,7 @@ static long readInputs(struct cvtRecord *pcvt)
}
}
if (inactive) {
if (*pinactive) {
if (pcvt->iavl.type == CONSTANT) {
if (epicsScanDouble(pcvt->iavl.value.constantStr, &pcvt->val)!=1) {
recGblSetSevr(pcvt, LINK_ALARM, INVALID_ALARM);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment