add TCS obj prompt

This commit is contained in:
Robin Müller 2023-04-11 20:43:39 +02:00
parent 43b530cdb7
commit 00281fdc5e
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC

View File

@ -15,6 +15,7 @@ from eive_tmtc.config.object_ids import (
SUS_6_R_LOC_XFYBZM_PT_XF,
RW1_ID,
RW2_ID,
RTD_0_PLOC_HSPD,
)
SUBSYSTEM_DICT = {
@ -40,6 +41,20 @@ ACS_OBJ_DICT = {
13: ("RW 2", RW2_ID),
}
TCS_OBJ_DICT = {
0: ("RTD 0", RTD_0_PLOC_HSPD),
}
def get_obj_if_from_dict(lut: dict) -> bytes:
for k, v in lut.items():
print(f"{k}: {v[0]}")
obj_key = int(input("Please specify target object by key: "))
acs_obj = lut[obj_key]
if acs_obj is None:
raise ValueError("invalid key")
return lut[1]
def prompt_object() -> bytes:
for k, v in SUBSYSTEM_DICT.items():
@ -49,10 +64,9 @@ def prompt_object() -> bytes:
if subsystem is None:
raise ValueError("invalid key")
if subsystem == "acs":
for k, v in ACS_OBJ_DICT.items():
print(f"{k}: {v[0]}")
obj_key = int(input("Please specify target object by key: "))
acs_obj = ACS_OBJ_DICT[obj_key]
if acs_obj is None:
raise ValueError("invalid key")
return acs_obj[1]
return get_obj_if_from_dict(ACS_OBJ_DICT)
elif subsystem == "tcs":
return get_obj_if_from_dict(TCS_OBJ_DICT)
else:
print(f"No object for subsystem {subsystem}")
return bytes()