Skip to content
Draft
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
11 changes: 10 additions & 1 deletion src/ophyd_async/epics/core/_aioca.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,17 @@ async def connect(self, timeout: float):
self.converter = make_converter(self.datatype, self.initial_values)

async def _caget(self, pv: str, format: Format) -> AugmentedValue:
# Target: avoid breaking backwards compatability
# perhaps overcautious on how to define element count
# aioca.caget documentation states that element_count=1
# by default. If this is provided values do change
# Todo:
# need to check what pvaccess and p4p provide
kws = dict()
if self.options.element_count is not None:
kws["count"] = self.options.element_count
return await caget(
pv, datatype=self.converter.read_dbr, format=format, timeout=None
pv, datatype=self.converter.read_dbr, format=format, timeout=None, **kws
)

def _make_reading(self, value: AugmentedValue) -> Reading[SignalDatatypeT]:
Expand Down
5 changes: 4 additions & 1 deletion src/ophyd_async/epics/core/_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ def epics_signal_r(
read_pv: str,
name: str = "",
timeout: float = DEFAULT_TIMEOUT,
element_count: int | None = None
) -> SignalR[SignalDatatypeT]:
"""Create a `SignalR` backed by 1 EPICS PV.

Expand All @@ -163,7 +164,9 @@ def epics_signal_r(
:param name: The name of the signal (defaults to empty string)
:param timeout: A timeout to be used when reading (not connecting) this signal
"""
backend = _epics_signal_backend(datatype, read_pv, read_pv)
backend = _epics_signal_backend(
datatype, read_pv, read_pv, options=EpicsOptions(element_count=element_count)
)
return SignalR(backend, name=name, timeout=timeout)


Expand Down
9 changes: 9 additions & 0 deletions src/ophyd_async/epics/core/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ class EpicsOptions(Generic[SignalDatatypeT]):
as it causes a deadlock.
"""

element_count: None | int = None
"""Epics allows to specify the maximum number of elements to transfer

Fast devices provide buffers that acquire large data sets. Typically
one only needs the beginning of this buffer.

None is used as standard argument: transfer as many elements as provided
"""


def get_pv_basename_and_field(pv: str) -> tuple[str, str | None]:
"""Split PV into record name and field."""
Expand Down
Loading