From ab5b2da05709d71dd3f932c5478dc931f8e86581 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" <robin.mueller.m@gmail.com> Date: Fri, 9 Oct 2020 15:37:20 +0200 Subject: [PATCH] added commands to enable printout --- .../tmtcclient_Disable_Periodic_Print_.xml | 24 +++++++++ .../tmtcclient_Enable_Periodic_Print.xml | 24 +++++++++ tc/obsw_pus_tc_packer.py | 2 +- tc/obsw_tc_service5_17.py | 52 ++++++++++++------- 4 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 .idea/runConfigurations/tmtcclient_Disable_Periodic_Print_.xml create mode 100644 .idea/runConfigurations/tmtcclient_Enable_Periodic_Print.xml diff --git a/.idea/runConfigurations/tmtcclient_Disable_Periodic_Print_.xml b/.idea/runConfigurations/tmtcclient_Disable_Periodic_Print_.xml new file mode 100644 index 0000000..be75fe2 --- /dev/null +++ b/.idea/runConfigurations/tmtcclient_Disable_Periodic_Print_.xml @@ -0,0 +1,24 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="tmtcclient Disable Periodic Print " type="PythonConfigurationType" factoryName="Python" folderName="Serial Utility"> + <module name="tmtc" /> + <option name="INTERPRETER_OPTIONS" value="" /> + <option name="PARENT_ENVS" value="true" /> + <envs> + <env name="PYTHONUNBUFFERED" value="1" /> + </envs> + <option name="SDK_HOME" value="" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + <option name="IS_MODULE_SDK" value="true" /> + <option name="ADD_CONTENT_ROOTS" value="true" /> + <option name="ADD_SOURCE_ROOTS" value="true" /> + <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> + <option name="PARAMETERS" value="-m 3 -s 17 -o 129 -c 1 -t 2.2" /> + <option name="SHOW_COMMAND_LINE" value="false" /> + <option name="EMULATE_TERMINAL" value="true" /> + <option name="MODULE_MODE" value="false" /> + <option name="REDIRECT_INPUT" value="false" /> + <option name="INPUT_FILE" value="" /> + <method v="2" /> + </configuration> +</component> \ No newline at end of file diff --git a/.idea/runConfigurations/tmtcclient_Enable_Periodic_Print.xml b/.idea/runConfigurations/tmtcclient_Enable_Periodic_Print.xml new file mode 100644 index 0000000..62d7645 --- /dev/null +++ b/.idea/runConfigurations/tmtcclient_Enable_Periodic_Print.xml @@ -0,0 +1,24 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="tmtcclient Enable Periodic Print" type="PythonConfigurationType" factoryName="Python" folderName="Serial Utility"> + <module name="tmtc" /> + <option name="INTERPRETER_OPTIONS" value="" /> + <option name="PARENT_ENVS" value="true" /> + <envs> + <env name="PYTHONUNBUFFERED" value="1" /> + </envs> + <option name="SDK_HOME" value="" /> + <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> + <option name="IS_MODULE_SDK" value="true" /> + <option name="ADD_CONTENT_ROOTS" value="true" /> + <option name="ADD_SOURCE_ROOTS" value="true" /> + <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> + <option name="SCRIPT_NAME" value="$PROJECT_DIR$/obsw_tmtc_client.py" /> + <option name="PARAMETERS" value="-m 3 -s 17 -o 128 -c 1 -t 2.2" /> + <option name="SHOW_COMMAND_LINE" value="false" /> + <option name="EMULATE_TERMINAL" value="true" /> + <option name="MODULE_MODE" value="false" /> + <option name="REDIRECT_INPUT" value="false" /> + <option name="INPUT_FILE" value="" /> + <method v="2" /> + </configuration> +</component> \ No newline at end of file diff --git a/tc/obsw_pus_tc_packer.py b/tc/obsw_pus_tc_packer.py index 943a52c..613044a 100644 --- a/tc/obsw_pus_tc_packer.py +++ b/tc/obsw_pus_tc_packer.py @@ -46,7 +46,7 @@ class ServiceQueuePacker: if service == 9: return pack_service9_test_into(service_queue) if service == 17: - return pack_service17_test_into(service_queue) + return pack_service17_test_into(service_queue, op_code) if service == 20: return pack_service20_test_into(service_queue) if service == 23 or service.lower() == "sd": diff --git a/tc/obsw_tc_service5_17.py b/tc/obsw_tc_service5_17.py index 9045f08..49be65b 100644 --- a/tc/obsw_tc_service5_17.py +++ b/tc/obsw_tc_service5_17.py @@ -36,23 +36,37 @@ def pack_service5_test_into(tc_queue: TcQueueT) -> TcQueueT: return tc_queue -def pack_service17_test_into(tc_queue: TcQueueT) -> TcQueueT: - tc_queue.appendleft(("print", "Testing Service 17")) - # ping test - tc_queue.appendleft(("print", "Testing Service 17: Ping Test")) - command = PusTelecommand(service=17, subservice=1, ssc=1700) - tc_queue.appendleft(command.pack_command_tuple()) - # enable event - tc_queue.appendleft(("print", "Testing Service 17: Enable Event")) - command = PusTelecommand(service=5, subservice=5, ssc=52) - tc_queue.appendleft(command.pack_command_tuple()) - # test event - tc_queue.appendleft(("print", "Testing Service 17: Trigger event")) - command = PusTelecommand(service=17, subservice=128, ssc=1701) - tc_queue.appendleft(command.pack_command_tuple()) - # invalid subservice - tc_queue.appendleft(("print", "Testing Service 17: Invalid subservice")) - command = PusTelecommand(service=17, subservice=243, ssc=1702) - tc_queue.appendleft(command.pack_command_tuple()) - tc_queue.appendleft(("export", "log/tmtc_log_service17.txt")) +def pack_service17_test_into(tc_queue: TcQueueT, op_code: int) -> TcQueueT: + if op_code == 0: + tc_queue.appendleft(("print", "Testing Service 17")) + # ping test + tc_queue.appendleft(("print", "Testing Service 17: Ping Test")) + command = PusTelecommand(service=17, subservice=1, ssc=1700) + tc_queue.appendleft(command.pack_command_tuple()) + # enable event + tc_queue.appendleft(("print", "Testing Service 17: Enable Event")) + command = PusTelecommand(service=5, subservice=5, ssc=52) + tc_queue.appendleft(command.pack_command_tuple()) + # test event + tc_queue.appendleft(("print", "Testing Service 17: Trigger event")) + command = PusTelecommand(service=17, subservice=128, ssc=1701) + tc_queue.appendleft(command.pack_command_tuple()) + # invalid subservice + tc_queue.appendleft(("print", "Testing Service 17: Invalid subservice")) + command = PusTelecommand(service=17, subservice=243, ssc=1702) + tc_queue.appendleft(command.pack_command_tuple()) + tc_queue.appendleft(("export", "log/tmtc_log_service17.txt")) + elif op_code == 128: + pack_enable_periodic_print_packet(tc_queue, True, 0) + elif op_code == 129: + pack_enable_periodic_print_packet(tc_queue, False, 0) return tc_queue + + +def pack_enable_periodic_print_packet(tc_queue: TcQueueT, enable: bool, ssc: int): + tc_queue.appendleft(("print", "Enabling periodic printout")) + if enable: + command = PusTelecommand(service=17, subservice=128, ssc=ssc) + else: + command = PusTelecommand(service=17, subservice=129, ssc=ssc) + tc_queue.appendleft(command.pack_command_tuple()) \ No newline at end of file -- GitLab