Skip to content

Commit

Permalink
changed start_acquiring_driver_and_ensure_status
Browse files Browse the repository at this point in the history
  • Loading branch information
ZohebShaikh committed Sep 17, 2024
1 parent 822a024 commit 76b1392
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/ophyd_async/epics/adaravis/_aravis_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
)
from ophyd_async.core._status import AsyncStatus
from ophyd_async.epics import adcore
from ophyd_async.epics.adcore._core_logic import (
start_acquiring_driver_and_ensure_status,
)

from ._aravis_io import AravisDriverIO, AravisTriggerMode, AravisTriggerSource

Expand Down Expand Up @@ -47,7 +50,7 @@ async def prepare(self, trigger_info: TriggerInfo):
)

async def arm(self):
self._arm_status = self._drv.acquire.set(True)
self._arm_status = await start_acquiring_driver_and_ensure_status(self._drv)

async def wait_for_idle(self):
if self._arm_status:
Expand Down
5 changes: 3 additions & 2 deletions src/ophyd_async/epics/adcore/_core_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,14 @@ async def start_acquiring_driver_and_ensure_status(
An AsyncStatus that can be awaited to set driver.acquire to True and perform
subsequent raising (if applicable) due to detector state.
"""

status = driver.acquire.set(True, timeout=timeout)
await wait_for_value(driver.acquire, True, timeout=None)
await set_and_wait_for_value(driver.acquire, True, timeout=timeout)

async def complete_acquisition() -> None:
"""NOTE: possible race condition here between the callback from
set_and_wait_for_value and the detector state updating."""
await wait_for_value(driver.acquire, True, timeout=None)
await status
state = await driver.detector_state.get_value()
if state not in good_states:
raise ValueError(
Expand Down

0 comments on commit 76b1392

Please sign in to comment.