Skip to content

Commit b9f18a9

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 50df140 commit b9f18a9

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎dlclivegui/cameras/backends/gentl_backend.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ def _node_value(node_map, name: str, default=None):
11551155
return default
11561156

11571157
@classmethod
1158-
def _node_float(cls, node_map, *names: str) -> float | None:
1158+
def _node_float(cls, node_map, *names: str, allow_zero: bool = False) -> float | None:
11591159
"""Return the first positive float value from a list of GenICam node names."""
11601160
for name in names:
11611161
value = cls._node_value(node_map, name, None)
@@ -1164,7 +1164,7 @@ def _node_float(cls, node_map, *names: str) -> float | None:
11641164
except Exception:
11651165
continue
11661166

1167-
if fvalue > 0:
1167+
if fvalue > 0 or (allow_zero and fvalue == 0):
11681168
return fvalue
11691169

11701170
return None
@@ -1761,6 +1761,7 @@ def _read_telemetry(self, node_map) -> None:
17611761
"ExposureTime",
17621762
"ExposureTimeAbs",
17631763
"Exposure",
1764+
allow_zero=True,
17641765
)
17651766
if exposure is not None:
17661767
self._actual_exposure = exposure
@@ -1769,6 +1770,7 @@ def _read_telemetry(self, node_map) -> None:
17691770
node_map,
17701771
"Gain",
17711772
"GainRaw",
1773+
allow_zero=True,
17721774
)
17731775
if gain is not None:
17741776
self._actual_gain = gain
@@ -1799,7 +1801,7 @@ def _read_telemetry(self, node_map) -> None:
17991801
if exposure_auto is not None:
18001802
ns["actual_exposure_auto"] = exposure_auto
18011803

1802-
throughput = self._node_float(node_map, "DeviceLinkThroughputLimit")
1804+
throughput = self._node_float(node_map, "DeviceLinkThroughputLimit", allow_zero=True)
18031805
if throughput is not None:
18041806
ns["actual_device_link_throughput_limit"] = float(throughput)
18051807

0 commit comments

Comments
 (0)