From 1d85bc7424576fb1f7eb6c890d6a42c8d54254f4 Mon Sep 17 00:00:00 2001 From: Joao Paulo Martins Date: Wed, 10 Mar 2021 11:07:30 +0100 Subject: [PATCH] longout record: detect OUT link change using special function AFTER put, better documentation --- modules/database/src/std/rec/longoutRecord.c | 6 +++--- modules/database/src/std/rec/longoutRecord.dbd.pod | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/modules/database/src/std/rec/longoutRecord.c b/modules/database/src/std/rec/longoutRecord.c index e60e01c79..6ceeff1a7 100644 --- a/modules/database/src/std/rec/longoutRecord.c +++ b/modules/database/src/std/rec/longoutRecord.c @@ -217,9 +217,9 @@ static long special(DBADDR *paddr, int after) return(0); } - /* Detect an output link re-direction (change)*/ + /* Detect an output link re-direction (change) */ if (dbGetFieldIndex(paddr) == longoutRecordOUT) { - if (!after) + if (after) prec->outpvt = OUT_LINK_CHANGED; return(0); } @@ -492,4 +492,4 @@ static long conditional_write(longoutRecord *prec) prec->pval = prec->val; prec->outpvt = OUT_LINK_UNCHANGED; /* reset status of OUT link */ return status; -} \ No newline at end of file +} diff --git a/modules/database/src/std/rec/longoutRecord.dbd.pod b/modules/database/src/std/rec/longoutRecord.dbd.pod index fe596c118..1a85cf533 100644 --- a/modules/database/src/std/rec/longoutRecord.dbd.pod +++ b/modules/database/src/std/rec/longoutRecord.dbd.pod @@ -95,8 +95,7 @@ written to. It's a menu field that has six choices: C -- write output every time record is processed. (DEFAULT) =item * -C -- write output every time VAL changes, i.e., every time the -result of the expression changes. +C -- write output every time VAL changes. =item * C -- when record is processed, write output if VAL is zero. @@ -117,8 +116,10 @@ VAL is non-zero and last value was zero. =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. +If OOCH is C (its default value) and the OOPT field is C, +the record will write to the device support the first time the record gets +processed after its OUT link is modified, even when the output value has +not actually changed. =cut