diff --git a/config/hook_implementations.py b/config/hook_implementations.py index 7e335cb..e214843 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -320,6 +320,13 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): "34": ("Star Tracker: Read", {OpCodeDictKeys.TIMEOUT: 2.0}), "35": ("Star Tracker: Set Read filename", {OpCodeDictKeys.TIMEOUT: 2.0}), "36": ("Star Tracker: Get checksum", {OpCodeDictKeys.TIMEOUT: 2.0}), + "37": ("Star Tracker: Set time", {OpCodeDictKeys.TIMEOUT: 2.0}), + "38": ("Star Tracker: Download centroid", {OpCodeDictKeys.TIMEOUT: 2.0}), + "39": ("Star Tracker: Upload centroid (not implemented by arcsec?)", {OpCodeDictKeys.TIMEOUT: 2.0}), + "40": ("Star Tracker: Download matched star", {OpCodeDictKeys.TIMEOUT: 2.0}), + "41": ("Star Tracker: Download DB Image", {OpCodeDictKeys.TIMEOUT: 2.0}), + "42": ("Star Tracker: Download Blob Pixel", {OpCodeDictKeys.TIMEOUT: 2.0}), + "43": ("Star Tracker: Download FPGA Image", {OpCodeDictKeys.TIMEOUT: 2.0}), } service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker) diff --git a/pus_tc/star_tracker.py b/pus_tc/star_tracker.py index eafe2bf..bcd1e5e 100644 --- a/pus_tc/star_tracker.py +++ b/pus_tc/star_tracker.py @@ -24,6 +24,8 @@ class StarTrackerActionIds: SWITCH_TO_BOOTLOADER_PROGRAM = 7 DOWNLOAD_IMAGE = 9 UPLOAD_IMAGE = 10 + DOWNLOAD_CENTROID = 16 + UPLOAD_CENTROID = 17 SUBSCRIBE_TO_TM = 18 REQ_SOLUTION = 24 REQ_TEMPERATURE = 25 @@ -43,11 +45,16 @@ class StarTrackerActionIds: READ = 51 WRITE = 52 TAKE_IMAGE = 15 + DOWNLOAD_MATCHED_STAR = 53 STOP_IMAGE_LOADER = 55 RESET_ERROR = 56 CHANGE_DOWNLOAD_IMAGE = 57 SET_JSON_FILE_NAME = 58 SET_READ_FILENAME = 59 + SET_TIME = 60 + DOWNLOAD_DBIMAGE = 61 + DOWNLOAD_BLOBPIXEL = 62 + DOWNLOAD_FPGA_IMAGE = 63 class ImagePathDefs: @@ -57,6 +64,8 @@ class ImagePathDefs: jsonFile = "/mnt/sd0/startracker/test.json" flashFile = "/mnt/sd0/startracker/flash.bin" flashReadPath = "/mnt/sd0/startracker" + uploadCentroidJson = "/mnt/sd0/startracker/upload-centroid.json" + downloadFpgaImagePath = "/mnt/sd0/startracker" class Region: @@ -283,6 +292,55 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code command = pack_checksum_command(object_id) command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "37": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set time")) + unix_time = 1640783543 + command = object_id + struct.pack('!I', StarTrackerActionIds.SET_TIME) + struct.pack('!Q', unix_time) + command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "38": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Centroid")) + id = 0 + command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_CENTROID) + struct.pack('!B', id) + command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "39": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload Centroid")) + command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_CENTROID) + \ + bytearray(ImagePathDefs.uploadCentroidJson, 'utf-8') + command = PusTelecommand(service=8, subservice=128, ssc=63, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "40": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download matched star")) + id = 0 + command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_MATCHED_STAR) + \ + struct.pack('!B', id) + command = PusTelecommand(service=8, subservice=128, ssc=64, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "41": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download DB Image")) + id = 0 + command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_DBIMAGE) + \ + struct.pack('!B', id) + command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "42": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Blob Pixel")) + id = 0 + type = 1 # 0 - normal, 1 - fast + command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_BLOBPIXEL) + \ + struct.pack('!B', id) + struct.pack('!B', type) + command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "43": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download FPGA Image")) + position = 0 + length = 4100 + command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE) + \ + struct.pack('!I', position) + struct.pack('!I', length) + bytearray( + ImagePathDefs.downloadFpgaImagePath, 'utf-8') + command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command) + tc_queue.appendleft(command.pack_command_tuple()) def pack_write_command(object_id: bytearray) -> bytearray: diff --git a/spacepackets b/spacepackets index 0365df0..2eafa25 160000 --- a/spacepackets +++ b/spacepackets @@ -1 +1 @@ -Subproject commit 0365df03ed2ff8f3def8496c76f578ed3a5984cc +Subproject commit 2eafa2560d5d2da5d82328eac37e41ae7f664194 diff --git a/tmtccmd b/tmtccmd index 71213f6..5fdeec2 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 71213f68e2947afda9551539a97c540e14d1e7b6 +Subproject commit 5fdeec29ee878a3daa4bee5e3f36a39be3b70b31