write command

This commit is contained in:
Jakob Meier 2021-12-19 14:49:22 +01:00
parent 02b6304eba
commit c4e33d32ab
3 changed files with 29 additions and 2 deletions

View File

@ -315,6 +315,8 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"29": ("Star Tracker: Set name of download image", {OpCodeDictKeys.TIMEOUT: 2.0}),
"30": ("Star Tracker: Request histogram", {OpCodeDictKeys.TIMEOUT: 2.0}),
"31": ("Star Tracker: Request contrast", {OpCodeDictKeys.TIMEOUT: 2.0}),
"32": ("Star Tracker: Set json filename", {OpCodeDictKeys.TIMEOUT: 2.0}),
"33": ("Star Tracker: Write", {OpCodeDictKeys.TIMEOUT: 2.0}),
}
service_star_tracker_tuple = ("Star tracker", op_code_dict_srv_star_tracker)

View File

@ -39,17 +39,21 @@ class StarTrackerActionIds:
TRACKING = 47
VALIDATION = 48
ALGO = 49
CHECKSUM = 50
RAED = 51
WRITE = 52
TAKE_IMAGE = 15
STOP_IMAGE_LOADER = 55
RESET_ERROR = 56
CHANGE_DOWNLOAD_IMAGE = 57
SET_JSON_FILE_NAME = 58
class ImagePathDefs:
uploadFile = "/mnt/sd0/startracker/gemma.bin"
downloadFile = "test_image.bin"
downloadPath = "/mnt/sd0/startracker"
jsonFile = "/mnt/sd0/startracker/full.json"
jsonFile = "/mnt/sd0/startracker/test.json"
def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT:
@ -234,3 +238,24 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_CONTRAST)
command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "32":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set json filename"))
command = object_id + struct.pack('!I', StarTrackerActionIds.SET_JSON_FILE_NAME) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = PusTelecommand(service=8, subservice=128, ssc=57, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "33":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Write"))
command = pack_write_command(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=58, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
def pack_write_command(object_id: bytearray) -> bytearray:
region = 1
address = 0
length = 1024
data = bytearray([1] * 1024)
command = object_id + struct.pack('!I', StarTrackerActionIds.WRITE) + struct.pack('!B', region) + \
struct.pack('I', address) + struct.pack('!H', length) + data
return command

@ -1 +1 @@
Subproject commit 3265d5b780fb5a551962eb9126df3d7d5e70fbeb
Subproject commit 464274a91ce31a28e3493a05089fcdbe0bdf285b