Skip to content

Commit

Permalink
Rebased, updated to use add_children_as_readables to fix deprecated e…
Browse files Browse the repository at this point in the history
…rrors, and updated enum baseclass to use ophyd_async's.
  • Loading branch information
Will Barnett committed Nov 10, 2024
1 parent 0bcad8a commit 5fedc76
Showing 1 changed file with 24 additions and 31 deletions.
55 changes: 24 additions & 31 deletions src/dodal/devices/watsonmarlow323_pump.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
from enum import Enum

from ophyd_async.core import StandardReadable
from ophyd_async.core import ConfigSignal, StandardReadable, StrictEnum
from ophyd_async.epics.signal import epics_signal_rw


class WatsonMarlow323PumpEnable(str, Enum):
class WatsonMarlow323PumpEnable(StrictEnum):
DISABLED = "Disabled"
ENABLED = "Enabled"


class WatsonMarlow323PumpDirection(str, Enum):
class WatsonMarlow323PumpDirection(StrictEnum):
CLOCKWISE = "CW"
COUNTER_CLOCKWISE = "CCW"


class WatsonMarlow323PumpState(str, Enum):
class WatsonMarlow323PumpState(StrictEnum):
STOPPED = "STOP"
STARTED = "START"

Expand All @@ -23,30 +21,25 @@ class WatsonMarlow323Pump(StandardReadable):
"""Watson Marlow 323 Peristaltic Pump device"""

def __init__(self, prefix: str, name: str = "") -> None:
self.enabled = epics_signal_rw(
WatsonMarlow323PumpEnable,
prefix + "DISABLE",
)

self.direction = epics_signal_rw(
WatsonMarlow323PumpDirection,
read_pv=prefix + "INFO:DIR",
write_pv=prefix + "SET:DIR",
)
self.state = epics_signal_rw(
WatsonMarlow323PumpState,
read_pv=prefix + "INFO:RUN",
write_pv=prefix + "SET:RUN",
)
self.speed = epics_signal_rw(
float, read_pv=prefix + "INFO:SPD", write_pv=prefix + "SET:SPD"
)

self.set_readable_signals(
read=[self.state, self.speed, self.direction],
config=[
self.enabled,
],
)
with self.add_children_as_readables():
self.direction = epics_signal_rw(
WatsonMarlow323PumpDirection,
read_pv=prefix + "INFO:DIR",
write_pv=prefix + "SET:DIR",
)
self.state = epics_signal_rw(
WatsonMarlow323PumpState,
read_pv=prefix + "INFO:RUN",
write_pv=prefix + "SET:RUN",
)
self.speed = epics_signal_rw(
float, read_pv=prefix + "INFO:SPD", write_pv=prefix + "SET:SPD"
)

with self.add_children_as_readables(ConfigSignal):
self.enabled = epics_signal_rw(
WatsonMarlow323PumpEnable,
prefix + "DISABLE",
)

super().__init__(name=name)

0 comments on commit 5fedc76

Please sign in to comment.