Skip to content

Commit fb1b2ed

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 4f09b21 commit fb1b2ed

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
@@ -1149,7 +1149,7 @@ def _node_value(node_map, name: str, default=None):
11491149
return default
11501150

11511151
@classmethod
1152-
def _node_float(cls, node_map, *names: str) -> float | None:
1152+
def _node_float(cls, node_map, *names: str, allow_zero: bool = False) -> float | None:
11531153
"""Return the first positive float value from a list of GenICam node names."""
11541154
for name in names:
11551155
value = cls._node_value(node_map, name, None)
@@ -1158,7 +1158,7 @@ def _node_float(cls, node_map, *names: str) -> float | None:
11581158
except Exception:
11591159
continue
11601160

1161-
if fvalue > 0:
1161+
if fvalue > 0 or (allow_zero and fvalue == 0):
11621162
return fvalue
11631163

11641164
return None
@@ -1733,6 +1733,7 @@ def _read_telemetry(self, node_map) -> None:
17331733
"ExposureTime",
17341734
"ExposureTimeAbs",
17351735
"Exposure",
1736+
allow_zero=True,
17361737
)
17371738
if exposure is not None:
17381739
self._actual_exposure = exposure
@@ -1741,6 +1742,7 @@ def _read_telemetry(self, node_map) -> None:
17411742
node_map,
17421743
"Gain",
17431744
"GainRaw",
1745+
allow_zero=True,
17441746
)
17451747
if gain is not None:
17461748
self._actual_gain = gain
@@ -1771,7 +1773,7 @@ def _read_telemetry(self, node_map) -> None:
17711773
if exposure_auto is not None:
17721774
ns["actual_exposure_auto"] = exposure_auto
17731775

1774-
throughput = self._node_float(node_map, "DeviceLinkThroughputLimit")
1776+
throughput = self._node_float(node_map, "DeviceLinkThroughputLimit", allow_zero=True)
17751777
if throughput is not None:
17761778
ns["actual_device_link_throughput_limit"] = float(throughput)
17771779

0 commit comments

Comments
 (0)