core hk request #41
@ -13,7 +13,7 @@
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
|
||||
<option name="PARAMETERS" value="-s 17 -o 0 -t 3 -l" />
|
||||
<option name="PARAMETERS" value="-s 17 -l" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="true" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
|
@ -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,
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user