-
Notifications
You must be signed in to change notification settings - Fork 74
Labels
Milestone
Description
Describe the bug
When using CHeaderParser.py to serialise commands, if a command has an unsigned 64b integer parameter, the uint64 type is reset by the script to be double, but this type is not available in MiniCmdUtil.py. This causes an error on line 101 of that file (endian = typeSig.endian or self.endian) because typeSig has not been created.
To Reproduce
Steps to reproduce the behavior:
- Create a command definition with a
uint64parameter, e.g.GOTOXYZwith struct {uint64 x; uint64 y; uint64 z} - Add the command to cfs-GroundSystem using
CHeaderParser.py - Send a command of this type
- Receive error:
Traceback (most recent call last):
File "path/tools/cFS-GroundSystem/Subsystems/cmdGui/Parameter.py", line 68, in ProcessSendButton
sendSuccess = self.mcu.sendPacket()
File "path/tools/cFS-GroundSystem/Subsystems/cmdGui/MiniCmdUtil.py", line 138, in sendPacket
self.assemblePacket()
File "path/tools/cFS-GroundSystem/Subsystems/cmdGui/MiniCmdUtil.py", line 122, in assemblePacket
priHeader = self.assemblePriHeader()
File "path/tools/cFS-GroundSystem/Subsystems/cmdGui/MiniCmdUtil.py", line 79, in assemblePriHeader
self.assemblePayload()
File "path/tools/cFS-GroundSystem/Subsystems/cmdGui/MiniCmdUtil.py", line 101, in assemblePayload
endian = typeSig.endian or self.endian
UnboundLocalError: local variable 'typeSig' referenced before assignment
Expected behavior
For the double/uint64 argument(s) to be accepted and the command to be sent to cFS without error.
Code snips
CHeaderParser.py
73 | def findDataTypeNew(dataTypeOrig, paramName):
74 | if '[' in paramName:
75 | return '--string'
76 | if dataTypeOrig in ['uint8', 'boolean']:
77 | return '--byte'
78 | if dataTypeOrig == 'uint16':
79 | return '--half'
80 | if dataTypeOrig == 'uint32':
81 | return '--word'
82 | if dataTypeOrig == 'uint64':
83 | return '--double'
84 | return None
MiniCmdUtil.py
29 | class MiniCmdUtil:
30 | ## Class objects
31 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
32 | TypeSignature = namedtuple("TypeSignature", 'byteLen, signed, endian')
33 | dataTypes = {
34 | ("b", "int8", "byte"): TypeSignature(1, True, None),
35 | ("m", "uint8"): TypeSignature(1, False, None),
36 | ("h", "int16", "half"): TypeSignature(2, True, None),
37 | ("n", "uint16"): TypeSignature(2, False, None),
38 | ("l", "int32", "long", "word"): TypeSignature(4, True, None),
39 | ("o", "uint32"): TypeSignature(4, False, None),
40 | ("q", "int64"): TypeSignature(8, True, None),
41 | ("p", "uint64"): TypeSignature(8, False, None),
42 | ("i", "int16b"): TypeSignature(2, True, "big"),
43 | ("j", "int32b"): TypeSignature(4, True, "big"),
44 | ("k", "int64b"): TypeSignature(8, True, "big"),
45 | ("w", "uint16b"): TypeSignature(2, False, "big"),
46 | ("x", "uint32b"): TypeSignature(4, False, "big"),
47 | ("y", "uint64b"): TypeSignature(8, False, "big")
48 | }
System observed on:
- cFE main, cFS-GroundSystem main
Reporter Info
Jack White
Reactions are currently unavailable