changed to new procedure

This commit is contained in:
Markus Kranz 2022-05-24 14:58:13 +02:00
parent 9edc21c674
commit 4b762328c5

View File

@ -77,10 +77,22 @@ def generic_print(tc_queue: TcQueueT, info: dict):
def pack_generic_hk_listening_cmds(
tc_queue: TcQueueT, proc_key: str, sid: bytes, diag: bool
tc_queue: TcQueueT, proc_key: str, sid_list: bytes, diag: bool
):
info = PROC_INFO_DICT[proc_key]
generic_print(tc_queue=tc_queue, info=info)
for sid in sid_list:
enable_listen_to_hk_for_x_seconds(
diag=diag,
tc_queue=tc_queue,
device=proc_key,
sid=sid,
interval_seconds=info[3],
)
""" OLD
listen_to_hk_for_x_seconds(
diag=diag,
tc_queue=tc_queue,
@ -89,9 +101,10 @@ def pack_generic_hk_listening_cmds(
interval_seconds=info[3],
collection_time=info[2],
)
"""
def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
sid_list = []
if op_code in OpCodes.BAT_FT:
key = KAI.BAT_FT[0]
sid = make_sid(oids.BPX_HANDLER_ID, BpxSetIds.GET_HK_SET)
@ -101,9 +114,9 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.CORE_FT:
key = KAI.CORE_FT[0]
sid = make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK)
sid_list += make_sid(oids.CORE_CONTROLLER_ID, CoreSetIds.HK)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
tc_queue=tc_queue, proc_key=key, sid_list=sid_list, diag=False
)
if op_code in OpCodes.PCDU_FT:
@ -121,7 +134,7 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU)
sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_CORE)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
@ -137,6 +150,10 @@ def pack_proc_commands(tc_queue: TcQueueT, op_code: str):
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
sid = make_sid(oids.ACU_HANDLER_ID, GsSetIds.ACU_AUX)
pack_generic_hk_listening_cmds(
tc_queue=tc_queue, proc_key=key, sid=sid, diag=False
)
if op_code in OpCodes.RAD_SEN_FT:
key = KAI.RAD_SEN_FT[0]
@ -337,3 +354,33 @@ def listen_to_hk_for_x_seconds(
tc_queue.appendleft(
disable_periodic_hk_command(diag=diag, sid=sid, ssc=0).pack_command_tuple()
)
def enable_listen_to_hk_for_x_seconds(
tc_queue: TcQueueT,
diag: bool,
device: str,
sid: bytes,
interval_seconds: float,
):
tc_queue.appendleft((QueueCommands.PRINT, f"Enabling periodic HK for {device}"))
cmd_tuple = enable_periodic_hk_command_with_interval(
diag=diag, sid=sid, interval_seconds=interval_seconds, ssc=0
)
for cmd in cmd_tuple:
tc_queue.appendleft(cmd.pack_command_tuple())
tc_queue.appendleft((QueueCommands.WAIT, 2.0))
def disable_listen_to_hk_for_x_seconds(
tc_queue: TcQueueT,
diag: bool,
device: str,
sid: bytes,
):
tc_queue.appendleft((QueueCommands.PRINT, f"Disabling periodic HK for {device}"))
tc_queue.appendleft(
disable_periodic_hk_command(diag=diag, sid=sid, ssc=0).pack_command_tuple()
)