From 1f2f2aac13b0b32c22f0a75e557743ad32f7dc70 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 13 Jul 2023 10:53:42 +0200 Subject: [PATCH] update STR commands --- eive_tmtc/tmtc/acs/star_tracker.py | 41 +++++------------------------- eive_tmtc/tmtc/obj_prompt.py | 24 +++++++++-------- 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/eive_tmtc/tmtc/acs/star_tracker.py b/eive_tmtc/tmtc/acs/star_tracker.py index b45738d..8cd3a80 100644 --- a/eive_tmtc/tmtc/acs/star_tracker.py +++ b/eive_tmtc/tmtc/acs/star_tracker.py @@ -65,7 +65,6 @@ class StarTrackerActionId(enum.IntEnum): CHANGE_DOWNLOAD_IMAGE = 57 SET_JSON_FILE_NAME = 58 SET_FLASH_READ_FILENAME = 59 - SET_TIME = 60 DOWNLOAD_DBIMAGE = 61 DOWNLOAD_BLOBPIXEL = 62 DOWNLOAD_FPGA_IMAGE = 63 @@ -90,6 +89,7 @@ class StarTrackerActionId(enum.IntEnum): LOG_SUBSCRIPTION = 82 DEBUG_CAMERA = 83 FIRMWARE_UPDATE = 84 + SET_TIME_FROM_SYS_TIME = 87 class OpCodes: @@ -104,6 +104,7 @@ class OpCodes: UPLOAD_IMAGE = "upload_image" SET_IMG_PROCESSOR_MODE = "set_img_proc_mode" FW_UPDATE = "fw_update" + SET_TIME_FROM_SYS_TIME = "set_time" class Info: @@ -113,6 +114,7 @@ class Info: TAKE_IMAGE = "Take Image" SET_IMG_PROCESSOR_MODE = "Set Image Processor Mode" FW_UPDATE = "Firmware Update" + SET_TIME_FROM_SYS_TIME = "Set time from system time" class SetId(enum.IntEnum): @@ -438,13 +440,11 @@ def pack_star_tracker_commands( # noqa C901 q.add_log_cmd("Star tracker: Get checksum") data = pack_checksum_command(obyt) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) - if op_code == "38": - q.add_log_cmd("Star tracker: Set time") - unix_time = 1640783543 + if op_code == OpCodes.SET_TIME_FROM_SYS_TIME: + q.add_log_cmd(Info.SET_TIME_FROM_SYS_TIME) data = ( obyt - + struct.pack("!I", StarTrackerActionId.SET_TIME) - + struct.pack("!Q", unix_time) + + struct.pack("!I", StarTrackerActionId.SET_TIME_FROM_SYS_TIME) ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) if op_code == "39": @@ -485,34 +485,6 @@ def pack_star_tracker_commands( # noqa C901 + struct.pack("!B", type) ) q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) - if op_code == "44": - q.add_log_cmd("Star tracker: Download FPGA Image") - position = int(input("Start position: ")) - length = int(input("Size to download: ")) - data = ( - obyt - + struct.pack("!I", StarTrackerActionId.DOWNLOAD_FPGA_IMAGE) - + struct.pack("!I", position) - + struct.pack("!I", length) - + bytearray(FileDefs.downloadFpgaImagePath, "utf-8") - ) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) - if op_code == "45": - q.add_log_cmd("Star tracker: Change donwload FPGA image file name") - data = ( - obyt - + struct.pack("!I", StarTrackerActionId.CHANGE_FPGA_DOWNLOAD_FILE) - + bytearray(FileDefs.downloadFpgaImageName, "utf-8") - ) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) - if op_code == "46": - q.add_log_cmd("Star tracker: Upload FPGA image") - data = ( - obyt - + struct.pack("!I", StarTrackerActionId.UPLOAD_FPGA_IMAGE) - + bytearray(FileDefs.uploadFpgaImageName, "utf-8") - ) - q.add_pus_tc(PusTelecommand(service=8, subservice=128, app_data=data)) if op_code == "47": q.add_log_cmd("Star tracker: FPGA action") id = 3 @@ -887,4 +859,5 @@ def add_str_cmds(defs: TmtcDefinitionWrapper): oce.add(OpCodes.FW_UPDATE, Info.FW_UPDATE) oce.add("70", "Star Tracker: Disable timestamp generation") oce.add("71", "Star Tracker: Enable timestamp generation") + oce.add(OpCodes.SET_TIME_FROM_SYS_TIME, Info.SET_TIME_FROM_SYS_TIME) defs.add_service(CustomServiceList.STAR_TRACKER.value, "Star Tracker", oce) diff --git a/eive_tmtc/tmtc/obj_prompt.py b/eive_tmtc/tmtc/obj_prompt.py index 05aaa2b..1643423 100644 --- a/eive_tmtc/tmtc/obj_prompt.py +++ b/eive_tmtc/tmtc/obj_prompt.py @@ -19,6 +19,8 @@ from eive_tmtc.config.object_ids import ( TMP1075_HANDLER_PLPCDU_0_ID, TMP1075_HANDLER_PLPCDU_1_ID, TMP1075_HANDLER_IF_BRD_ID, +STR_ASSEMBLY, +STAR_TRACKER_ID ) SUBSYSTEM_DICT = { @@ -32,16 +34,18 @@ ACS_OBJ_DICT = { 1: ("SUS Assembly", SUS_BOARD_ASS_ID), 2: ("ACS Board Assembly", ACS_BOARD_ASS_ID), 3: ("RW Assembly", RW_ASSEMBLY), - 4: ("iMTQ MGT", IMTQ_HANDLER_ID), - 5: ("GYR 0 ADIS", GYRO_0_ADIS_HANDLER_ID), - 6: ("GYR 1 L3G", GYRO_1_L3G_HANDLER_ID), - 7: ("MGM 0 LIS3", MGM_0_LIS3_HANDLER_ID), - 8: ("MGM 1 RM3100", MGM_1_RM3100_HANDLER_ID), - 9: ("GPS 0 Health Device", GPS_0_HEALTH_DEV), - 10: ("SUS 0", SUS_0_N_LOC_XFYFZM_PT_XF), - 11: ("SUS 6", SUS_6_R_LOC_XFYBZM_PT_XF), - 12: ("RW 1", RW1_ID), - 13: ("RW 2", RW2_ID), + 4: ("STR Assembly", STR_ASSEMBLY), + 5: ("iMTQ MGT", IMTQ_HANDLER_ID), + 6: ("GYR 0 ADIS", GYRO_0_ADIS_HANDLER_ID), + 7: ("GYR 1 L3G", GYRO_1_L3G_HANDLER_ID), + 8: ("MGM 0 LIS3", MGM_0_LIS3_HANDLER_ID), + 9: ("MGM 1 RM3100", MGM_1_RM3100_HANDLER_ID), + 10: ("GPS 0 Health Device", GPS_0_HEALTH_DEV), + 11: ("SUS 0", SUS_0_N_LOC_XFYFZM_PT_XF), + 12: ("SUS 6", SUS_6_R_LOC_XFYBZM_PT_XF), + 13: ("RW 1", RW1_ID), + 14: ("RW 2", RW2_ID), + 15: ("STR", STAR_TRACKER_ID) } TCS_OBJ_DICT = {