Longout OOPT field refactoring and updated documentation; Release notes additions
This commit is contained in:
@@ -81,6 +81,9 @@ rset longoutRSET={
|
||||
};
|
||||
epicsExportAddress(rset,longoutRSET);
|
||||
|
||||
#define OUT_LINK_UNCHANGED 0
|
||||
#define OUT_LINK_CHANGED 1
|
||||
|
||||
static void checkAlarms(longoutRecord *prec);
|
||||
static void monitor(longoutRecord *prec);
|
||||
static long writeValue(longoutRecord *prec);
|
||||
@@ -120,7 +123,8 @@ static long init_record(struct dbCommon *pcommon, int pass)
|
||||
prec->mlst = prec->val;
|
||||
prec->alst = prec->val;
|
||||
prec->lalm = prec->val;
|
||||
prec->oval = prec->val;
|
||||
prec->pval = prec->val;
|
||||
prec->outpvt = OUT_LINK_UNCHANGED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -213,14 +217,13 @@ static long special(DBADDR *paddr, int after)
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* If OOPT is "on change" we force a write operation */
|
||||
/* Detect an output link re-direction (change)*/
|
||||
if (dbGetFieldIndex(paddr) == longoutRecordOUT) {
|
||||
if ((!after) && (prec->oopt == longoutOOPT_On_Change))
|
||||
prec->oopt = longoutOOPT_Write_Once_Then_On_Change;
|
||||
return 0;
|
||||
if (!after)
|
||||
prec->outpvt = OUT_LINK_CHANGED;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
recGblDbaddrError(S_db_badChoice, paddr, "longout: special");
|
||||
return(S_db_badChoice);
|
||||
@@ -392,10 +395,7 @@ static void monitor(longoutRecord *prec)
|
||||
|
||||
static long writeValue(longoutRecord *prec)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
longoutdset *pdset = (longoutdset *) prec->dset;
|
||||
=======
|
||||
>>>>>>> 2b7ca9598 (Added OOPT to longout record)
|
||||
long status = 0;
|
||||
|
||||
if (!prec->pact) {
|
||||
@@ -435,7 +435,7 @@ static long writeValue(longoutRecord *prec)
|
||||
|
||||
static void convert(longoutRecord *prec, epicsInt32 value)
|
||||
{
|
||||
/* check drive limits */
|
||||
/* check drive limits */
|
||||
if(prec->drvh > prec->drvl) {
|
||||
if (value > prec->drvh) value = prec->drvh;
|
||||
else if (value < prec->drvl) value = prec->drvl;
|
||||
@@ -453,11 +453,15 @@ static long conditional_write(longoutRecord *prec)
|
||||
switch (prec->oopt)
|
||||
{
|
||||
case longoutOOPT_On_Change:
|
||||
doDevSupWrite = (prec->val != prec->oval);
|
||||
/* Forces a write op if a change in the OUT field is detected */
|
||||
if ((prec->ooch == menuYesNoYES) && (prec->outpvt == OUT_LINK_CHANGED)) {
|
||||
doDevSupWrite = 1;
|
||||
} else {
|
||||
/* Only write if value is different from the previous one */
|
||||
doDevSupWrite = (prec->val != prec->pval);
|
||||
}
|
||||
break;
|
||||
|
||||
case longoutOOPT_Write_Once_Then_On_Change:
|
||||
prec->oopt = longoutOOPT_On_Change;
|
||||
case longoutOOPT_Every_Time:
|
||||
doDevSupWrite = 1;
|
||||
break;
|
||||
@@ -471,11 +475,11 @@ static long conditional_write(longoutRecord *prec)
|
||||
break;
|
||||
|
||||
case longoutOOPT_Transition_To_Zero:
|
||||
doDevSupWrite = ((prec->val == 0)&&(prec->oval != 0));
|
||||
doDevSupWrite = ((prec->val == 0)&&(prec->pval != 0));
|
||||
break;
|
||||
|
||||
case longoutOOPT_Transition_To_Non_zero:
|
||||
doDevSupWrite = ((prec->val != 0)&&(prec->oval == 0));
|
||||
doDevSupWrite = ((prec->val != 0)&&(prec->pval == 0));
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -485,6 +489,7 @@ static long conditional_write(longoutRecord *prec)
|
||||
if (doDevSupWrite)
|
||||
status = pdset->write_longout(prec);
|
||||
|
||||
prec->oval = prec->val;
|
||||
prec->pval = prec->val;
|
||||
prec->outpvt = OUT_LINK_UNCHANGED; /* reset status of OUT link */
|
||||
return status;
|
||||
}
|
||||
@@ -27,10 +27,8 @@ menu(longoutOOPT) {
|
||||
choice(longoutOOPT_When_Non_zero,"When Non-zero")
|
||||
choice(longoutOOPT_Transition_To_Zero,"Transition To Zero")
|
||||
choice(longoutOOPT_Transition_To_Non_zero,"Transition To Non-zero")
|
||||
choice(longoutOOPT_Write_Once_Then_On_Change, "Write Once Then On Change")
|
||||
}
|
||||
|
||||
|
||||
recordtype(longout) {
|
||||
|
||||
=head2 Parameter Fields
|
||||
@@ -82,7 +80,45 @@ DTYP field must then specify the C<<< Soft Channel >>> device support routine.
|
||||
See L<Address Specification> for information on the format of hardware addresses
|
||||
and database links.
|
||||
|
||||
=fields OUT, DTYP
|
||||
=fields OUT, DTYP, OOPT, OOCH
|
||||
|
||||
=head4 Menu longoutOOPT
|
||||
|
||||
The OOPT field determines the condition that causes the output link to be
|
||||
written to. It's a menu field that has six choices:
|
||||
|
||||
=menu longoutOOPT
|
||||
|
||||
=over
|
||||
|
||||
=item *
|
||||
C<Every Time> -- write output every time record is processed. (DEFAULT)
|
||||
|
||||
=item *
|
||||
C<On Change> -- write output every time VAL changes, i.e., every time the
|
||||
result of the expression changes.
|
||||
|
||||
=item *
|
||||
C<When Zero> -- when record is processed, write output if VAL is zero.
|
||||
|
||||
=item *
|
||||
C<When Non-zero> -- when record is processed, write output if VAL is
|
||||
non-zero.
|
||||
|
||||
=item *
|
||||
C<Transition To Zero> -- when record is processed, write output only if VAL
|
||||
is zero and the last value was non-zero.
|
||||
|
||||
=item *
|
||||
C<Transition To Non-zero> -- when record is processed, write output only if
|
||||
VAL is non-zero and last value was zero.
|
||||
|
||||
=back
|
||||
|
||||
=head4 Changes in OUT field when OOPT = On Change
|
||||
|
||||
The OOCH field determines if a change in OUT field should cause a write operation
|
||||
even when the value is the same and OOPT = On Change. By default, OOCH is set to YES.
|
||||
|
||||
=cut
|
||||
|
||||
@@ -372,7 +408,7 @@ for more information on simulation mode and its fields.
|
||||
prompt("Sim. Mode Private")
|
||||
special(SPC_NOMOD)
|
||||
interest(4)
|
||||
extra("epicsCallback *simpvt")
|
||||
extra("epicsCallback *simpvt")
|
||||
}
|
||||
field(IVOA,DBF_MENU) {
|
||||
prompt("INVALID output action")
|
||||
@@ -385,11 +421,21 @@ for more information on simulation mode and its fields.
|
||||
promptgroup("50 - Output")
|
||||
interest(2)
|
||||
}
|
||||
field(OVAL,DBF_LONG) {
|
||||
prompt("Last Value Written")
|
||||
promptgroup("50 - Output")
|
||||
asl(ASL1)
|
||||
field(PVAL,DBF_LONG) {
|
||||
prompt("Previous Value")
|
||||
}
|
||||
field(OUTPVT,DBF_NOACCESS) {
|
||||
prompt("Output Link Changed Private")
|
||||
special(SPC_NOMOD)
|
||||
interest(4)
|
||||
extra("epicsEnum16 outpvt")
|
||||
}
|
||||
field(OOCH,DBF_MENU) {
|
||||
prompt("Output Execute On Change")
|
||||
promptgroup("50 - Output")
|
||||
interest(1)
|
||||
menu(menuYesNo)
|
||||
initial("1")
|
||||
}
|
||||
field(OOPT,DBF_MENU) {
|
||||
prompt("Output Execute Opt")
|
||||
|
||||
Reference in New Issue
Block a user