Skip to content

Commit

Permalink
Merge pull request #148 from skliper/fix147-gui_padding
Browse files Browse the repository at this point in the history
Fix #147, Pad GUI headers to 64 bit boundary
  • Loading branch information
astrogeco committed Jan 25, 2021
2 parents caa7e0b + 9076cf3 commit 7f667e0
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions GroundSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@
# CFS Ground System: Setup and manage the main window
#
class GroundSystem(QMainWindow, Ui_MainWindow):
HDR_VER_1_OFFSET = 0
HDR_VER_2_OFFSET = 4
TLM_HDR_V1_OFFSET = 4
TLM_HDR_V2_OFFSET = 4
CMD_HDR_PRI_V1_OFFSET = 0
CMD_HDR_SEC_V1_OFFSET = 0
CMD_HDR_PRI_V2_OFFSET = 4
CMD_HDR_SEC_V2_OFFSET = 4

#
# Init the class
Expand All @@ -57,10 +61,16 @@ def __init__(self):
self.RoutingService = None
self.alert = QMessageBox()

# set initial defaults
self.sbTlmOffset.setValue(self.TLM_HDR_V1_OFFSET)
self.sbCmdOffsetPri.setValue(self.CMD_HDR_PRI_V1_OFFSET)
self.sbCmdOffsetSec.setValue(self.CMD_HDR_SEC_V1_OFFSET)

self.pushButtonStartTlm.clicked.connect(self.startTlmSystem)
self.pushButtonStartCmd.clicked.connect(self.startCmdSystem)
self.cbTlmHeaderVer.currentIndexChanged.connect(self.setTlmOffset)
self.cbCmdHeaderVer.currentIndexChanged.connect(self.setCmdOffsets)

for sb in (self.sbTlmOffset, self.sbCmdOffsetPri, self.sbCmdOffsetSec):
sb.valueChanged.connect(self.saveOffsets)
# Init lists
Expand Down Expand Up @@ -132,9 +142,9 @@ def setTlmOffset(self):
else:
self.sbTlmOffset.setEnabled(False)
if selectedVer == "1":
self.sbTlmOffset.setValue(self.HDR_VER_1_OFFSET)
self.sbTlmOffset.setValue(self.TLM_HDR_V1_OFFSET)
elif selectedVer == "2":
self.sbTlmOffset.setValue(self.HDR_VER_2_OFFSET)
self.sbTlmOffset.setValue(self.TLM_HDR_V2_OFFSET)

def setCmdOffsets(self):
selectedVer = self.cbCmdHeaderVer.currentText().strip()
Expand All @@ -145,10 +155,11 @@ def setCmdOffsets(self):
self.sbCmdOffsetPri.setEnabled(False)
self.sbCmdOffsetSec.setEnabled(False)
if selectedVer == "1":
self.sbCmdOffsetPri.setValue(self.HDR_VER_1_OFFSET)
self.sbCmdOffsetPri.setValue(self.CMD_HDR_PRI_V1_OFFSET)
self.sbCmdOffsetSec.setValue(self.CMD_HDR_SEC_V1_OFFSET)
elif selectedVer == "2":
self.sbCmdOffsetPri.setValue(self.HDR_VER_2_OFFSET)
self.sbCmdOffsetSec.setValue(self.HDR_VER_1_OFFSET)
self.sbCmdOffsetPri.setValue(self.CMD_HDR_PRI_V2_OFFSET)
self.sbCmdOffsetSec.setValue(self.CMD_HDR_SEC_V2_OFFSET)

def saveOffsets(self):
offsets = bytes((self.sbTlmOffset.value(), self.sbCmdOffsetPri.value(),
Expand Down

0 comments on commit 7f667e0

Please sign in to comment.