this is hardcore

This commit is contained in:
2023-11-22 10:51:26 +01:00
parent b3920524ab
commit ba24faefa9
5 changed files with 31 additions and 19 deletions

View File

@ -1,7 +1,6 @@
from .payload.subsystem import add_payload_subsystem_cmds
from .solar_array_deployment import add_sa_depl_cmds
from .test import add_test_defs
from .time import add_time_cmds
from .health import add_health_cmd_defs
from .system import add_system_cmd_defs
from .tm_store import add_persistent_tm_store_cmd_defs

View File

@ -5,9 +5,10 @@ import math
import socket
import struct
from socket import AF_INET
from typing import Tuple
from typing import Dict, Tuple
from tmtccmd.config.tmtc import (
CmdTreeNode,
OpCodeEntry,
TmtcDefinitionWrapper,
tmtc_definitions_provider,
@ -34,8 +35,6 @@ from tmtccmd.pus.tc.s3_fsfw_hk import (
generate_one_hk_command,
make_sid,
)
from tmtccmd.tmtc import service_provider
from tmtccmd.tmtc.decorator import ServiceProviderParams
from tmtccmd.tmtc.queue import DefaultPusQueueHelper
from eive_tmtc.config.definitions import CustomServiceList
@ -211,6 +210,19 @@ if PERFORM_MGM_CALIBRATION:
CALIBR_SOCKET.connect(CALIBRATION_ADDR)
def create_acs_ctrl_node() -> CmdTreeNode:
# Zip the two classes together into a dictionary
op_code_strs = [
getattr(OpCodes, key)[0] for key in dir(OpCodes) if not key.startswith("__")
]
info_strs = [getattr(Info, key) for key in dir(OpCodes) if not key.startswith("__")]
combined_dict = dict(zip(op_code_strs, info_strs))
acs_ctrl = CmdTreeNode("acs_ctrl", "ACS Controller")
for op_code, info in combined_dict.items():
acs_ctrl.add_child(CmdTreeNode(op_code, info))
return acs_ctrl
@tmtc_definitions_provider
def acs_cmd_defs(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
@ -656,7 +668,7 @@ def set_acs_ctrl_param_vector(q: DefaultPusQueueHelper):
domain_id=sid,
unique_id=pid,
parameters=param,
).pack()
)
)
)
else:
@ -847,7 +859,7 @@ def handle_raw_mgm_data(pw: PrintWrapper, hk_data: bytes):
pw.dlog(f"Raw Data: {hk_data.hex(sep=',')}")
return
def unpack_float_tuple(idx: int) -> (tuple, int):
def unpack_float_tuple(idx: int) -> Tuple[tuple, int]:
f_tuple = struct.unpack(
float_tuple_fmt_str,
hk_data[idx : idx + struct.calcsize(float_tuple_fmt_str)],
@ -1248,6 +1260,9 @@ def perform_mgm_calibration( # noqa C901: Complexity okay
pw: PrintWrapper, mgm_tuple: Tuple
): # noqa C901: Complexity okay
global CALIBR_SOCKET, CALIBRATION_ADDR
if not PERFORM_MGM_CALIBRATION:
return
assert CALIBR_SOCKET is not None
try:
declare_api_cmd = "declare_api_version 2"
CALIBR_SOCKET.sendall(f"{declare_api_cmd}\n".encode())

View File

@ -47,7 +47,7 @@ def pack_time_management_cmd(q: DefaultPusQueueHelper, cmd_str: str):
)
def return_time_node() -> CmdTreeNode:
def create_time_node() -> CmdTreeNode:
time_node = CmdTreeNode("time", "Time Management")
time_node.add_child(CmdTreeNode(CmdStr.SET_CURRENT_TIME, "Set current time"))
time_node.add_child(CmdTreeNode(CmdStr.DUMP_TIME, "Dumpy current time"))