From 453560b911fc545012b79c97df791a00dc43f29f Mon Sep 17 00:00:00 2001 From: jennmald Date: Fri, 27 Feb 2026 16:29:54 -0500 Subject: [PATCH 1/4] draft: value using two button shutter --- nslsii/devices.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nslsii/devices.py b/nslsii/devices.py index 314e0a5f..6cfec24a 100644 --- a/nslsii/devices.py +++ b/nslsii/devices.py @@ -5,6 +5,9 @@ _time_fmtstr = '%Y-%m-%d %H:%M:%S' +class Valve(TwoButtonShutter): + def stop(self, *, success=False): + ... class TwoButtonShutter(Device): # TODO: this needs to be fixed in EPICS as these names make no sense From 5c03a81b0f460b49e5ce259b03d0e6d6678431ee Mon Sep 17 00:00:00 2001 From: jennmald Date: Tue, 3 Mar 2026 12:22:29 -0500 Subject: [PATCH 2/4] move valve class --- nslsii/devices.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nslsii/devices.py b/nslsii/devices.py index 6cfec24a..5b8638cb 100644 --- a/nslsii/devices.py +++ b/nslsii/devices.py @@ -5,10 +5,6 @@ _time_fmtstr = '%Y-%m-%d %H:%M:%S' -class Valve(TwoButtonShutter): - def stop(self, *, success=False): - ... - class TwoButtonShutter(Device): # TODO: this needs to be fixed in EPICS as these names make no sense # the value coming out of the PV does not match what is shown in CSS @@ -131,3 +127,7 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._set_st = None self.read_attrs = ['status'] + +class Valve(TwoButtonShutter): + def stop(self, *, success=False): + ... From 1b04422662733276891e68dfa8cbe19aca328055 Mon Sep 17 00:00:00 2001 From: jennmald Date: Wed, 4 Mar 2026 10:53:27 -0500 Subject: [PATCH 3/4] better naming conventions --- nslsii/devices.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nslsii/devices.py b/nslsii/devices.py index 5b8638cb..387c0934 100644 --- a/nslsii/devices.py +++ b/nslsii/devices.py @@ -5,9 +5,7 @@ _time_fmtstr = '%Y-%m-%d %H:%M:%S' -class TwoButtonShutter(Device): - # TODO: this needs to be fixed in EPICS as these names make no sense - # the value coming out of the PV does not match what is shown in CSS +class TwoButtonActuator(Device): RETRY_PERIOD = 0.5 MAX_ATTEMPTS = 10 open_cmd = Cpt(EpicsSignal, 'Cmd:Opn-Cmd', string=True) @@ -128,6 +126,11 @@ def __init__(self, *args, **kwargs): self._set_st = None self.read_attrs = ['status'] -class Valve(TwoButtonShutter): + +class TwoButtonActuatorAutoClose(TwoButtonActuator): def stop(self, *, success=False): + # overide the stop method to always close the shutter ... + +class TwoButtonShutter(TwoButtonActuatorAutoClose): + pass \ No newline at end of file From 62cbe305de259fa650b1ceffbd604dad84fbd9af Mon Sep 17 00:00:00 2001 From: jennmald Date: Fri, 6 Mar 2026 11:00:13 -0500 Subject: [PATCH 4/4] move stop functions --- nslsii/devices.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/nslsii/devices.py b/nslsii/devices.py index 387c0934..2444f3c7 100644 --- a/nslsii/devices.py +++ b/nslsii/devices.py @@ -94,17 +94,6 @@ def cmd_retry_cb(value, timestamp, **kwargs): return st - def stop(self, *, success=False): - import time - prev_st = self._set_st - if prev_st is not None: - while not prev_st.done: - time.sleep(.1) - self._was_open = (self.open_val == self.status.get()) - st = self.set('Close') - while not st.done: - time.sleep(.5) - def resume(self): import time prev_st = self._set_st @@ -129,8 +118,17 @@ def __init__(self, *args, **kwargs): class TwoButtonActuatorAutoClose(TwoButtonActuator): def stop(self, *, success=False): - # overide the stop method to always close the shutter - ... + import time + prev_st = self._set_st + if prev_st is not None: + while not prev_st.done: + time.sleep(.1) + self._was_open = (self.open_val == self.status.get()) + st = self.set('Close') + while not st.done: + time.sleep(.5) class TwoButtonShutter(TwoButtonActuatorAutoClose): - pass \ No newline at end of file + def stop(self, *, success=False): + # overide the stop method to always close the shutter + ...