From a9e2beb65d74e51222cd114589094a08b4ef377d Mon Sep 17 00:00:00 2001 From: Jack Harper Date: Thu, 15 Aug 2024 13:24:26 +0100 Subject: [PATCH] put period duration in demo plan, fix bools --- src/ibex_bluesky_core/demo_plan.py | 2 +- src/ibex_bluesky_core/devices/dae.py | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ibex_bluesky_core/demo_plan.py b/src/ibex_bluesky_core/demo_plan.py index 2de485b..044b63c 100644 --- a/src/ibex_bluesky_core/demo_plan.py +++ b/src/ibex_bluesky_core/demo_plan.py @@ -32,7 +32,7 @@ def run_demo_plan() -> None: dae = Dae(prefix) RE( demo_plan(block, dae), - LiveTable(["mot", "DAE-good_uah", "DAE-run_state", "DAE-rb_number"], default_prec=10), + LiveTable(["mot", "DAE-good_uah", "DAE-run_state", "DAE-rb_number", "DAE-period-run_duration"], default_prec=10), ) # RE(demo_plan(block, dae), print) diff --git a/src/ibex_bluesky_core/devices/dae.py b/src/ibex_bluesky_core/devices/dae.py index a150ab7..b92a5a6 100644 --- a/src/ibex_bluesky_core/devices/dae.py +++ b/src/ibex_bluesky_core/devices/dae.py @@ -6,7 +6,7 @@ import numpy as np from bluesky.protocols import Triggerable from ophyd_async.core import AsyncStatus, ConfigSignal, SignalR, SignalRW, StandardReadable -from ophyd_async.epics.signal import epics_signal_r +from ophyd_async.epics.signal import epics_signal_r, epics_signal_rw from ibex_bluesky_core.devices.dae_controls import DaeControls from ibex_bluesky_core.devices.dae_event_mode import DaeEventMode @@ -35,6 +35,13 @@ class RunstateEnum(str, Enum): def __str__(self): return str(self.value) +class YesNoEnum(str, Enum): + No = "No" + Yes = "Yes" + + def __str__(self): + return str(self.value) + class Dae(StandardReadable, Triggerable): """Device representing the ISIS data acquisition electronics.""" @@ -46,7 +53,7 @@ def __init__(self, prefix: str, name: str = "DAE") -> None: self.good_uah: SignalR[float] = epics_signal_r(float, f"{dae_prefix}GOODUAH") self.count_rate: SignalR[float] = epics_signal_r(float, f"{dae_prefix}COUNTRATE") self.m_events: SignalR[float] = epics_signal_r(float, f"{dae_prefix}MEVENTS") - self.sim_mode: SignalR[bool] = epics_signal_r(bool, f"{dae_prefix}SIM_MODE") + self.sim_mode: SignalR[YesNoEnum] = epics_signal_r(YesNoEnum, f"{dae_prefix}SIM_MODE") self.neutron_proton_ratio: SignalR[float] = epics_signal_r( float, f"{dae_prefix}NPRATIO" ) @@ -77,9 +84,8 @@ def __init__(self, prefix: str, name: str = "DAE") -> None: RunstateEnum, f"{dae_prefix}RUNSTATE" ) self.title: SignalRW = isis_epics_signal_rw(str, f"{dae_prefix}TITLE") - self.show_title_and_users: SignalRW = isis_epics_signal_rw( - bool, f"{dae_prefix}TITLE:DISPLAY" - ) + self.show_title_and_users: SignalRW = epics_signal_rw(YesNoEnum, f"{dae_prefix}TITLE:DISPLAY", f"{dae_prefix}TITLE:DISPLAY") + self.users: SignalRW = isis_epics_signal_rw(str, f"{dae_prefix}_USERNAME") self.rb_number: SignalRW = isis_epics_signal_rw(str, f"{dae_prefix}_RBNUMBER")