SXXXXXXX_PyBusMonitor1553/tests/test_b6_to_b18_pack.py
2026-01-07 10:41:14 +01:00

23 lines
579 B
Python

import struct
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'pybusmonitor1553')))
from Grifo_E_1553lib.messages.tws_status_and_targets import TwsStatusAndTargets0102
labels = list(range(6,19)) # B6..B18
def dump_message_words(msg):
b = bytes(msg)
nwords = len(b)//2
le = struct.unpack("<%dH" % nwords, b)
print([hex(x) for x in le])
def main():
for idx in labels:
m = TwsStatusAndTargets0102()
print(f"--- B{idx} ---")
dump_message_words(m)
if __name__ == '__main__':
main()