diff --git a/eive_tmtc/tmtc/acs/star_tracker.py b/eive_tmtc/tmtc/acs/star_tracker.py index 9910558..34e9097 100644 --- a/eive_tmtc/tmtc/acs/star_tracker.py +++ b/eive_tmtc/tmtc/acs/star_tracker.py @@ -654,7 +654,7 @@ def pack_star_tracker_commands( # noqa C901 create_action_cmd( STAR_TRACKER_ID, StarTrackerActionId.ADD_SECONDARY_TM_TO_NORMAL_MODE, - set_id.to_bytes(4, byteorder="big"), + struct.pack("!I", set_id), ) ) if op_code == OpCodes.RESET_SECONDARY_TM_SET: @@ -680,7 +680,10 @@ def request_dataset(q: DefaultPusQueueHelper, type: DataSetRequest): setId = int(input("Specify the dataset \n" "")) match type: case DataSetRequest.ONESHOT: - if setId in [SetId.SOLUTION]: + if setId in [ + SetId.SOLUTION, + SetId.TEMPERATURE, + ]: q.add_pus_tc( create_request_one_diag_command(make_sid(STAR_TRACKER_ID, setId)) ) @@ -1074,15 +1077,18 @@ def handle_checksum(pw: PrintWrapper, custom_data: bytes): def handle_read_secondary_tm_set(pw: PrintWrapper, custom_data: bytes): pw.dlog("Received secondary TM Sets") - data_length = len(custom_data) - if data_length < 1: # lul - raise ValueError("Received data shorter than expected") - fmt_str = "!B" * data_length + if len(custom_data) % 4 != 0: + raise ValueError(f"Received data of unexpected length {len(custom_data)}") + data_length = int(len(custom_data) / 4) + fmt_str = "!" + "I" * data_length inc_len = struct.calcsize(fmt_str) set_ids = struct.unpack(fmt_str, custom_data[:inc_len]) pw.dlog("The following Datasets are currently Part of the secondary TM list") for set_id in set_ids: - pw.dlog(SetId(set_id).name) + if set_id in SetId._value2member_map_: + pw.dlog(SetId(set_id).name) + else: + pw.dlog(f"Unknown Set ID {set_id}") @tmtc_definitions_provider @@ -1154,4 +1160,3 @@ def add_str_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCodes.FW_UPDATE, Info.FW_UPDATE) oce.add(OpCodes.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME) defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce) -