From e849f5e5a3f072854fa9c081a7d23fa0562bdd11 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" <robin.mueller.m@gmail.com> Date: Mon, 6 Apr 2020 19:52:45 +0200 Subject: [PATCH] single command bugfix --- config/OBSW_Config.py | 1 + obsw_tmtc_client.py | 12 +++++++----- sendreceive/obsw_single_command_sender_receiver.py | 7 +++---- tc/OBSW_TcService200.py | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/config/OBSW_Config.py b/config/OBSW_Config.py index 622fba0..a45651b 100644 --- a/config/OBSW_Config.py +++ b/config/OBSW_Config.py @@ -40,6 +40,7 @@ Mission/Device specific information. # Object IDs GPS0_ObjectId = bytearray([0x44, 0x10, 0x1F, 0x00]) GPS1_ObjectId = bytearray([0x44, 0x20, 0x20, 0x00]) +DUMMY_DEVICE_ID = bytearray([0x44, 0x00, 0xAF, 0xFE]) # SIDs GPS0_SID = bytearray([0x00, 0x00, 0x1f, 0x00]) diff --git a/obsw_tmtc_client.py b/obsw_tmtc_client.py index b87a27f..b1ef278 100644 --- a/obsw_tmtc_client.py +++ b/obsw_tmtc_client.py @@ -59,6 +59,7 @@ import logging import sys from collections import deque +from OBSW_TcService200 import packModeData from test import OBSW_PusServiceTest from config import OBSW_Config as g from config.OBSW_Config import setGlobals @@ -111,7 +112,7 @@ def main(): sender_and_receiver = SingleCommandSenderReceiver( comInterface=communication_interface, tmtcPrinter=tmtc_printer, tmListener=tm_listener, pusPacketTuple=pus_packet_tuple, tmTimeout=g.tmTimeout, - tcTimeoutFactor=g.tcSendTimeoutFactor, doPrintToFile=g.G_PRINT_TO_FILE) + tcTimeoutFactor=g.tcSendTimeoutFactor) sender_and_receiver.send_single_tc_and_receive_tm() elif g.modeId == g.ModeList.ServiceTestMode: @@ -156,10 +157,11 @@ def command_preparation(): # Direct command which triggers an additional step reply and one completion reply # Single Command Testing command = PUSTelecommand(service=17, subservice=1, SSC=21) - # command.print() - # file = bytearray([1, 2, 3, 4, 5]) - # command = PUSTelecommand(service=23, subservice=1, SSC=21, data=file) - # command.packCommandTuple() + # Object ID: Dummy Device + objectId = g.DUMMY_DEVICE_ID + # Set On Mode + modeData = packModeData(objectId, 1, 0) + command = PUSTelecommand(service=200, subservice=1, SSC=2000, data=modeData) return command.packCommandTuple() diff --git a/sendreceive/obsw_single_command_sender_receiver.py b/sendreceive/obsw_single_command_sender_receiver.py index 27be3c1..8ea94f1 100644 --- a/sendreceive/obsw_single_command_sender_receiver.py +++ b/sendreceive/obsw_single_command_sender_receiver.py @@ -22,8 +22,7 @@ class SingleCommandSenderReceiver(CommandSenderReceiver): This object can be used by instantiating it and calling sendSingleTcAndReceiveTm() """ def __init__(self, comInterface: ComIF_T, tmtcPrinter: TmTcPrinterT, tmListener: TmListenerT, - pusPacketTuple: tuple, tmTimeout: float, tcTimeoutFactor: float, - doPrintToFile: bool): + pusPacketTuple: tuple, tmTimeout: float, tcTimeoutFactor: float): """ :param comInterface: CommunicationInterface object, passed on to CommandSenderReceiver :param tmListener: TmListener object which runs in the background and receives all TM @@ -35,8 +34,8 @@ class SingleCommandSenderReceiver(CommandSenderReceiver): :param doPrintToFile: Specify whether output is also printed to a file """ super().__init__(comInterface=comInterface, tmListener=tmListener, tmtcPrinter=tmtcPrinter, - tmTimeout=tmTimeout, tcSendTimeoutFactor=tcTimeoutFactor, - doPrintToFile=doPrintToFile) + tmTimeout=tmTimeout, tcSendTimeoutFactor=tcTimeoutFactor) + self.faulty_input = False try: self.pus_packet, self.pus_packet_info = pusPacketTuple except TypeError: diff --git a/tc/OBSW_TcService200.py b/tc/OBSW_TcService200.py index 3abc8e9..9ebb0da 100644 --- a/tc/OBSW_TcService200.py +++ b/tc/OBSW_TcService200.py @@ -13,13 +13,14 @@ Run script with -s <Service or Device> -m 3 with optional -p parameter for file """ from tc.OBSW_TcPacket import PUSTelecommand from tc.OBSW_TcPacker import tcQueueT +import config.OBSW_Config as g import struct def packService200TestInto(tcQueue: tcQueueT) -> tcQueueT: tcQueue.appendleft(("print", "Testing Service 200")) # Object ID: Dummy Device - objectId = bytearray([0x44, 0x00, 0xAF, 0xFE]) + objectId = g.DUMMY_DEVICE_ID # Set On Mode tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode On")) modeData = packModeData(objectId, 1, 0) -- GitLab