Skip to content

Commit

Permalink
Made the easy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
simonscryo committed Sep 7, 2024
1 parent 0030097 commit 750da62
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions socs/agents/scpi_psu/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@ def monitor_output(self, session, params=None):

while self.monitor:
with self.lock.acquire_timeout(1) as acquired:
if acquired:
if not self._initialize_module()
if not acquired:
self.log.warn("Could not acquire in monitor_current")

else:
if not self._initialize_module():
time.sleep(5)

else
else:
data = {
'timestamp': time.time(),
'block_name': 'output',
Expand All @@ -102,16 +105,13 @@ def monitor_output(self, session, params=None):
self.log.info("Attempting to reconnect")
self.psu = None
break
#Check to make sure there weren't any timeout errors so we don't publish
#incomplete data and create block errors.
if self.psu:
self.agent.publish_to_feed('psu_output', data)

# Allow this process to be queried to return current data
session.data = data
# Only publish if the loop completes without timeout errors
# as publishing incomplete data creates block errors
if self.psu:
self.agent.publish_to_feed('psu_output', data)

else:
self.log.warn("Could not acquire in monitor_current")
# Allow this process to be queried to return current data
session.data = data

time.sleep(params['wait'])

Expand Down

0 comments on commit 750da62

Please sign in to comment.