Skip to content

Commit

Permalink
Merge pull request #756 from lnls-sirius/fix-bbb
Browse files Browse the repository at this point in the history
Fix bugs in Device BbB.
  • Loading branch information
fernandohds564 authored Nov 2, 2021
2 parents bcbeea7 + 17dab26 commit d3d3bbb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion siriuspy/siriuspy/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.37.0
2.38.0
23 changes: 19 additions & 4 deletions siriuspy/siriuspy/devices/bbb.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""."""

import time as _time
from threading import Event as _Event

import numpy as _np

Expand Down Expand Up @@ -305,7 +306,7 @@ def rf_freq_nom(self):
@property
def revolution_freq_nom(self):
"""."""
return self['FREV'] * 1e6
return self['FREV'] * 1e3

@property
def harmonic_number(self):
Expand Down Expand Up @@ -729,6 +730,10 @@ def __init__(self, devname, acqtype='BRAM'):
devname, propty_prefix=acqtype+'_',
properties=Acquisition._properties)

pvo = self.pv_object('RAW')
self._update_data_evt = _Event()
pvo.add_callback(self._update_evt)

# ########### Acquisition Config Properties ###########
@property
def acq_type(self):
Expand Down Expand Up @@ -897,17 +902,23 @@ def cmd_data_acquire(self, timeout=DEF_TIMEOUT):
self.acq_enbl = 1
return self._wait('ACQ_EN', 1, timeout=timeout)

def cmd_data_dump(self, timeout=DEF_TIMEOUT):
def cmd_data_dump(self, timeout=DEF_TIMEOUT, pv_update=False):
"""."""
if pv_update:
self._update_data_evt.clear()
self['DUMP'] = 1
return self.wait_data_dump(timeout)
return self.wait_data_dump(timeout, pv_update=pv_update)

def wait_data_dump(self, timeout=None):
def wait_data_dump(self, timeout=None, pv_update=False):
"""."""
timeout = timeout or Acquisition.DEF_TIMEOUT
if not self._wait('DUMP', False, timeout=timeout):
print('WARN: Timed out waiting data dump.')
return False
if pv_update and not self._update_data_evt.wait(timeout=timeout):
print('WARN: Timed out waiting PV data update.')
return False
self._update_data_evt.clear()
return True

# ########### Spectrometer Properties ###########
Expand Down Expand Up @@ -1161,6 +1172,10 @@ def modal_maximum_mode_spec(self):
"""."""
return self['MD_SPEC']

def _update_evt(self, **kwargs):
_ = kwargs
self._update_data_evt.set()


class SingleBunch(_ProptyDevice):
"""."""
Expand Down

0 comments on commit d3d3bbb

Please sign in to comment.