Skip to content

Commit 0560d43

Browse files
committed
Allow zero node values and reduce log level
Change LOG.info to LOG.debug to reduce noise when printing node information. Add an allow_zero parameter to _node_float so callers can accept zero as a valid value (previously only positive values were returned). Update callers for exposure, gain, and DeviceLinkThroughputLimit to pass allow_zero=True so reported zeros are treated as real readings while preserving the original behavior by default.
1 parent 070e4a0 commit 0560d43

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

dlclivegui/cameras/backends/gentl_backend.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def _debug_frame_rate_nodes(self, node_map, *, context: str = "") -> None:
229229
except Exception:
230230
pass
231231

232-
LOG.info("%s: %s=%r %s", label, name, value, " ".join(extras))
232+
LOG.debug("%s: %s=%r %s", label, name, value, " ".join(extras))
233233

234234
# ------------------------------------------------------------------
235235
# Discovery
@@ -1075,7 +1075,7 @@ def _node_value(node_map, name: str, default=None):
10751075
return default
10761076

10771077
@classmethod
1078-
def _node_float(cls, node_map, *names: str) -> float | None:
1078+
def _node_float(cls, node_map, *names: str, allow_zero: bool = False) -> float | None:
10791079
"""Return the first positive float value from a list of GenICam node names."""
10801080
for name in names:
10811081
value = cls._node_value(node_map, name, None)
@@ -1084,7 +1084,7 @@ def _node_float(cls, node_map, *names: str) -> float | None:
10841084
except Exception:
10851085
continue
10861086

1087-
if fvalue > 0:
1087+
if fvalue > 0 or (allow_zero and fvalue == 0):
10881088
return fvalue
10891089

10901090
return None
@@ -1540,6 +1540,7 @@ def _read_telemetry(self, node_map) -> None:
15401540
"ExposureTime",
15411541
"ExposureTimeAbs",
15421542
"Exposure",
1543+
allow_zero=True,
15431544
)
15441545
if exposure is not None:
15451546
self._actual_exposure = exposure
@@ -1548,6 +1549,7 @@ def _read_telemetry(self, node_map) -> None:
15481549
node_map,
15491550
"Gain",
15501551
"GainRaw",
1552+
allow_zero=True,
15511553
)
15521554
if gain is not None:
15531555
self._actual_gain = gain
@@ -1578,7 +1580,7 @@ def _read_telemetry(self, node_map) -> None:
15781580
if exposure_auto is not None:
15791581
ns["actual_exposure_auto"] = exposure_auto
15801582

1581-
throughput = self._node_float(node_map, "DeviceLinkThroughputLimit")
1583+
throughput = self._node_float(node_map, "DeviceLinkThroughputLimit", allow_zero=True)
15821584
if throughput is not None:
15831585
ns["actual_device_link_throughput_limit"] = float(throughput)
15841586

0 commit comments

Comments
 (0)