diff --git a/GroundSystem.py b/GroundSystem.py
index 059a0b9..732effa 100644
--- a/GroundSystem.py
+++ b/GroundSystem.py
@@ -17,7 +17,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-#cFS Ground System Version 2.0.0
+# cFS Ground System Version 2.0.0
#
#!/usr/bin/env python3
#
@@ -28,8 +28,9 @@
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox
-from MainWindow import Ui_MainWindow
+import common.shareddata as shared
from RoutingService import RoutingService
+from Ui_MainWindow import Ui_MainWindow
ROOTDIR = Path(sys.argv[0]).resolve().parent
@@ -43,13 +44,15 @@ class GroundSystem(QMainWindow, Ui_MainWindow):
#
def __init__(self):
super().__init__()
- self.setupUi((self))
+ self.setupUi(self)
self.RoutingService = None
self.alert = QMessageBox()
self.pushButtonStartTlm.clicked.connect(self.startTlmSystem)
self.pushButtonStartCmd.clicked.connect(self.startCmdSystem)
+ self.cbHeaderVer.currentIndexChanged.connect(self.setFixedOffset)
+ self.sbOffset.valueChanged.connect(self.getOffset)
# Init lists
self.ipAddressesList = ['All']
self.spacecraftNames = ['All']
@@ -81,14 +84,12 @@ def DisplayErrorMessage(self, message):
# Start the telemetry system for the selected spacecraft
def startTlmSystem(self):
+ # Setup the subscription (to let the telemetry
+ # system know the messages it will be receiving)
+ subscription = '--sub=GroundSystem'
selectedSpacecraft = self.getSelectedSpacecraftName()
-
- # Setup the subscription (to let know the
- # telemetry system the messages it will be receiving)
- if selectedSpacecraft == 'All':
- subscription = '--sub=GroundSystem'
- else:
- subscription = f'--sub=GroundSystem.{selectedSpacecraft}.TelemetryPackets'
+ if selectedSpacecraft != 'All':
+ subscription += f'.{selectedSpacecraft}.TelemetryPackets'
# Open Telemetry System
system_call = f'python3 {ROOTDIR}/Subsystems/tlmGUI/TelemetrySystem.py {subscription}'
@@ -114,6 +115,20 @@ def startFDLSystem(self):
subscription
])
+ def setFixedOffset(self):
+ selectedVer = self.cbHeaderVer.currentText().strip()
+ if selectedVer == "Custom":
+ self.sbOffset.setEnabled(True)
+ else:
+ self.sbOffset.setEnabled(False)
+ if selectedVer == "1":
+ self.sbOffset.setValue(0)
+ elif selectedVer == "2":
+ self.sbOffset.setValue(4)
+
+ def getOffset(self):
+ shared.offsetVal = self.sbOffset.value()
+
# Update the combo box list in gui
def updateIpList(self, ip, name):
self.ipAddressesList.append(ip)
diff --git a/MainWindow.py b/MainWindow.py
deleted file mode 100644
index dea718d..0000000
--- a/MainWindow.py
+++ /dev/null
@@ -1,121 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file '/home/lbleier/cFS/tools/cFS-GroundSystem/MainWindow.ui'
-#
-# Created by: PyQt5 UI code generator 5.12.3
-#
-# WARNING! All changes made in this file will be lost!
-
-
-from PyQt5 import QtCore, QtGui, QtWidgets
-
-
-class Ui_MainWindow(object):
- def setupUi(self, MainWindow):
- MainWindow.setObjectName("MainWindow")
- MainWindow.setEnabled(True)
- MainWindow.resize(420, 217)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(24)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
- MainWindow.setSizePolicy(sizePolicy)
- self.centralwidget = QtWidgets.QWidget(MainWindow)
- self.centralwidget.setObjectName("centralwidget")
- self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
- self.verticalLayout.setObjectName("verticalLayout")
- self.labelHomeTittle = QtWidgets.QLabel(self.centralwidget)
- font = QtGui.QFont()
- font.setPointSize(22)
- font.setBold(False)
- font.setWeight(50)
- self.labelHomeTittle.setFont(font)
- self.labelHomeTittle.setAlignment(QtCore.Qt.AlignCenter)
- self.labelHomeTittle.setObjectName("labelHomeTittle")
- self.verticalLayout.addWidget(self.labelHomeTittle)
- self.line_2 = QtWidgets.QFrame(self.centralwidget)
- self.line_2.setFrameShape(QtWidgets.QFrame.HLine)
- self.line_2.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line_2.setObjectName("line_2")
- self.verticalLayout.addWidget(self.line_2)
- self.horizontalLayout = QtWidgets.QHBoxLayout()
- self.horizontalLayout.setObjectName("horizontalLayout")
- spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.horizontalLayout.addItem(spacerItem)
- self.label_3 = QtWidgets.QLabel(self.centralwidget)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth())
- self.label_3.setSizePolicy(sizePolicy)
- self.label_3.setMinimumSize(QtCore.QSize(141, 0))
- self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
- self.label_3.setObjectName("label_3")
- self.horizontalLayout.addWidget(self.label_3)
- self.comboBoxIpAddresses = QtWidgets.QComboBox(self.centralwidget)
- self.comboBoxIpAddresses.setMinimumSize(QtCore.QSize(132, 0))
- self.comboBoxIpAddresses.setMaximumSize(QtCore.QSize(132, 16777215))
- self.comboBoxIpAddresses.setObjectName("comboBoxIpAddresses")
- self.comboBoxIpAddresses.addItem("")
- self.horizontalLayout.addWidget(self.comboBoxIpAddresses)
- spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
- self.horizontalLayout.addItem(spacerItem1)
- self.verticalLayout.addLayout(self.horizontalLayout)
- self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_2.setSpacing(32)
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
- self.pushButtonStartTlm = QtWidgets.QPushButton(self.centralwidget)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.pushButtonStartTlm.sizePolicy().hasHeightForWidth())
- self.pushButtonStartTlm.setSizePolicy(sizePolicy)
- self.pushButtonStartTlm.setObjectName("pushButtonStartTlm")
- self.horizontalLayout_2.addWidget(self.pushButtonStartTlm)
- self.pushButtonStartCmd = QtWidgets.QPushButton(self.centralwidget)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.pushButtonStartCmd.sizePolicy().hasHeightForWidth())
- self.pushButtonStartCmd.setSizePolicy(sizePolicy)
- self.pushButtonStartCmd.setObjectName("pushButtonStartCmd")
- self.horizontalLayout_2.addWidget(self.pushButtonStartCmd)
- self.verticalLayout.addLayout(self.horizontalLayout_2)
- self.line = QtWidgets.QFrame(self.centralwidget)
- self.line.setFrameShape(QtWidgets.QFrame.HLine)
- self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
- self.line.setObjectName("line")
- self.verticalLayout.addWidget(self.line)
- self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_4.setObjectName("horizontalLayout_4")
- self.label_5 = QtWidgets.QLabel(self.centralwidget)
- font = QtGui.QFont()
- font.setPointSize(11)
- self.label_5.setFont(font)
- self.label_5.setObjectName("label_5")
- self.horizontalLayout_4.addWidget(self.label_5)
- self.pushButton = QtWidgets.QPushButton(self.centralwidget)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.pushButton.sizePolicy().hasHeightForWidth())
- self.pushButton.setSizePolicy(sizePolicy)
- self.pushButton.setObjectName("pushButton")
- self.horizontalLayout_4.addWidget(self.pushButton)
- self.verticalLayout.addLayout(self.horizontalLayout_4)
- MainWindow.setCentralWidget(self.centralwidget)
-
- self.retranslateUi(MainWindow)
- self.pushButton.clicked.connect(MainWindow.close)
- QtCore.QMetaObject.connectSlotsByName(MainWindow)
-
- def retranslateUi(self, MainWindow):
- _translate = QtCore.QCoreApplication.translate
- MainWindow.setWindowTitle(_translate("MainWindow", "Main Window"))
- self.labelHomeTittle.setText(_translate("MainWindow", "CFS Ground System"))
- self.label_3.setText(_translate("MainWindow", "Selected IP Address: "))
- self.comboBoxIpAddresses.setItemText(0, _translate("MainWindow", "All"))
- self.pushButtonStartTlm.setText(_translate("MainWindow", "Start Telemetry System"))
- self.pushButtonStartCmd.setText(_translate("MainWindow", "Start Command System"))
- self.label_5.setText(_translate("MainWindow", "*Read Guide-GroundSystem.txt for help"))
- self.pushButton.setText(_translate("MainWindow", "Close"))
diff --git a/MainWindow.ui b/MainWindow.ui
index 0999d2e..3bcb4e7 100644
--- a/MainWindow.ui
+++ b/MainWindow.ui
@@ -9,8 +9,8 @@
0
0
- 420
- 217
+ 452
+ 265
@@ -25,7 +25,7 @@
-
-
+
22
@@ -49,21 +49,8 @@
-
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
+
+
-
@@ -78,14 +65,14 @@
- Selected IP Address:
+ Selected IP Address
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
- -
+
-
@@ -106,18 +93,78 @@
- -
-
-
- Qt::Horizontal
+
-
+
+
+
+ 0
+ 0
+
-
+
- 40
- 20
+ 141
+ 0
+
+
+
+ Header version
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 132
+ 0
-
+
+
+ 132
+ 16777215
+
+
+ -
+
+ 1
+
+
+ -
+
+ 2
+
+
+ -
+
+ Custom
+
+
+
+
+ -
+
+
+ false
+
+
+ <html><head/><body><p>Offset (in bytes) to be *added to* existing offsets listed in tlm/cmd text files</p></body></html>
+
+
+ QAbstractSpinBox::NoButtons
+
+
+
+ -
+
+
+ Offset (bytes)
+
+
diff --git a/RoutingService.py b/RoutingService.py
index 47139ca..c5447ff 100644
--- a/RoutingService.py
+++ b/RoutingService.py
@@ -100,8 +100,7 @@ def run(self):
# Handle errors
except socket.error:
- print(
- f'Ignored socket error for attempt {socketErrorCount}')
+ print('Ignored socket error for attempt', socketErrorCount)
socketErrorCount += 1
sleep(1)
diff --git a/Subsystems/cmdGui/CommandSystem.py b/Subsystems/cmdGui/CommandSystem.py
index 01ad4a2..eea10ce 100644
--- a/Subsystems/cmdGui/CommandSystem.py
+++ b/Subsystems/cmdGui/CommandSystem.py
@@ -31,6 +31,7 @@
from Ui_CommandSystemDialog import Ui_CommandSystemDialog
+## ../cFS/tools/cFS-GroundSystem/Subsystems/cmdGui/
ROOTDIR = Path(sys.argv[0]).resolve().parent
@@ -94,7 +95,7 @@ def ProcessQuickButton(self, idx):
# if doesn't require parameters
else:
launch_string = (
- f'{ROOTDIR}/../cmdUtil/cmdUtil '
+ f'{ROOTDIR.parent}/cmdUtil/cmdUtil '
f'--host=\"{address}\" --port={quickPort[qIdx]} '
f'--pktid={pktId} --endian={quickEndian[qIdx]} '
f'--cmdcode={quickCode[qIdx]}')
@@ -166,7 +167,7 @@ def ProcessQuickButton(self, idx):
with open(f'{ROOTDIR}/{quickDefFile}') as subFile:
reader = csv.reader(subFile)
for fileRow in reader:
- if fileRow[0][0] != '#':
+ if not fileRow[0].startswith('#'):
subsys.append(fileRow[0])
subsysFile.append(fileRow[1])
quickCmd.append(fileRow[2].strip())
diff --git a/Subsystems/cmdGui/Parameter.py b/Subsystems/cmdGui/Parameter.py
index 1cd6d9d..497636d 100644
--- a/Subsystems/cmdGui/Parameter.py
+++ b/Subsystems/cmdGui/Parameter.py
@@ -64,7 +64,7 @@ def ProcessSendButton(self):
param_list.append(f'{dataType}={inpt}') # --byte=4
param_string = ' '.join(param_list)
launch_string = (
- f'{ROOTDIR}/../cmdUtil/cmdUtil --host={pageAddress} '
+ f'{ROOTDIR.parent}/cmdUtil/cmdUtil --host={pageAddress} '
f'--port={pagePort} --pktid={pagePktId} --endian={pageEndian} '
f'--cmdcode={cmdCode} {param_string.strip()}')
cmd_args = shlex.split(launch_string)
@@ -98,7 +98,7 @@ def ProcessSendButton(self):
elif opt in ("-d", "--descrip"):
cmdDesc = arg # command name, eg No-Op
elif opt in ("-i", "--idx"):
- _ = int(arg) # comand index in command definition file
+ _ = int(arg) # command index in command definition file
elif opt in ("-h", "--host"):
pageAddress = arg # send to address
elif opt in ("-p", "--port"):
@@ -124,7 +124,7 @@ def ProcessSendButton(self):
#
pickle_file = f'{ROOTDIR}/ParameterFiles/' + re.split(r'\.', param_file)[0]
with open(pickle_file, 'rb') as pickle_obj:
- dataTypesOrig, paramNames, paramLen, paramDesc, dataTypesNew, stringLen = pickle.load(
+ _, paramNames, _, paramDesc, dataTypesNew, stringLen = pickle.load(
pickle_obj)
#
diff --git a/Subsystems/cmdGui/UdpCommands.py b/Subsystems/cmdGui/UdpCommands.py
index ba02561..d3827e6 100644
--- a/Subsystems/cmdGui/UdpCommands.py
+++ b/Subsystems/cmdGui/UdpCommands.py
@@ -44,6 +44,7 @@
from Ui_GenericCommandDialog import Ui_GenericCommandDialog
+## ../cFS/tools/cFS-GroundSystem/Subsystems/cmdGui/
ROOTDIR = Path(sys.argv[0]).resolve().parent
class SubsystemCommands(QDialog, Ui_GenericCommandDialog):
@@ -93,7 +94,7 @@ def ProcessSendButtonGeneric(self, idx):
# If parameters not required, directly calls cmdUtil to send command
else:
launch_string = (
- f'{ROOTDIR}/../cmdUtil/cmdUtil --host=\"{address}\" '
+ f'{ROOTDIR.parent}/cmdUtil/cmdUtil --host=\"{address}\" '
f'--port={pagePort} --pktid={pagePktId} '
f'--endian={pageEndian} --cmdcode={cmdCodes[idx]}')
diff --git a/Subsystems/tlmGUI/GenericTelemetry.py b/Subsystems/tlmGUI/GenericTelemetry.py
index 92ada77..6ae7a8f 100644
--- a/Subsystems/tlmGUI/GenericTelemetry.py
+++ b/Subsystems/tlmGUI/GenericTelemetry.py
@@ -33,8 +33,16 @@
from Ui_GenericTelemetryDialog import Ui_GenericTelemetryDialog
+## ../cFS/tools/cFS-GroundSystem/Subsystems/tlmGUI
ROOTDIR = Path(sys.argv[0]).resolve().parent
+## Adds ../cFS/tools/cFS-GroundSystem to module search path
+## for shared data import
+sys.path.append(str(ROOTDIR.parent.parent))
+import common.shareddata as shared
+
+
+
class SubsystemTelemetry(QDialog, Ui_GenericTelemetryDialog):
#
# Init the class
@@ -44,7 +52,7 @@ def __init__(self):
self.setupUi(self)
#
- # This method Decodes a telemetry item from the packet and displays it
+ # This method decodes a telemetry item from the packet and displays it
#
@staticmethod
def displayTelemetryItem(datagram, tlmIndex, labelField, valueField):
@@ -52,8 +60,9 @@ def displayTelemetryItem(datagram, tlmIndex, labelField, valueField):
TlmField1 = tlmItemFormat[tlmIndex]
if TlmField1[0] == "<":
TlmField1 = TlmField1[1:]
- TlmField2 = datagram[int(tlmItemStart[tlmIndex]):(
- int(tlmItemStart[tlmIndex]) + int(tlmItemSize[tlmIndex]))]
+ itemStart = int(tlmItemStart[tlmIndex]) + shared.offsetVal
+ TlmField2 = datagram[itemStart:itemStart +
+ int(tlmItemSize[tlmIndex])]
TlmField = unpack(TlmField1, TlmField2)
if tlmItemDisplayType[tlmIndex] == 'Dec':
valueField.setText(str(TlmField[0]))
@@ -184,7 +193,7 @@ def usage():
print('Generic Telemetry Page started. Subscribed to', subscription)
- py_endian = '<' if endian == 'L' else '>'
+ py_endian = '<' if endian.upper() == 'L' else '>'
#
# Init the QT application and the telemetry class