Experimental Physics and Industrial Control System
|
On 30/06/20 17:55, Johnson, Andrew N. wrote:
Hi Torsten,
On Jun 30, 2020, at 3:09 AM, Torsten Bögershausen via Core-talk
<core-talk at aps.anl.gov <mailto:core-talk at aps.anl.gov>> wrote:
I have a problem with dbLinkIsConstant(), it seems.
If I run the motor module with this code:
#if LT_EPICSBASE(7,0,0,0)
#define dbLinkIsConstant(lnk) ((lnk)->type == CONSTANT)
#else
#include "dbLink.h"
#endif
And later
if (dbLinkIsConstant(&pmr->dol))
{
pmr->udf = FALSE;
Debug(pmr,3, "init_record %s\n", "dbLinkIsConstant=true set
UDF=FALSE");
recGblInitConstantLink(&pmr->dol, DBF_DOUBLE, &pmr->val);
}
I get this log message:
[motorRecord.cc:906 <http://motorrecord.cc:906> IOC:m1] init_record
dbLinkIsConstant=true set UDF=FALSE
However, the .DOL field is empty.
Is this the expected behavior ?
Yes, an empty or unpopulated link field has always been represented with
type==CONSTANT which is a macro with value 0 so this is also the default
if the link field is not set at all. In 3.16.1 I introduced extensible
links and the dbLinkIsConstant() routine to Base because extensible
links can also provide constant values, and they don’t have type==CONSTANT.
Note that recGblInitConstantLink() has always returned TRUE if the link
is a constant and provided a value (else FALSE), so there is no actual
need for the conditional around it – that was merely an optimization for
earlier versions of Base but is no longer helpful. My suggested
replacement for the code above is to not call dbLinkIsConstant() at all,
just do this instead:
if (recGblInitConstantLink(&pmr->dol, DBF_DOUBLE, &pmr->val))
{
pmr->udf = FALSE;
Debug(pmr,3, "init_record %s\n", "recGblInitConstantLink set
UDF=FALSE");
}
That should be backwards compatible with older Base versions, and I
believe all of the record types have now had that modification done
already. This was documented in the Release Notes for version 3.16.1
<https://epics.anl.gov/base/R3-16/1-docs/RELEASE_NOTES.html>, look for
the section titled “Support Routine Modifications for Extensible Link
Types”.
HTH,
- Andrew
--
Complexity comes for free, simplicity you have to work for.
Thanks Andrew for the good explanation
I (now) realized that I had mis-used the .UDF field to keep track
if there was ever a communication to the controller, or if it is still
"offline". The .UDF seemed good for this purpose, but it isn't.
- References:
- Problems with dbLinkIsConstant Torsten Bögershausen via Core-talk
- Re: Problems with dbLinkIsConstant Johnson, Andrew N. via Core-talk
- Navigate by Date:
- Prev:
Re: version headers Michael Davidsaver via Core-talk
- Next:
Build failed: epics-base base-recnames-575 AppVeyor via Core-talk
- Index:
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: Problems with dbLinkIsConstant Johnson, Andrew N. via Core-talk
- Next:
Build failed: EPICS Base 7 base-7.0-43 AppVeyor via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
<2020>
2021
2022
2023
2024
|
ANJ, 30 Jun 2020 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
·
Search
·
EPICS V4
·
IRMIS
·
Talk
·
Bugs
·
Documents
·
Links
·
Licensing
·
|