cleaned up structure a bit
This commit is contained in:
48
pus_tc/devs/str_img_helper.py
Normal file
48
pus_tc/devs/str_img_helper.py
Normal file
@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@file str_img_helper.py
|
||||
@brief Commanding of the star tracker image helper object which is responsible for uploading
|
||||
and downloading images to/from the star tracker.
|
||||
@details Images to uplaod must be previously transferred to the OBC with the CFDP protocol.
|
||||
Also downloaded images will be stored on the filesystem of the OBC and can be transferred via CFDP.
|
||||
@author J. Meier
|
||||
@date 29.11.2021
|
||||
"""
|
||||
import struct
|
||||
|
||||
from tmtccmd.config.definitions import QueueCommands
|
||||
|
||||
from tmtccmd.tc.packer import TcQueueT
|
||||
from spacepackets.ecss.tc import PusTelecommand
|
||||
|
||||
|
||||
class Commands:
|
||||
UPLOAD_IMAGE = 0
|
||||
DOWNLOAD_IMAGE = 1
|
||||
|
||||
|
||||
class ImagePathDefs:
|
||||
uploadFile = "/mnt/sd0/startracker/gemma.bin"
|
||||
|
||||
|
||||
def pack_str_img_helper_command(
|
||||
object_id: bytearray, tc_queue: TcQueueT, op_code: str
|
||||
) -> TcQueueT:
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"Testing star tracker image helper object id: 0x" + object_id.hex(),
|
||||
)
|
||||
)
|
||||
|
||||
if op_code == "0":
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "Star tracker image helper: Upload image")
|
||||
)
|
||||
command = (
|
||||
object_id
|
||||
+ struct.pack("!I", Commands.UPLOAD_IMAGE)
|
||||
+ bytearray(ImagePathDefs.uploadFile, "utf-8")
|
||||
)
|
||||
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
Reference in New Issue
Block a user