Hi Rolf,
On 2013-06-14 you wrote:
> For DOL on output records, however, one could store the constant link
> value, which is evaluated on record init in a record private structure
> and pick it up from there when processing.
> Ideally this private value should be updated, if the value of the
> constant link is changed. Mhhh?
An output record could make the DOL field special(SPC_MOD) and redo the link
initialization whenever it gets set to a constant. It would require adding a
new field to the record type to store the converted constant, and using that
value instead of the previous VAL when OMSL is closed_loop. The attached
changes to the ao record type demonstrate this (but might not apply cleanly
using patch as they're against the latest 3.15 branch).
This is still a behavior change though, so I couldn't put it into an official
3.14 release. I also don't think we can implement this solution everywhere;
ao, bo, dfanout, longout, mbbo and mbboDirect might arguably be done by
reasoning that they all have OMSL fields, but we're actually changing the
behavior of the DOL field more than OMSL, and in 3.15 the seq record has 16
of those.
I also just noticed that the ao's OIF == Incremental setting is ignored when
DOL is a constant; that's not really consistent either (or documented).
I don't think I want to make the change this way though, I'd rather take out
the special handling of const links from the record code as part of my link-
support changes, which should be more flexible and comprehensive. It should
be possible to store the converted value in the link data structure and only
do the conversion when it gets changed, and I think the result will simplify
the record support code as well.
- Andrew
--
It is difficult to get a man to understand something, when his salary
depends upon his not understanding it. -- Upton Sinclair
=== modified file 'src/std/rec/aoRecord.c'
--- src/std/rec/aoRecord.c 2012-12-10 15:25:58 +0000
+++ src/std/rec/aoRecord.c 2013-06-14 19:26:38 +0000
@@ -120,8 +120,10 @@ static long init_record(aoRecord *prec,
}
/* get the initial value if dol is a constant*/
if (prec->dol.type == CONSTANT) {
- if(recGblInitConstantLink(&prec->dol,DBF_DOUBLE,&prec->val))
- prec->udf = isnan(prec->val);
+ if (recGblInitConstantLink(&prec->dol, DBF_DOUBLE, &value)) {
+ prec->val = prec->docv = value;
+ prec->udf = isnan(value);
+ }
}
/* must have write_ao function defined */
@@ -189,8 +191,10 @@ static long process(aoRecord *prec)
/* fetch value and convert*/
if (prec->pact == FALSE) {
- if ((prec->dol.type != CONSTANT)
- && (prec->omsl == menuOmslclosed_loop)) {
+ if (prec->omsl == menuOmslclosed_loop) {
+ if (prec->dol.type == CONSTANT)
+ value = prec->docv;
+ else
status = fetch_value(prec, &value);
}
else {
@@ -270,6 +274,12 @@ static long special(DBADDR *paddr, int a
return (status);
}
return (0);
+ case SPC_MOD:
+ /* DOL changed */
+ if (after && prec->dol.type == CONSTANT) {
+ recGblInitConstantLink(&prec->dol, DBF_DOUBLE, &prec->docv);
+ }
+ return 0;
default:
recGblDbaddrError(S_db_badChoice,paddr,"ao: special");
return(S_db_badChoice);
=== modified file 'src/std/rec/aoRecord.dbd'
--- src/std/rec/aoRecord.dbd 2002-07-12 21:35:43 +0000
+++ src/std/rec/aoRecord.dbd 2013-06-14 19:49:21 +0000
@@ -35,6 +35,7 @@ recordtype(ao) {
field(DOL,DBF_INLINK) {
prompt("Desired Output Loc")
promptgroup(GUI_OUTPUT)
+ special(SPC_MOD)
interest(1)
}
field(OMSL,DBF_MENU) {
@@ -205,6 +206,11 @@ recordtype(ao) {
prompt("Current Raw Value")
pp(TRUE)
}
+ field(DOCV,DBF_DOUBLE) {
+ prompt("Desired Output Const")
+ interest(3)
+ special(SPC_NOMOD)
+ }
field(ORAW,DBF_LONG) {
prompt("Previous Raw Value")
special(SPC_NOMOD)
- Replies:
- Re: analog output record - constant DOL Benjamin Franksen
- References:
- Re: analog output record - constant DOL Rolf Keitel
- Navigate by Date:
- Prev:
RE: asynDriver R4-21: a possible patch for asynRecord.c: test on GigE camera Mark Rivers
- Next:
Re: EPICS device disconnects and reconnects Bruce Hill
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: analog output record - constant DOL Rolf Keitel
- Next:
Re: analog output record - constant DOL Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|