Skip to content

Commit

Permalink
adding back changes to _Device.py, _AxiStreamDmaMon.py and pydm
Browse files Browse the repository at this point in the history
  • Loading branch information
ruck314 committed Jul 6, 2024
1 parent 0c03eb3 commit 75957ca
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
3 changes: 3 additions & 0 deletions python/pyrogue/_Device.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,10 +709,13 @@ def _buildBlocks(self):

# Align to min access, create list of remote variables
elif isinstance(n,pr.RemoteVariable) and n.offset is not None:
self._log.info(f"Before Shift variable {n.name} offset={n.offset} bitSize={n.bitSize} bytes={n.varBytes}")
n._updatePath(n.path)
n._shiftOffsetDown(n.offset % blkSize, blkSize)
remVars += [n]

self._log.info(f"Creating variable {n.name} offset={n.offset} bitSize={n.bitSize} bytes={n.varBytes}")

# Sort var list by offset, size
remVars.sort(key=lambda x: (x.offset, x.varBytes))
blocks = []
Expand Down
19 changes: 19 additions & 0 deletions python/pyrogue/hardware/axi/_AxiStreamDmaMon.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,25 @@ def __init__(self, axiStreamDma, pollInterval=1, **kwargs):
self._dma = axiStreamDma

# Add variables
self.add(pr.LocalVariable(
name = 'GitVersion',
description = 'DMA\'s Driver GIT Version string',
mode = 'RO',
value = '',
localGet = lambda: self._dma.getGitVersion(),
))

self.add(pr.LocalVariable(
name = 'ApiVersion',
description = 'DMA\'s Driver API Version',
mode = 'RO',
value = 0x0,
typeStr = 'UInt8',
units = 'Bytes',
disp = '{:#x}',
localGet = lambda: self._dma.getApiVersion(),
))

self.add(pr.LocalVariable(
name = 'BuffSize',
description = 'Size of buffers (RX/TX)',
Expand Down
20 changes: 19 additions & 1 deletion python/pyrogue/pydm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,52 @@
#-----------------------------------------------------------------------------
import os
import sys
import signal
import pydm
import pyrogue
import pyrogue.pydm.data_plugins.rogue_plugin

# Define a signal handler to ensure the application quits gracefully
def pydmSignalHandler(sig, frame):
app = pydm.PyDMApplication.instance()
if app is not None:
app.closeAllWindows()

# Function to run the PyDM application with specified parameters
def runPyDM(serverList='localhost:9090', ui=None, title=None, sizeX=800, sizeY=1000, maxListExpand=5, maxListSize=100):

# Set the ROGUE_SERVERS environment variable
os.environ['ROGUE_SERVERS'] = serverList

# Set the UI file to a default value if not provided
if ui is None or ui == '':
ui = os.path.dirname(os.path.abspath(__file__)) + '/pydmTop.py'

# Set the title to a default value if not provided
if title is None:
title = "Rogue Server: {}".format(os.getenv('ROGUE_SERVERS'))

# Prepare command line arguments
args = []
args.append(f"sizeX={sizeX}")
args.append(f"sizeY={sizeY}")
args.append(f"title='{title}'")
args.append(f"maxListExpand={maxListExpand}")
args.append(f"maxListSize={maxListSize}")

# Initialize the PyDM application with specified parameters
app = pydm.PyDMApplication(ui_file=ui,
command_line_args=args,
hide_nav_bar=True,
hide_menu_bar=True,
hide_status_bar=True)

# Setup signal handling for CTRL+C and SIGTERM for handling termination signal
signal.signal(signal.SIGINT, pydmSignalHandler)
signal.signal(signal.SIGTERM, pydmSignalHandler)

# Print message indicating the GUI is running and how to exit
print(f"Running GUI. Close window, hit cntrl-c or send SIGTERM to {os.getpid()} to exit.")

# Run the PyDM application
app.exec()

0 comments on commit 75957ca

Please sign in to comment.