Skip to content
Merged
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
15 changes: 15 additions & 0 deletions src/dodal/devices/zebra/zebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
from bluesky.protocols import Movable
from ophyd_async.core import (
AsyncStatus,
DeviceMock,
DeviceVector,
SignalRW,
StandardReadable,
StrictEnum,
callback_on_mock_put,
default_mock_class,
observe_value,
set_mock_value,
)
from ophyd_async.epics.core import epics_signal_r, epics_signal_rw

Expand Down Expand Up @@ -88,6 +92,17 @@ class SoftInState(StrictEnum):
NO = "No"


class InstantArmMock(DeviceMock["ArmingDevice"]):
async def connect(self, device: ArmingDevice) -> None:
callback_on_mock_put(
device.arm_set, lambda *_, **__: set_mock_value(device.armed, 1)
)
callback_on_mock_put(
device.disarm_set, lambda *_, **__: set_mock_value(device.armed, 0)
)


@default_mock_class(InstantArmMock)
class ArmingDevice(StandardReadable, Movable[ArmDemand]):
"""A useful device that can abstract some of the logic of arming.
Allows a user to just call arm.set(ArmDemand.ARM)"""
Expand Down