Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review PDFFastShutter code #8

Open
mrakitin opened this issue May 17, 2019 · 1 comment
Open

Review PDFFastShutter code #8

mrakitin opened this issue May 17, 2019 · 1 comment

Comments

@mrakitin
Copy link
Member

class PDFFastShutter(Device):
cmd = Cpt(EpicsSignal, 'Cmd', kind='omitted')
status = Cpt(EpicsSignal, 'Sts', kind='omitted')
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.st = None
# TODO: ask CJ to change it downstream to only accept the 'Open' or 'Close' strings (no numbers please!).
self.setmap = {'Open': 0, 'Close': 1,
1: 0, 0: 1} # MR: this is an inversed logic on the xpdacq side
self.readmap = {0: 'Open', 1: 'Close'}
def set(self, val):
def check_if_done(value, old_value, **kwargs):
if ((val in ['Open', 1] and value == 0) or
(val in ['Close', 0] and value == 1)):
if self.st is not None:
self.st._finished()
self.st = None
return True
return False
self.cmd.set(self.setmap[val])
status = SubscriptionStatus(self.status, check_if_done)
return status
def get(self):
return self.readmap[self.cmd.get()]
def read(self):
d = super().read()
d[self.name] = {'value': self.get(), 'timestamp': time.time()}
return d
def stop(self, success=False):
return self.set('Close')

@tacaswell writes:

it looks like self._st is never not None

@mrakitin
Copy link
Member Author

@awalter-bnl pointed out that the shutter re-work in NSLS-II/nslsii#52 will handle the states better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant