Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ repos:
args: [--fix]
- id: ruff-format

# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.18.2
# hooks:
# - id: mypy
# additional_dependencies: [
# "pydantic>=2.0",
# ]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
additional_dependencies: [
"pydantic>=2.0",
]
1 change: 0 additions & 1 deletion pyaml_cs_oa/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ async def _run_get(self) -> SignalDatatypeT:
"""Connect and fetch the backend's current value."""
await self._r_sig.connect()
backend = self._r_sig._connector.backend
print(f"Read {self._r_sig.name}")
return await backend.get_value()

async def async_get(self) -> SignalDatatypeT:
Expand Down
20 changes: 19 additions & 1 deletion pyaml_cs_oa/signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ def build(self):

self.SP, self.RB = get_SP_RB(self._cfg)

# FIXME: Find a way using Ophyd to get attribute config to see if the TangoAtt is R or RW
# rather than creating a DeviceProxy for nothing
# Work around the issue by checking that the setpoint is None
if isinstance(self._cfg, TangoConfigAtt):
try:
setpoint = self.SP.get()
if setpoint is None:
self._writable = False
except Exception as ex:
...

if self.SP:
self.SP.__peer__ = self
if self.RB:
Expand All @@ -45,7 +56,14 @@ def get_cs(self) -> str:

def name(self) -> str:
"""Return the backend signal name."""
return self._signal.name
if isinstance(self._cfg, EpicsConfigR):
return self._cfg.read_pvname
elif isinstance(self._cfg, (EpicsConfigW, EpicsConfigRW)):
return self._cfg.write_pvname
elif isinstance(self._cfg, TangoConfigAtt):
return self._cfg.attribute
else:
raise ValueError(f"Unsupported control system config type: {type(self._cfg)!r}")

def measure_name(self) -> str:
"""Return the configured process-variable or attribute name."""
Expand Down
Loading