correct mask for finding field in linkGrp

It worked before because the get_xxx functions are never called for
the links (bit0 = 1), but checking both bits looks cleaner.
This commit is contained in:
2024-11-29 10:47:03 +01:00
committed by Andrew Johnson
parent 5143258011
commit 4ee766b6b1

View File

@ -285,7 +285,7 @@ static long get_units(DBADDR *paddr, char *units)
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0);
if (fieldOffset >= 0)
switch (fieldOffset & 2) {
switch (fieldOffset & 3) {
case 0: /* DLYn */
strcpy(units, "s");
break;
@ -303,7 +303,7 @@ static long get_precision(const DBADDR *paddr, long *pprecision)
short precision;
if (fieldOffset >= 0)
switch (fieldOffset & 2) {
switch (fieldOffset & 3) {
case 0: /* DLYn */
*pprecision = seqDLYprecision;
return 0;
@ -324,7 +324,7 @@ static long get_graphic_double(DBADDR *paddr, struct dbr_grDouble *pgd)
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0);
if (fieldOffset >= 0)
switch (fieldOffset & 2) {
switch (fieldOffset & 3) {
case 0: /* DLYn */
pgd->lower_disp_limit = 0.0;
pgd->lower_disp_limit = 10.0;
@ -343,7 +343,7 @@ static long get_control_double(DBADDR *paddr, struct dbr_ctrlDouble *pcd)
{
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0);
if (fieldOffset >= 0 && (fieldOffset & 2) == 0) { /* DLYn */
if (fieldOffset >= 0 && (fieldOffset & 3) == 0) { /* DLYn */
pcd->lower_ctrl_limit = 0.0;
pcd->upper_ctrl_limit = seqDLYlimit;
}
@ -357,7 +357,7 @@ static long get_alarm_double(DBADDR *paddr, struct dbr_alDouble *pad)
seqRecord *prec = (seqRecord *) paddr->precord;
int fieldOffset = dbGetFieldIndex(paddr) - indexof(DLY0);
if (fieldOffset >= 0 && (fieldOffset & 2) == 2) /* DOn */
if (fieldOffset >= 0 && (fieldOffset & 3) == 2) /* DOn */
dbGetAlarmLimits(get_dol(prec, fieldOffset),
&pad->lower_alarm_limit, &pad->lower_warning_limit,
&pad->upper_warning_limit, &pad->upper_alarm_limit);