STR Extensions #244

Merged
muellerr merged 22 commits from str-extensions into main 2023-10-27 12:24:10 +02:00
Showing only changes of commit 0c4ab25421 - Show all commits

View File

@ -266,23 +266,6 @@ def pack_star_tracker_commands( # noqa C901
if op_code == OpCodes.DISABLE_HK:
q.add_log_cmd(Info.DISABLE_HK)
request_dataset(q, DataSetRequest.DISABLE)
if op_code == OpCodes.ADD_SECONDARY_TM_TO_NORMAL_MODE:
q.add_log_cmd(Info.ADD_SECONDARY_TM_TO_NORMAL_MODE)
q.add_pus_tc(add_secondary_tm_to_normal_mode_tc())
if op_code == OpCodes.READ_SECONDARY_TM_SET:
q.add_log_cmd(Info.READ_SECONDARY_TM_SET)
q.add_pus_tc(
create_action_cmd(
STAR_TRACKER_ID, StarTrackerActionId.READ_SECONDARY_TM_SET
)
)
if op_code == OpCodes.RESET_SECONDARY_TM_SET:
q.add_log_cmd(Info.RESET_SECONDARY_TM_SET)
q.add_pus_tc(
create_action_cmd(
STAR_TRACKER_ID, StarTrackerActionId.RESET_SECONDARY_TM_SET
)
)
if op_code == "4":
q.add_log_cmd("Star tracker: Mode Raw")
data = pack_mode_data(obyt, Mode.RAW, 0)
@ -663,25 +646,32 @@ def pack_star_tracker_commands( # noqa C901
)
q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data))
if op_code == OpCodes.ADD_SECONDARY_TM_TO_NORMAL_MODE:
q.add_log_cmd(f"{Info.ADD_SECONDARY_TM_TO_NORMAL_MODE}")
q.add_log_cmd(Info.ADD_SECONDARY_TM_TO_NORMAL_MODE)
for val in SetId:
print("{:<2}: {:<20}".format(val, val.name))
setId = int(input("Specify the dataset \n" ""))
set_id = int(input("Specify the dataset \n" ""))
q.add_pus_tc(
create_action_cmd(
STAR_TRACKER_ID,
StarTrackerActionId.ADD_SECONDARY_TM_TO_NORMAL_MODE,
setId.to_bytes(4, byteorder="big"),
set_id.to_bytes(4, byteorder="big"),
)
)
if op_code == OpCodes.RESET_SECONDARY_TM_SET:
q.add_log_cmd(f"{Info.RESET_SECONDARY_TM_SET}")
q.add_log_cmd(Info.RESET_SECONDARY_TM_SET)
q.add_pus_tc(
create_action_cmd(
STAR_TRACKER_ID,
StarTrackerActionId.RESET_SECONDARY_TM_SET,
)
)
if op_code == OpCodes.READ_SECONDARY_TM_SET:
q.add_log_cmd(Info.READ_SECONDARY_TM_SET)
q.add_pus_tc(
create_action_cmd(
STAR_TRACKER_ID, StarTrackerActionId.READ_SECONDARY_TM_SET
)
)
def request_dataset(q: DefaultPusQueueHelper, type: DataSetRequest):
@ -1165,12 +1155,3 @@ def add_str_cmds(defs: TmtcDefinitionWrapper):
oce.add(OpCodes.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME)
defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce)
def add_secondary_tm_to_normal_mode_tc() -> PusTelecommand:
# TODO: Add device command ID prompt and add it to user data.
device_id = 0
return create_action_cmd(
STAR_TRACKER_ID,
StarTrackerActionId.ADD_SECONDARY_TM_TO_NORMAL_MODE,
user_data=struct.pack("!I", device_id),
)