diff --git a/.idea/runConfigurations/tmtcc_Service_17.xml b/.idea/runConfigurations/tmtcc_Service_17.xml
index 1ed784c..01536e7 100644
--- a/.idea/runConfigurations/tmtcc_Service_17.xml
+++ b/.idea/runConfigurations/tmtcc_Service_17.xml
@@ -13,7 +13,7 @@
-
+
diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py
index 339ccf0..5ea1a2d 100644
--- a/pus_tc/cmd_definitions.py
+++ b/pus_tc/cmd_definitions.py
@@ -83,6 +83,11 @@ def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT):
keys=OpCodes.RESET_REBOOT_COUNTER_11,
info="Reset reboot counter 1 1",
)
+ add_op_code_entry(
+ op_code_dict=od,
+ keys=OpCodes.GET_HK,
+ info="Request housekeeping set",
+ )
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.CORE.value,
diff --git a/pus_tc/system/core.py b/pus_tc/system/core.py
index 338337b..f98742c 100644
--- a/pus_tc/system/core.py
+++ b/pus_tc/system/core.py
@@ -4,6 +4,7 @@ from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.service_8_functional_cmd import generate_action_command
from tmtccmd.utility.logger import get_console_logger
+from tmtccmd.tc.service_3_housekeeping import make_sid, generate_one_hk_command
from config.object_ids import CORE_CONTROLLER_ID
LOGGER = get_console_logger()
@@ -21,6 +22,10 @@ class ActionIds(enum.IntEnum):
REBOOT = 32
+class SetIds(enum.IntEnum):
+ HK = 5
+
+
class OpCodes:
REBOOT = ["0", "reboot"]
REBOOT_SELF = ["1", "reboot_self"]
@@ -36,6 +41,7 @@ class OpCodes:
RESET_REBOOT_COUNTER_10 = ["11", "rbh-reset-10"]
RESET_REBOOT_COUNTER_11 = ["12", "rbh-reset-11"]
SET_MAX_REBOOT_CNT = ["13", "rbh-max-cnt"]
+ GET_HK = ["14", "get-hk"]
class Chip(enum.IntEnum):
@@ -124,6 +130,11 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.RESET_REBOOT_COUNTER_11
)
+ elif op_code in OpCodes.GET_HK:
+ tc_queue.appendleft((QueueCommands.PRINT, "Requesting housekeeping set"))
+ sid = make_sid(object_id=CORE_CONTROLLER_ID, set_id=SetIds.HK)
+ command = generate_one_hk_command(sid, 201)
+ tc_queue.appendleft(command.pack_command_tuple())
def determine_reboot_params() -> (bool, Chip, Copy):
diff --git a/pus_tm/hk_handling.py b/pus_tm/hk_handling.py
index 69d8a24..aab0366 100644
--- a/pus_tm/hk_handling.py
+++ b/pus_tm/hk_handling.py
@@ -15,6 +15,7 @@ from config.object_ids import (
GPS_HANDLER_0_ID,
GPS_HANDLER_1_ID,
BPX_HANDLER_ID,
+ CORE_CONTROLLER_ID
)
LOGGER = get_console_logger()
@@ -42,6 +43,8 @@ def handle_user_hk_packet(
return handle_gps_data(hk_data=hk_data)
elif object_id == BPX_HANDLER_ID:
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id)
+ elif object_id == CORE_CONTROLLER_ID:
+ return handle_core_hk_data(hk_data=hk_data, set_id=set_id)
else:
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
return HkReplyUnpacked()
@@ -339,3 +342,16 @@ def handle_bpx_hk_data(hk_data: bytes, set_id: int) -> HkReplyUnpacked:
reply.content_list = [battheat_mode, battheat_low, battheat_high]
reply.validity_buffer = hk_data[3:]
return reply
+
+
+def handle_core_hk_data(hk_data: bytes, set_id: int) -> HkReplyUnpacked:
+ reply = HkReplyUnpacked()
+ reply.header_list = ["Chip Temperature [°C]", "PS Voltage [mV]", "PL Voltage [mV]"]
+ temperature = struct.unpack("!f", hk_data[0:4])
+ ps_voltage = struct.unpack("!f", hk_data[4:8])
+ pl_voltage = struct.unpack("!f", hk_data[8:12])
+ tx_agc_value = struct.unpack("!H", hk_data[2:4])
+ reply.content_list = [temperature, ps_voltage, pl_voltage]
+ reply.validity_buffer = hk_data[12:]
+ reply.num_of_vars = 3
+ return reply