that was annoying
This commit is contained in:
32
eive_tmtc/tmtc/common.py
Normal file
32
eive_tmtc/tmtc/common.py
Normal file
@ -0,0 +1,32 @@
|
||||
from typing import Union
|
||||
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
from tmtccmd.tc import DefaultPusQueueHelper
|
||||
from tmtccmd.tc.pus_200_fsfw_modes import pack_mode_data, Modes, Subservices
|
||||
from tmtccmd.util import ObjectIdU32
|
||||
|
||||
|
||||
def pack_mode_cmd_with_info(
|
||||
object_id: Union[ObjectIdU32, bytes],
|
||||
mode: Union[int, Modes],
|
||||
submode: int,
|
||||
q: DefaultPusQueueHelper,
|
||||
info: str,
|
||||
):
|
||||
if isinstance(object_id, ObjectIdU32):
|
||||
object_id_bytes = object_id.as_bytes
|
||||
elif isinstance(object_id, bytes):
|
||||
object_id_bytes = object_id
|
||||
else:
|
||||
raise ValueError("Invalid Object ID type")
|
||||
q.add_log_cmd(info)
|
||||
mode_data = pack_mode_data(
|
||||
object_id=object_id_bytes,
|
||||
mode=mode,
|
||||
submode=submode,
|
||||
)
|
||||
q.add_pus_tc(
|
||||
PusTelecommand(
|
||||
service=200, subservice=Subservices.TC_MODE_COMMAND, app_data=mode_data
|
||||
)
|
||||
)
|
Reference in New Issue
Block a user