From 0abfcc9445b9a20e437f4abb7ba71e23a90f47c2 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 21 Jan 2012 16:35:40 -0600 Subject: [PATCH] Replace fixed limits with global variables Replaced Dirk's fixed precision=2 and limit=10 seconds with global variables which can be set for each IOC. Also changed the upper control limit for delay fields from 10 to 100,000. --- documentation/RELEASE_NOTES.html | 7 +++++-- src/std/rec/boRecord.c | 9 +++++++-- src/std/rec/boRecord.dbd | 3 +++ src/std/rec/calcoutRecord.c | 13 +++++++++---- src/std/rec/calcoutRecord.dbd | 3 +++ src/std/rec/histogramRecord.c | 5 ++++- src/std/rec/histogramRecord.dbd | 2 ++ src/std/rec/seqRecord.c | 13 ++++++++++--- src/std/rec/seqRecord.dbd | 3 +++ 9 files changed, 46 insertions(+), 12 deletions(-) diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html index 4ec06ada0..12d2fd709 100644 --- a/documentation/RELEASE_NOTES.html +++ b/documentation/RELEASE_NOTES.html @@ -20,8 +20,11 @@ EPICS Base 3.15.0.x releases are not intended for use in production systems.

Non-VAL fields now report meaningful information for precision, units, graphic limits, control limits, and alarm limits instead of simply using PREC, EGU, HOPR, LOPR, DRVL, DRVH, HIHI, HIGH, LOW, and LOLO. All delay -fields have precision 2 and units "s". Input fields like A-L of the calc record -read these information from the corresponding INPn link if possible. +fields have a default precision of 2 digits, units "s" and control limits +of 0 to 100,000 seconds (these precision and limit values can be changed +for each record type as a whole at runtime by updating a registered global +variable). Input fields like A-L of the calc record read their metadata +from the corresponding INPn link if possible.

Changes to epicsVersion.h

diff --git a/src/std/rec/boRecord.c b/src/std/rec/boRecord.c index e0e361c6f..ed6364734 100644 --- a/src/std/rec/boRecord.c +++ b/src/std/rec/boRecord.c @@ -82,6 +82,11 @@ rset boRSET={ }; epicsExportAddress(rset,boRSET); +int boHIGHprecision = 2; +epicsExportAddress(int, boHIGHprecision); +double boHIGHlimit = 100000; +epicsExportAddress(double, boHIGHlimit); + struct bodset { /* binary output dset */ long number; DEVSUPFUN dev_report; @@ -280,7 +285,7 @@ static long get_units(DBADDR *paddr, char *units) static long get_precision(DBADDR *paddr, long *precision) { if(dbGetFieldIndex(paddr) == indexof(HIGH)) - *precision = 2; + *precision = boHIGHprecision; else recGblGetPrec(paddr,precision); return(0); @@ -290,7 +295,7 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) { if(dbGetFieldIndex(paddr) == indexof(HIGH)) { pcd->lower_ctrl_limit = 0.0; - pcd->upper_ctrl_limit = 10.0; + pcd->upper_ctrl_limit = boHIGHlimit; } else recGblGetControlDouble(paddr,pcd); return(0); diff --git a/src/std/rec/boRecord.dbd b/src/std/rec/boRecord.dbd index adc6704ad..4bc44c2fd 100644 --- a/src/std/rec/boRecord.dbd +++ b/src/std/rec/boRecord.dbd @@ -149,3 +149,6 @@ recordtype(bo) { interest(2) } } + +variable(boHIGHprecision, int) +variable(boHIGHlimit, double) diff --git a/src/std/rec/calcoutRecord.c b/src/std/rec/calcoutRecord.c index 1e7432465..88341eba9 100644 --- a/src/std/rec/calcoutRecord.c +++ b/src/std/rec/calcoutRecord.c @@ -83,7 +83,12 @@ rset calcoutRSET = { get_alarm_double }; epicsExportAddress(rset, calcoutRSET); - + +int calcoutODLYprecision = 2; +epicsExportAddress(int, calcoutODLYprecision); +double calcoutODLYlimit = 100000; +epicsExportAddress(double, calcoutODLYlimit); + typedef struct calcoutDSET { long number; DEVSUPFUN dev_report; @@ -401,7 +406,7 @@ static long get_precision(DBADDR *paddr, long *pprecision) int linkNumber; if(fieldIndex == indexof(ODLY)) { - *pprecision = 2; + *pprecision = calcoutODLYprecision; return 0; } *pprecision = prec->prec; @@ -472,8 +477,8 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd) break; case indexof(ODLY): pcd->lower_ctrl_limit = 0.0; - pcd->upper_ctrl_limit = 10.0; - break; + pcd->upper_ctrl_limit = calcoutODLYlimit; + break; default: recGblGetControlDouble(paddr,pcd); } diff --git a/src/std/rec/calcoutRecord.dbd b/src/std/rec/calcoutRecord.dbd index fc393a782..fd93fe0c4 100644 --- a/src/std/rec/calcoutRecord.dbd +++ b/src/std/rec/calcoutRecord.dbd @@ -504,3 +504,6 @@ recordtype(calcout) { extra("char orpc[INFIX_TO_POSTFIX_SIZE(80)]") } } + +variable(calcoutODLYprecision, int) +variable(calcoutODLYlimit, double) diff --git a/src/std/rec/histogramRecord.c b/src/std/rec/histogramRecord.c index a01dfb2ab..cb086d523 100644 --- a/src/std/rec/histogramRecord.c +++ b/src/std/rec/histogramRecord.c @@ -83,6 +83,9 @@ rset histogramRSET={ }; epicsExportAddress(rset,histogramRSET); +int histogramSDELprecision = 2; +epicsExportAddress(int, histogramSDELprecision); + struct histogramdset { /* histogram input dset */ long number; DEVSUPFUN dev_report; @@ -410,7 +413,7 @@ static long get_precision(DBADDR *paddr,long *precision) *precision = prec->prec; break; case indexof(SDEL): - *precision = 2; + *precision = histogramSDELprecision; break; default: recGblGetPrec(paddr,precision); diff --git a/src/std/rec/histogramRecord.dbd b/src/std/rec/histogramRecord.dbd index 6def0f41a..dc0d2df31 100644 --- a/src/std/rec/histogramRecord.dbd +++ b/src/std/rec/histogramRecord.dbd @@ -135,3 +135,5 @@ recordtype(histogram) { interest(1) } } + +variable(histogramSDELprecision, int) diff --git a/src/std/rec/seqRecord.c b/src/std/rec/seqRecord.c index 0394497f7..0537ebe52 100644 --- a/src/std/rec/seqRecord.c +++ b/src/std/rec/seqRecord.c @@ -84,6 +84,11 @@ rset seqRSET={ }; epicsExportAddress(rset,seqRSET); +int seqDLYprecision = 2; +epicsExportAddress(int, seqDLYprecision); +double seqDLYlimit = 100000; +epicsExportAddress(double, seqDLYlimit); + /* Total number of link-groups in a sequence record */ #define NUM_LINKS 10 #define SELN_BIT_MASK ~(0xffff << NUM_LINKS) @@ -448,7 +453,7 @@ static long get_precision(dbAddr *paddr, long *pprecision) if (fieldOffset >= 0) switch (fieldOffset & 2) { case 0: /* DLYn */ - *pprecision = 2; + *pprecision = seqDLYprecision; return 0; case 2: /* DOn */ if (dbGetPrecision(get_dol(prec, fieldOffset), @@ -486,9 +491,11 @@ static long get_control_double(DBADDR *paddr,struct dbr_ctrlDouble *pcd) { int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY1); - recGblGetControlDouble(paddr,pcd); - if (fieldOffset >= 0 && (fieldOffset & 2) == 0) /* DLYn */ + if (fieldOffset >= 0 && (fieldOffset & 2) == 0) { /* DLYn */ pcd->lower_ctrl_limit = 0.0; + pcd->upper_ctrl_limit = seqDLYlimit; + } else + recGblGetControlDouble(paddr,pcd); return(0); } diff --git a/src/std/rec/seqRecord.dbd b/src/std/rec/seqRecord.dbd index 518310220..ae183d2db 100644 --- a/src/std/rec/seqRecord.dbd +++ b/src/std/rec/seqRecord.dbd @@ -231,3 +231,6 @@ recordtype(seq) { interest(1) } } + +variable(seqDLYprecision, int) +variable(seqDLYlimit, double)