diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 893d805..23644b4 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -115,6 +115,8 @@ class EiveHookObject(TmTcHookBase): "30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}), "32": ("PLOC Supervisor: MRAM Dump", {OpCodeDictKeys.TIMEOUT: 2.0}), + "33": ("PLOC Supervisor: Print CPU stats", {OpCodeDictKeys.TIMEOUT: 2.0}), + "34": ("PLOC Supervisor: Set debug verbosity", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv) @@ -158,7 +160,7 @@ class EiveHookObject(TmTcHookBase): from tmtccmd.config.com_if import create_communication_interface_default return create_communication_interface_default( com_if_key=com_if_key, tmtc_printer=tmtc_printer, - json_cfg_path=self.get_json_config_file_path() + json_cfg_path=self.get_json_config_file_path(), space_packet_id=0x0065 ) def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int): diff --git a/pus_tc/ploc_supervisor.py b/pus_tc/ploc_supervisor.py index 70592d6..65aec36 100644 --- a/pus_tc/ploc_supervisor.py +++ b/pus_tc/ploc_supervisor.py @@ -232,6 +232,16 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: command = pack_mram_dump_cmd(object_id) command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == "33": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Print CPU stats")) + command = pack_print_cpu_stats_cmd(object_id) + command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + elif op_code == "34": + tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set debug verbosity")) + command = pack_set_debug_verbosity_cmd(object_id) + command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) return tc_queue @@ -457,6 +467,7 @@ def pack_mram_wipe_cmd(object_id: bytearray) -> bytearray: command = command + struct.pack('!I', stop) return command + def pack_mram_dump_cmd(object_id: bytearray) -> bytearray: start = int(input("Start address: 0x"), 16) stop = int(input("Stop address: 0x"), 16) @@ -464,4 +475,30 @@ def pack_mram_dump_cmd(object_id: bytearray) -> bytearray: command = object_id + struct.pack('!I', SupvActionIds.DUMP_MRAM) command = command + struct.pack('!I', start) command = command + struct.pack('!I', stop) + return command + + +def pack_print_cpu_stats_cmd(object_id: bytearray) -> bytearray: + en = 1 + command = bytearray() + command = object_id + struct.pack('!I', SupvActionIds.PRINT_CPU_STATS) + command = command + struct.pack('!B', en) + return command + + +def pack_set_debug_verbosity_cmd(object_id: bytearray) -> bytearray: + command = bytearray() + print("Specify debug verbosity") + verbosity_options_dict = { + 0: "None", + 1: "Error", + 2: "Warn", + 3: "Info", + } + print("{:<6} | {}".format('Key', 'Description')) + for entry in verbosity_options_dict.items(): + print("{:<6} | {}".format(entry[0], entry[1])) + verbosity = int(input("Specify verbosity key: ")) + command = object_id + struct.pack('!I', SupvActionIds.SET_DBG_VERBOSITY) + command = command + struct.pack('!B', verbosity) return command \ No newline at end of file