From 973bdeadd61a91141fd1fa5771e06ddae8263194 Mon Sep 17 00:00:00 2001 From: Markus Kranz Date: Wed, 18 May 2022 18:39:18 +0200 Subject: [PATCH] proc service added --- config/definitions.py | 1 + config/hook_implementations.py | 2 ++ pus_tc/cmd_definitions.py | 16 ++++++++++++++++ pus_tc/system/proc.py | 24 ++++++++++++++++++++++++ pus_tc/tc_packer_hook.py | 3 +++ tmtc_conf.json | 6 ++++++ 6 files changed, 52 insertions(+) create mode 100644 pus_tc/system/proc.py create mode 100644 tmtc_conf.json diff --git a/config/definitions.py b/config/definitions.py index 80a7ddb..20aa498 100644 --- a/config/definitions.py +++ b/config/definitions.py @@ -46,3 +46,4 @@ class CustomServiceList(enum.Enum): SUS_ASS = "sus-ass" TCS_ASS = "tcs-ass" TIME = "time" + PROCEDURE = "proc" diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 9f50c1f..400672e 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -71,6 +71,7 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): add_ploc_supv_cmds, add_system_cmds, add_time_cmds, + add_proc_cmds, ) from pus_tc.devs.gps import GpsOpCodes @@ -85,6 +86,7 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): add_ploc_supv_cmds(cmd_dict=service_op_code_dict) add_system_cmds(cmd_dict=service_op_code_dict) add_time_cmds(cmd_dict=service_op_code_dict) + add_proc_cmds(cmd_dict=service_op_code_dict) op_code_dict = { GpsOpCodes.RESET_GNSS.value: ("Reset GPS", {OpCodeDictKeys.TIMEOUT: 2.0}) diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 37e4a8e..a9e4387 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -685,6 +685,22 @@ def add_ploc_supv_cmds(cmd_dict: ServiceOpCodeDictT): ] = service_ploc_memory_dumper_tuple +def add_proc_cmds(cmd_dict: ServiceOpCodeDictT): + from pus_tc.system.proc import OpCodes, Info + op_code_dict = dict() + add_op_code_entry( + op_code_dict=op_code_dict, + keys=OpCodes.HEATER, + info=Info.HEATER + ) + add_service_op_code_entry( + srv_op_code_dict=cmd_dict, + name=CustomServiceList.PROCEDURE.value, + info="Procedures", + op_code_entry=op_code_dict, + ) + + def add_system_cmds(cmd_dict: ServiceOpCodeDictT): from pus_tc.system.acs import AcsOpCodes, SusOpCodes import pus_tc.system.tcs as tcs diff --git a/pus_tc/system/proc.py b/pus_tc/system/proc.py new file mode 100644 index 0000000..0544df0 --- /dev/null +++ b/pus_tc/system/proc.py @@ -0,0 +1,24 @@ +from tmtccmd.config import QueueCommands +from tmtccmd.tc.definitions import TcQueueT + + +class OpCodes: + HEATER = ["0", "heater"] + + +class Info: + HEATER = "heater procedure" + + +def pack_proc_commands(tc_queue: TcQueueT, op_code: str): + testint = 10 + print(f"hello world{op_code} {testint}") + if op_code in OpCodes.HEATER: + tc_queue.appendleft((QueueCommands.PRINT, "TUrning heater 0 on")) + tc_queue.appendleft(heater1cmd_on.pack_command_tuple()) + tc_queue.appendleft((QueueCommands.PRINT, "TUrning heater 0 off")) + tc_queue.appendleft(heater1cmd_off.pack_command_tuple()) + tc_queue.appendleft(heater1cmd.pack_command_tuple()) + tc_queue.appendleft(heater1cmd.pack_command_tuple()) + + pass diff --git a/pus_tc/tc_packer_hook.py b/pus_tc/tc_packer_hook.py index 420a768..cb370cb 100644 --- a/pus_tc/tc_packer_hook.py +++ b/pus_tc/tc_packer_hook.py @@ -41,6 +41,7 @@ from pus_tc.system.acs import pack_acs_command, pack_sus_cmds from pus_tc.devs.plpcdu import pack_pl_pcdu_commands from pus_tc.devs.str_img_helper import pack_str_img_helper_command from pus_tc.system.tcs import pack_tcs_sys_commands +from pus_tc.system.proc import pack_proc_commands from config.definitions import CustomServiceList from config.object_ids import ( P60_DOCK_HANDLER, @@ -223,6 +224,8 @@ def pack_service_queue_user( return pack_solar_array_deployment_test_into( object_id=SOLAR_ARRAY_DEPLOYMENT_ID, tc_queue=service_queue ) + if service == CustomServiceList.PROCEDURE.value: + return pack_proc_commands(tc_queue=service_queue, op_code=op_code) if service == CustomServiceList.SUS_ASS.value: return pack_sus_cmds(tc_queue=service_queue, op_code=op_code) if service == CustomServiceList.PL_PCDU.value: diff --git a/tmtc_conf.json b/tmtc_conf.json new file mode 100644 index 0000000..e7b49d5 --- /dev/null +++ b/tmtc_conf.json @@ -0,0 +1,6 @@ +{ + "com_if": "dummy", + "tcpip_tcp_ip_addr": "127.0.0.1", + "tcpip_tcp_port": 1536, + "tcpip_tcp_recv_max_size": 1500 +} \ No newline at end of file