ca: Fix capr.pl to handle missing fields properly

When using an EPICS 7 softIoc.dbd file with a PV from an older version
of Base which didn't have all the fields, our attempts to read those
fields will time out, but the internal logic was buggy. Don't try to
print the values of timed out fields at all. The user will still see a
warning about connection timeouts at the top.
This commit is contained in:
Andrew Johnson
2020-07-20 18:20:45 -05:00
parent 7d2e352f6a
commit 7d9746003b

View File

@@ -280,7 +280,7 @@ sub caget {
my $err = (@chans > 1) ? 'some PV(s)' : '"' . $chans[0]->name . '"';
print "Channel connect timed out: $err not found.\n";
foreach my $chan (@chans) {
$timed_out{$chan->name} = $chan->is_connected;
$timed_out{$chan->name} = !$chan->is_connected;
}
@chans = grep { $_->is_connected } @chans;
} else {
@@ -346,15 +346,10 @@ sub printRecord {
my $field = $fields_pr[$i];
my $fToGet = $readlist[$i];
my ($fType, $data, $base);
if ($timed_out{$fToGet}) {
$fType = $fieldType{DBF_STRING};
$data = '<timeout>';
}
else {
$fType = $ftypes[$i];
$base = $bases[$i];
$data = $callback_data{$fToGet};
}
next if $timed_out{$fToGet};
$fType = $ftypes[$i];
$base = $bases[$i];
$data = $callback_data{$fToGet};
$col = printField($field, $data, $fType, $base, $col);
}
print("\n"); # Final newline