From 6270d90f98b4ec694b6d543ce9a9ddd49ba743f9 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Mon, 17 Jan 2022 08:40:16 +0100 Subject: [PATCH] unlock command --- config/hook_implementations.py | 3 ++- pus_tc/star_tracker.py | 14 ++++++++++---- spacepackets | 2 +- tmtccmd | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/config/hook_implementations.py b/config/hook_implementations.py index b49aa93..132c7a8 100644 --- a/config/hook_implementations.py +++ b/config/hook_implementations.py @@ -322,7 +322,7 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): "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}), + "39": ("Star Tracker: Upload centroid (not implemented?)", {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}), @@ -330,6 +330,7 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT): "44": ("Star Tracker: Change download FPGA image name", {OpCodeDictKeys.TIMEOUT: 2.0}), "45": ("Star Tracker: Upload FPGA image", {OpCodeDictKeys.TIMEOUT: 2.0}), "46": ("Star Tracker: FPGA action", {OpCodeDictKeys.TIMEOUT: 2.0}), + "47": ("Star Tracker: Unlock", {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 82462b0..a1c54b0 100644 --- a/pus_tc/star_tracker.py +++ b/pus_tc/star_tracker.py @@ -20,6 +20,7 @@ class StarTrackerActionIds: REQ_VERSION = 2 REQ_INTERFACE = 3 REQ_TIME = 4 + UNLOCK = 6 SWITCH_TO_BOOTLOADER_PROGRAM = 7 REQ_POWER = 11 TAKE_IMAGE = 15 @@ -64,7 +65,7 @@ class ImagePathDefs: uploadFile = "/mnt/sd0/startracker/gemma.bin" downloadFile = "test_image.bin" downloadPath = "/mnt/sd0/startracker" - jsonFile = "/mnt/sd0/startracker/test.json" + jsonFile = "/mnt/sd0/startracker/full.json" flashFile = "/mnt/sd0/startracker/flash.bin" flashReadPath = "/mnt/sd0/startracker" uploadCentroidJson = "/mnt/sd0/startracker/upload-centroid.json" @@ -339,15 +340,15 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code 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 + position = int(input("Start position: ")) + length = int(input("Size to download: ")) 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()) if op_code == "44": - tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Chnage donwload FPGA image file name")) + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Change donwload FPGA image file name")) command = object_id + struct.pack('!I', StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE) + \ bytearray(ImagePathDefs.downloadFpgaImageName, 'utf-8') command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command) @@ -364,6 +365,11 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code command = object_id + struct.pack('!I', StarTrackerActionIds.FPGA_ACTION) + struct.pack('!B', id) command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) + if op_code == "47": + tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Unlock")) + command = object_id + struct.pack('!I', StarTrackerActionIds.UNLOCK) + command = PusTelecommand(service=8, subservice=128, ssc=70, 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 2eafa25..0039a0e 160000 --- a/spacepackets +++ b/spacepackets @@ -1 +1 @@ -Subproject commit 2eafa2560d5d2da5d82328eac37e41ae7f664194 +Subproject commit 0039a0ec67217765b9dabfbc35dcb34b6ff81c08 diff --git a/tmtccmd b/tmtccmd index 5fdeec2..bfa459c 160000 --- a/tmtccmd +++ b/tmtccmd @@ -1 +1 @@ -Subproject commit 5fdeec29ee878a3daa4bee5e3f36a39be3b70b31 +Subproject commit bfa459ccc3c7189a77374a68f0217d448525b34b