Skip to content

Commit

Permalink
Merge pull request #51 from NSLS-II-CSX/fix-two-button-shutter
Browse files Browse the repository at this point in the history
Fix the enum strings for EPSTwoStateDevice
  • Loading branch information
mrakitin authored Feb 2, 2021
2 parents 9e6d6c9 + 1db1b3f commit 9e60add
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions profile_collection/startup/csx1/devices/eps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import time as ttime
import datetime

from ophyd import Device, EpicsSignal, EpicsSignalRO
from ophyd.device import Component as Cpt
Expand Down Expand Up @@ -39,7 +40,12 @@ def set(self, val):
enums = self.status.enum_strs

def shutter_cb(value, timestamp, **kwargs):
value = enums[int(value)]
try:
value = enums[int(value)]
except (ValueError, TypeError):
# we are here because value is a str not int
# just move on
...
if value == target_val:
self._set_st._finished()
self._set_st = None
Expand All @@ -49,7 +55,12 @@ def shutter_cb(value, timestamp, **kwargs):
count = 0
def cmd_retry_cb(value, timestamp, **kwargs):
nonlocal count
value = cmd_enums[int(value)]
try:
value = cmd_enums[int(value)]
except (ValueError, TypeError):
# we are here because value is a str not int
# just move on
...
count += 1
if count > 5:
cmd_sig.clear_sub(cmd_retry_cb)
Expand Down

0 comments on commit 9e60add

Please sign in to comment.