Skip to content

Commit

Permalink
respond to feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
stan-dot committed Aug 30, 2024
1 parent 13c2d85 commit 1c77f3c
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/dodal/devices/pressure_jump_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,31 @@ class AllValvesControl(StandardReadable, Movable):
"""
valves 2, 4, 7, 8 are not controlled by the IOC,
as they are under manual control.
fast_valves: tuple[int, ...] = (5, 6)
slow_valves: tuple[int, ...] = (1, 3)
"""

def __init__(self, prefix: str, name: str = "") -> None:
def __init__(
self,
prefix: str,
name: str = "",
fast_valves: tuple[int, ...] = (5, 6),
slow_valves: tuple[int, ...] = (1, 3),
) -> None:
self.fast_valves = fast_valves
self.slow_valves = slow_valves
with self.add_children_as_readables():
self.valve_states: DeviceVector[SignalR[ValveState]] = DeviceVector(
{i: epics_signal_r(ValveState, f"{prefix}V{i}:STA") for i in [1, 3]}
{
i: epics_signal_r(ValveState, f"{prefix}V{i}:STA")
for i in self.slow_valves
}
)
self.fast_valve_states: DeviceVector[SignalR[FastValveState]] = (
DeviceVector(
{
i: epics_signal_r(FastValveState, f"{prefix}V{i}:STA")
for i in [5, 6]
for i in self.fast_valves
}
)
)
Expand All @@ -117,15 +130,15 @@ def __init__(self, prefix: str, name: str = "") -> None:
DeviceVector(
{
i: epics_signal_rw(FastValveControlRequest, f"{prefix}V{i}:CON")
for i in [5, 6]
for i in self.fast_valves
}
)
)

self.valve_control: DeviceVector[SignalRW[ValveControlRequest]] = DeviceVector(
{
i: epics_signal_rw(ValveControlRequest, f"{prefix}V{i}:CON")
for i in [1, 3]
for i in self.slow_valves
}
)

Expand All @@ -134,9 +147,9 @@ def __init__(self, prefix: str, name: str = "") -> None:
async def set_valve(
self, valve: int, value: ValveControlRequest | FastValveControlRequest
):
if valve in [1, 3] and isinstance(value, ValveControlRequest):
if valve in self.slow_valves and isinstance(value, ValveControlRequest):
await self.valve_control[valve].set(value)
elif valve in [5, 6] and isinstance(value, FastValveControlRequest):
elif valve in self.fast_valves and isinstance(value, FastValveControlRequest):
await self.fast_valve_control[valve].set(value)

Check warning on line 153 in src/dodal/devices/pressure_jump_cell.py

View check run for this annotation

Codecov / codecov/patch

src/dodal/devices/pressure_jump_cell.py#L150-L153

Added lines #L150 - L153 were not covered by tests

@AsyncStatus.wrap
Expand All @@ -158,7 +171,7 @@ def __init__(self, prefix: str, name: str = "") -> None:
PumpMotorDirectionState, prefix + "MTRDIR"
)
self.pump_speed = epics_signal_rw(
float, write_pv=prefix + "MSPEED", read_pv="MSPEED_RBV"
float, write_pv=prefix + "MSPEED", read_pv=prefix + "MSPEED_RBV"
)

with self.add_children_as_readables(ConfigSignal):
Expand Down

0 comments on commit 1c77f3c

Please sign in to comment.