v1.9.0 #53

Merged
muellerr merged 354 commits from develop into master 2022-04-07 17:39:42 +02:00
36 changed files with 1762 additions and 782 deletions
Showing only changes of commit c3a0f31d19 - Show all commits

View File

@ -12,4 +12,3 @@ def command_preparation_hook() -> PusTelecommand:
class instance class instance
""" """
return PusTelecommand(service=17, subservice=1, ssc=20) return PusTelecommand(service=17, subservice=1, ssc=20)

View File

@ -11,7 +11,7 @@ PUS_APID = 0x65
class CustomServiceList(enum.Enum): class CustomServiceList(enum.Enum):
TEST_DEVICE = "test", TEST_DEVICE = "test"
P60DOCK = "p60dock" P60DOCK = "p60dock"
PDU1 = "pdu1" PDU1 = "pdu1"
PDU2 = "pdu2" PDU2 = "pdu2"
@ -22,7 +22,7 @@ class CustomServiceList(enum.Enum):
HEATER = "heater" HEATER = "heater"
IMTQ = "imtq" IMTQ = "imtq"
PLOC = "ploc" PLOC = "ploc"
PCDU = "pcdu", PCDU = "pcdu"
SA_DEPLYOMENT = "sa_depl" SA_DEPLYOMENT = "sa_depl"
REACTION_WHEEL_1 = "reaction_wheel_1" REACTION_WHEEL_1 = "reaction_wheel_1"
REACTION_WHEEL_2 = "reaction_wheel_2" REACTION_WHEEL_2 = "reaction_wheel_2"
@ -34,9 +34,9 @@ class CustomServiceList(enum.Enum):
GPS_0 = "gps0" GPS_0 = "gps0"
GPS_1 = "gps1" GPS_1 = "gps1"
PLOC_MEMORY_DUMPER = "ploc_memory_dumper" PLOC_MEMORY_DUMPER = "ploc_memory_dumper"
CORE = 'core' CORE = "core"
STAR_TRACKER = 'star_tracker' STAR_TRACKER = "star_tracker"
CCSDS_HANDLER = 'ccsds_handler' CCSDS_HANDLER = "ccsds_handler"
PDEC_HANDLER = 'pdec_handler' PDEC_HANDLER = "pdec_handler"
STR_IMG_HELPER = 'str_img_helper' STR_IMG_HELPER = "str_img_helper"
SYRLINKS = 'syrlinks' SYRLINKS = "syrlinks"

View File

@ -12,8 +12,10 @@ import argparse
from config.definitions import CustomServiceList, PUS_APID from config.definitions import CustomServiceList, PUS_APID
from config.custom_mode_op import CustomModeList from config.custom_mode_op import CustomModeList
from tmtccmd.config.definitions import CoreComInterfaces from tmtccmd.config.definitions import CoreComInterfaces
from tmtccmd.config.globals import set_default_globals_pre_args_parsing, \ from tmtccmd.config.globals import (
set_default_globals_post_args_parsing set_default_globals_pre_args_parsing,
set_default_globals_post_args_parsing,
)
from tmtccmd.utility.logger import get_console_logger from tmtccmd.utility.logger import get_console_logger
LOGGER = get_console_logger() LOGGER = get_console_logger()
@ -21,16 +23,23 @@ LOGGER = get_console_logger()
class CustomGlobalIds(enum.Enum): class CustomGlobalIds(enum.Enum):
from enum import auto from enum import auto
pass pass
def set_globals_pre_args_parsing(gui: bool = False): def set_globals_pre_args_parsing(gui: bool = False):
set_default_globals_pre_args_parsing( set_default_globals_pre_args_parsing(
gui=gui, tc_apid=PUS_APID, tm_apid=PUS_APID, com_if_id=CoreComInterfaces.TCPIP_UDP.value) gui=gui,
tc_apid=PUS_APID,
tm_apid=PUS_APID,
com_if_id=CoreComInterfaces.TCPIP_UDP.value,
)
def add_globals_post_args_parsing(args: argparse.Namespace, json_cfg_path: str): def add_globals_post_args_parsing(args: argparse.Namespace, json_cfg_path: str):
set_default_globals_post_args_parsing( set_default_globals_post_args_parsing(
args=args, custom_services_list=[CustomServiceList], args=args,
custom_modes_list=[CustomModeList], json_cfg_path=json_cfg_path custom_services_list=[CustomServiceList],
custom_modes_list=[CustomModeList],
json_cfg_path=json_cfg_path,
) )

View File

@ -8,16 +8,20 @@ from tmtccmd.com_if.com_interface_base import CommunicationInterface
from tmtccmd.core.backend import TmTcHandler from tmtccmd.core.backend import TmTcHandler
from tmtccmd.config.hook import TmTcHookBase from tmtccmd.config.hook import TmTcHookBase
from tmtccmd.utility.tmtc_printer import TmTcPrinter from tmtccmd.utility.tmtc_printer import TmTcPrinter
from tmtccmd.config.globals import OpCodeDictKeys from tmtccmd.config.globals import (
OpCodeDictKeys,
add_op_code_entry,
add_service_op_code_entry,
)
from config.object_ids import RW1_ID from config.object_ids import RW1_ID
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
class EiveHookObject(TmTcHookBase): class EiveHookObject(TmTcHookBase):
def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT: def get_service_op_code_dictionary(self) -> ServiceOpCodeDictT:
from tmtccmd.config.globals import get_default_service_op_code_dict from tmtccmd.config.globals import get_default_service_op_code_dict
service_op_code_dict = get_default_service_op_code_dict() service_op_code_dict = get_default_service_op_code_dict()
get_eive_service_op_code_dict(service_op_code_dict=service_op_code_dict) get_eive_service_op_code_dict(service_op_code_dict=service_op_code_dict)
@ -33,37 +37,51 @@ class EiveHookObject(TmTcHookBase):
def add_globals_pre_args_parsing(self, gui: bool = False): def add_globals_pre_args_parsing(self, gui: bool = False):
from config.globals_config import set_globals_pre_args_parsing from config.globals_config import set_globals_pre_args_parsing
set_globals_pre_args_parsing(gui=gui) set_globals_pre_args_parsing(gui=gui)
def add_globals_post_args_parsing(self, args: argparse.Namespace): def add_globals_post_args_parsing(self, args: argparse.Namespace):
from config.globals_config import add_globals_post_args_parsing from config.globals_config import add_globals_post_args_parsing
add_globals_post_args_parsing(args=args, json_cfg_path=self.get_json_config_file_path())
def assign_communication_interface(self, com_if_key: str, tmtc_printer: TmTcPrinter) -> \ add_globals_post_args_parsing(
Union[CommunicationInterface, None]: args=args, json_cfg_path=self.get_json_config_file_path()
)
def assign_communication_interface(
self, com_if_key: str, tmtc_printer: TmTcPrinter
) -> Union[CommunicationInterface, None]:
from tmtccmd.config.com_if import create_communication_interface_default from tmtccmd.config.com_if import create_communication_interface_default
return create_communication_interface_default( return create_communication_interface_default(
com_if_key=com_if_key, tmtc_printer=tmtc_printer, com_if_key=com_if_key,
json_cfg_path=self.get_json_config_file_path(), space_packet_ids=(0x0865,) tmtc_printer=tmtc_printer,
json_cfg_path=self.get_json_config_file_path(),
space_packet_ids=(0x0865,),
) )
def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int): def perform_mode_operation(self, tmtc_backend: TmTcHandler, mode: int):
from config.custom_mode_op import custom_mode_operation from config.custom_mode_op import custom_mode_operation
custom_mode_operation(mode=mode, tmtc_backend=tmtc_backend) custom_mode_operation(mode=mode, tmtc_backend=tmtc_backend)
def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT): def pack_service_queue(self, service: int, op_code: str, service_queue: TcQueueT):
from pus_tc.tc_packer_hook import pack_service_queue_user from pus_tc.tc_packer_hook import pack_service_queue_user
pack_service_queue_user(service=service, op_code=op_code, service_queue=service_queue)
pack_service_queue_user(
service=service, op_code=op_code, service_queue=service_queue
)
def get_object_ids(self) -> Dict[bytes, list]: def get_object_ids(self) -> Dict[bytes, list]:
from config.object_ids import get_object_ids from config.object_ids import get_object_ids
return get_object_ids() return get_object_ids()
@staticmethod @staticmethod
def handle_service_8_telemetry( def handle_service_8_telemetry(
object_id: bytes, action_id: int, custom_data: bytearray object_id: bytes, action_id: int, custom_data: bytearray
) -> Tuple[list, list]: ) -> Tuple[list, list]:
from pus_tm.service_8_hook import user_analyze_service_8_data from pus_tm.service_8_hook import user_analyze_service_8_data
return user_analyze_service_8_data( return user_analyze_service_8_data(
object_id=object_id, action_id=action_id, custom_data=custom_data object_id=object_id, action_id=action_id, custom_data=custom_data
) )
@ -73,13 +91,17 @@ class EiveHookObject(TmTcHookBase):
object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base
) -> Tuple[list, list, bytearray, int]: ) -> Tuple[list, list, bytearray, int]:
from pus_tm.hk_handling import handle_user_hk_packet from pus_tm.hk_handling import handle_user_hk_packet
return handle_user_hk_packet( return handle_user_hk_packet(
object_id=object_id, set_id=set_id, hk_data=hk_data, service3_packet=service3_packet object_id=object_id,
set_id=set_id,
hk_data=hk_data,
service3_packet=service3_packet,
) )
@staticmethod @staticmethod
def handle_service_5_event( def handle_service_5_event(
object_id: bytes, event_id: int, param_1: int, param_2: int object_id: bytes, event_id: int, param_1: int, param_2: int
) -> str: ) -> str:
if object_id == RW1_ID: if object_id == RW1_ID:
if event_id == 1: if event_id == 1:
@ -93,21 +115,22 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
from pus_tc.p60dock import P60OpCodes from pus_tc.p60dock import P60OpCodes
from gomspace.gomspace_common import GomspaceOpCodes from gomspace.gomspace_common import GomspaceOpCodes
from pus_tc.gps import GpsOpCodes from pus_tc.gps import GpsOpCodes
op_code_dict = { op_code_dict = {
'reboot': ('Reboot with Prompt', {OpCodeDictKeys.TIMEOUT: 2.0}), "reboot": ("Reboot with Prompt", {OpCodeDictKeys.TIMEOUT: 2.0}),
'reboot_self': ('Reboot Self', {OpCodeDictKeys.TIMEOUT: 4.0}), "reboot_self": ("Reboot Self", {OpCodeDictKeys.TIMEOUT: 4.0}),
'reboot_0_0': ('Reboot 0 0', {OpCodeDictKeys.TIMEOUT: 4.0}), "reboot_0_0": ("Reboot 0 0", {OpCodeDictKeys.TIMEOUT: 4.0}),
'reboot_0_1': ('Reboot 0 1', {OpCodeDictKeys.TIMEOUT: 4.0}), "reboot_0_1": ("Reboot 0 1", {OpCodeDictKeys.TIMEOUT: 4.0}),
'reboot_1_0': ('Reboot 1 0', {OpCodeDictKeys.TIMEOUT: 4.0}), "reboot_1_0": ("Reboot 1 0", {OpCodeDictKeys.TIMEOUT: 4.0}),
'reboot_1_1': ('Reboot 1 1', {OpCodeDictKeys.TIMEOUT: 4.0}), "reboot_1_1": ("Reboot 1 1", {OpCodeDictKeys.TIMEOUT: 4.0}),
} }
service_tuple = ('Core Controller', op_code_dict) service_tuple = ("Core Controller", op_code_dict)
service_op_code_dict[CustomServiceList.CORE.value] = service_tuple service_op_code_dict[CustomServiceList.CORE.value] = service_tuple
op_code_dict = { op_code_dict = {
GpsOpCodes.RESET_GNSS.value: ('Reset GPS', {OpCodeDictKeys.TIMEOUT: 2.0}) GpsOpCodes.RESET_GNSS.value: ("Reset GPS", {OpCodeDictKeys.TIMEOUT: 2.0})
} }
service_tuple = ('GPS 0', op_code_dict) service_tuple = ("GPS 0", op_code_dict)
service_op_code_dict[CustomServiceList.GPS_0.value] = service_tuple service_op_code_dict[CustomServiceList.GPS_0.value] = service_tuple
service_op_code_dict[CustomServiceList.GPS_1.value] = service_tuple service_op_code_dict[CustomServiceList.GPS_1.value] = service_tuple
@ -128,60 +151,127 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
op_code_dict_srv_p60 = { op_code_dict_srv_p60 = {
"0": ("P60 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("P60 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
P60OpCodes.STACK_3V3_ON.value: P60OpCodes.STACK_3V3_ON.value: (
("P60 Dock: Turn stack 3V3 on", {OpCodeDictKeys.TIMEOUT: 2.0}), "P60 Dock: Turn stack 3V3 on",
P60OpCodes.STACK_3V3_OFF.value: {OpCodeDictKeys.TIMEOUT: 2.0},
("P60 Dock: Turn stack 3V3 off", {OpCodeDictKeys.TIMEOUT: 2.0}), ),
GomspaceOpCodes.PRINT_SWITCH_V_I.value: P60OpCodes.STACK_3V3_OFF.value: (
("P60 Dock: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0}), "P60 Dock: Turn stack 3V3 off",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
GomspaceOpCodes.PRINT_SWITCH_V_I.value: (
"P60 Dock: Print Switches, Voltages, Currents",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
} }
service_p60_tuple = ("P60 Device", op_code_dict_srv_p60) service_p60_tuple = ("P60 Device", op_code_dict_srv_p60)
op_code_dict_srv_pdu1 = { op_code_dict_srv_pdu1 = {
"0": ("PDU1 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("PDU1 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
Pdu1OpCodes.TCS_BOARD_ON.value: Pdu1OpCodes.TCS_BOARD_ON.value: (
("PDU1: Turn TCS board on", {OpCodeDictKeys.TIMEOUT: 2.0}), "PDU1: Turn TCS board on",
Pdu1OpCodes.TCS_BOARD_OFF.value: {OpCodeDictKeys.TIMEOUT: 2.0},
("PDU1: Turn TCS board off", {OpCodeDictKeys.TIMEOUT: 2.0}), ),
Pdu1OpCodes.STAR_TRACKER_ON.value: Pdu1OpCodes.TCS_BOARD_OFF.value: (
("PDU1: Turn star tracker on", {OpCodeDictKeys.TIMEOUT: 2.0}), "PDU1: Turn TCS board off",
Pdu1OpCodes.STAR_TRACKER_OFF.value: {OpCodeDictKeys.TIMEOUT: 2.0},
("PDU1: Turn star tracker off", {OpCodeDictKeys.TIMEOUT: 2.0}), ),
Pdu1OpCodes.SUS_NOMINAL_ON.value: Pdu1OpCodes.STAR_TRACKER_ON.value: (
("PDU1: Turn SUS nominal on", {OpCodeDictKeys.TIMEOUT: 2.0}), "PDU1: Turn star tracker on",
Pdu1OpCodes.SUS_NOMINAL_OFF.value: {OpCodeDictKeys.TIMEOUT: 2.0},
("PDU1: Turn SUS nominal off", {OpCodeDictKeys.TIMEOUT: 2.0}), ),
Pdu1OpCodes.ACS_A_SIDE_ON.value: Pdu1OpCodes.STAR_TRACKER_OFF.value: (
("PDU1: Turn ACS Side A on", {OpCodeDictKeys.TIMEOUT: 2.0}), "PDU1: Turn star tracker off",
Pdu1OpCodes.ACS_A_SIDE_OFF.value: {OpCodeDictKeys.TIMEOUT: 2.0},
("PDU1: Turn ACS Side A off", {OpCodeDictKeys.TIMEOUT: 2.0}), ),
Pdu1OpCodes.SYRLINKS_ON.value: Pdu1OpCodes.SUS_NOMINAL_ON.value: (
("PDU1: Turn Syrlinks on", {OpCodeDictKeys.TIMEOUT: 2.0}), "PDU1: Turn SUS nominal on",
Pdu1OpCodes.SYRLINKS_OFF.value: {OpCodeDictKeys.TIMEOUT: 2.0},
("PDU1: Turn Syrlinks off", {OpCodeDictKeys.TIMEOUT: 2.0}), ),
GomspaceOpCodes.PRINT_SWITCH_V_I.value: Pdu1OpCodes.SUS_NOMINAL_OFF.value: (
("PDU1: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0}), "PDU1: Turn SUS nominal off",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
Pdu1OpCodes.ACS_A_SIDE_ON.value: (
"PDU1: Turn ACS Side A on",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
Pdu1OpCodes.ACS_A_SIDE_OFF.value: (
"PDU1: Turn ACS Side A off",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
Pdu1OpCodes.SYRLINKS_ON.value: (
"PDU1: Turn Syrlinks on",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
Pdu1OpCodes.SYRLINKS_OFF.value: (
"PDU1: Turn Syrlinks off",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
GomspaceOpCodes.PRINT_SWITCH_V_I.value: (
"PDU1: Print Switches, Voltages, Currents",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
} }
service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1) service_pdu1_tuple = ("PDU1 Device", op_code_dict_srv_pdu1)
op_code_dict_srv_pdu2 = { op_code_dict = dict()
"0": ("PDU2 Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), add_op_code_entry(
Pdu2OpCodes.ACS_SIDE_B_ON.value: op_code_dict=op_code_dict,
("PDU2: Turn ACS Side B on", {OpCodeDictKeys.TIMEOUT: 2.0}), keys="0",
Pdu2OpCodes.ACS_SIDE_B_OFF.value: info="PDU2 Tests",
("PDU2: Turn ACS Side B off", {OpCodeDictKeys.TIMEOUT: 2.0}), options={OpCodeDictKeys.TIMEOUT: 2.0},
Pdu2OpCodes.SUS_REDUNDANT_ON.value: )
("PDU2: Turn SUS redundant on", {OpCodeDictKeys.TIMEOUT: 2.0}), add_op_code_entry(
Pdu2OpCodes.SUS_REDUNDANT_OFF.value: op_code_dict=op_code_dict,
("PDU2: Turn SUS redundant off", {OpCodeDictKeys.TIMEOUT: 2.0}), keys=Pdu2OpCodes.ACS_SIDE_B_ON.value,
Pdu2OpCodes.RW_ON.value: info="PDU2: Turn ACS Side B on",
("PDU2: Turn reaction wheels on", {OpCodeDictKeys.TIMEOUT: 2.0}), options={OpCodeDictKeys.TIMEOUT: 2.0},
Pdu2OpCodes.RW_OFF.value: )
("PDU2: Turn reaction wheels off", {OpCodeDictKeys.TIMEOUT: 2.0}), add_op_code_entry(
GomspaceOpCodes.PRINT_SWITCH_V_I.value: op_code_dict=op_code_dict,
("PDU1: Print Switches, Voltages, Currents", {OpCodeDictKeys.TIMEOUT: 2.0}) keys=Pdu2OpCodes.ACS_SIDE_B_OFF.value,
} info="PDU2: Turn ACS Side B off",
service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2) options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_ON.value,
info="PDU2: Turn SUS redundant on",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_OFF.value,
info="PDU2: Turn SUS redundant off",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_ON.value,
info="PDU2: Turn reaction wheels on",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_OFF.value,
info="PDU2: Turn reaction wheels off",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=GomspaceOpCodes.PRINT_SWITCH_V_I.value,
info="PDU2: Print Switches, Voltages, Currents",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_service_op_code_entry(
srv_op_code_dict=service_op_code_dict,
name="pdu2",
info="PDU2 Device",
op_code_entry=op_code_dict,
)
# service_pdu2_tuple = ("PDU2 Device", op_code_dict_srv_pdu2)
op_code_dict_srv_heater = { op_code_dict_srv_heater = {
"0": ("Heater Tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("Heater Tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -207,7 +297,10 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"2": ("Reaction Wheel: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), "2": ("Reaction Wheel: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("Reaction Wheel: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}), "3": ("Reaction Wheel: Set mode normal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("Reaction Wheel: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}), "4": ("Reaction Wheel: Set mode off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("Reaction Wheel: Send get-telemetry-command", {OpCodeDictKeys.TIMEOUT: 2.0}), "5": (
"Reaction Wheel: Send get-telemetry-command",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
} }
service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw) service_rw_tuple = ("Reaction Wheel", op_code_dict_srv_rw)
@ -221,7 +314,10 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
op_code_dict_ploc_mem_dumper = { op_code_dict_ploc_mem_dumper = {
"0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("PLOC Memory Dumper: MRAM dump", {OpCodeDictKeys.TIMEOUT: 2.0}),
} }
service_ploc_memory_dumper_tuple = ("Radiation Sensor", op_code_dict_ploc_mem_dumper) service_ploc_memory_dumper_tuple = (
"Radiation Sensor",
op_code_dict_ploc_mem_dumper,
)
op_code_dict_srv_ploc_supv = { op_code_dict_srv_ploc_supv = {
"0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": ("PLOC Supervisor: Set mode on", {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -231,28 +327,49 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), "4": ("PLOC Supervisor: Restart MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), "5": ("PLOC Supervisor: Start MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("PLOC Supervisor: Shutdown MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), "6": ("PLOC Supervisor: Shutdown MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"7": ("PLOC Supervisor: Select MPSoC boot image", {OpCodeDictKeys.TIMEOUT: 2.0}), "7": (
"PLOC Supervisor: Select MPSoC boot image",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"8": ("PLOC Supervisor: Set max restart tries", {OpCodeDictKeys.TIMEOUT: 2.0}), "8": ("PLOC Supervisor: Set max restart tries", {OpCodeDictKeys.TIMEOUT: 2.0}),
"9": ("PLOC Supervisor: Reset MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}), "9": ("PLOC Supervisor: Reset MPSoC", {OpCodeDictKeys.TIMEOUT: 2.0}),
"10": ("PLOC Supervisor: Set time reference", {OpCodeDictKeys.TIMEOUT: 2.0}), "10": ("PLOC Supervisor: Set time reference", {OpCodeDictKeys.TIMEOUT: 2.0}),
"11": ("PLOC Supervisor: Set boot timeout", {OpCodeDictKeys.TIMEOUT: 2.0}), "11": ("PLOC Supervisor: Set boot timeout", {OpCodeDictKeys.TIMEOUT: 2.0}),
"12": ("PLOC Supervisor: Disable Hk", {OpCodeDictKeys.TIMEOUT: 2.0}), "12": ("PLOC Supervisor: Disable Hk", {OpCodeDictKeys.TIMEOUT: 2.0}),
"13": ("PLOC Supervisor: Request boot status report", {OpCodeDictKeys.TIMEOUT: 2.0}), "13": (
"PLOC Supervisor: Request boot status report",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"14": ("PLOC Supervisor: Update available", {OpCodeDictKeys.TIMEOUT: 2.0}), "14": ("PLOC Supervisor: Update available", {OpCodeDictKeys.TIMEOUT: 2.0}),
"15": ("PLOC Supervisor: Watchdogs enable", {OpCodeDictKeys.TIMEOUT: 2.0}), "15": ("PLOC Supervisor: Watchdogs enable", {OpCodeDictKeys.TIMEOUT: 2.0}),
"16": ("PLOC Supervisor: Watchdog Configure Timeout", {OpCodeDictKeys.TIMEOUT: 2.0}), "16": (
"PLOC Supervisor: Watchdog Configure Timeout",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"17": ("PLOC Supervisor: Enable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}), "17": ("PLOC Supervisor: Enable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
"18": ("PLOC Supervisor: Disable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}), "18": ("PLOC Supervisor: Disable latchup alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
"19": ("PLOC Supervisor: Auto calibrate alert", {OpCodeDictKeys.TIMEOUT: 2.0}), "19": ("PLOC Supervisor: Auto calibrate alert", {OpCodeDictKeys.TIMEOUT: 2.0}),
"20": ("PLOC Supervisor: Set alert limit", {OpCodeDictKeys.TIMEOUT: 2.0}), "20": ("PLOC Supervisor: Set alert limit", {OpCodeDictKeys.TIMEOUT: 2.0}),
"21": ("PLOC Supervisor: Set alert irq filter", {OpCodeDictKeys.TIMEOUT: 2.0}), "21": ("PLOC Supervisor: Set alert irq filter", {OpCodeDictKeys.TIMEOUT: 2.0}),
"22": ("PLOC Supervisor: Set ADC sweep period", {OpCodeDictKeys.TIMEOUT: 2.0}), "22": ("PLOC Supervisor: Set ADC sweep period", {OpCodeDictKeys.TIMEOUT: 2.0}),
"23": ("PLOC Supervisor: Set ADC enabled channels", {OpCodeDictKeys.TIMEOUT: 2.0}), "23": (
"24": ("PLOC Supervisor: Set ADC window and stride", {OpCodeDictKeys.TIMEOUT: 2.0}), "PLOC Supervisor: Set ADC enabled channels",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"24": (
"PLOC Supervisor: Set ADC window and stride",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"25": ("PLOC Supervisor: Set ADC threshold", {OpCodeDictKeys.TIMEOUT: 2.0}), "25": ("PLOC Supervisor: Set ADC threshold", {OpCodeDictKeys.TIMEOUT: 2.0}),
"26": ("PLOC Supervisor: Request latchup status report", {OpCodeDictKeys.TIMEOUT: 2.0}), "26": (
"PLOC Supervisor: Request latchup status report",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"27": ("PLOC Supervisor: Copy ADC data to MRAM", {OpCodeDictKeys.TIMEOUT: 2.0}), "27": ("PLOC Supervisor: Copy ADC data to MRAM", {OpCodeDictKeys.TIMEOUT: 2.0}),
"28": ("PLOC Supervisor: Enable/Disable NVM0/1/3", {OpCodeDictKeys.TIMEOUT: 2.0}), "28": (
"PLOC Supervisor: Enable/Disable NVM0/1/3",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"29": ("PLOC Supervisor: Select NVM", {OpCodeDictKeys.TIMEOUT: 2.0}), "29": ("PLOC Supervisor: Select NVM", {OpCodeDictKeys.TIMEOUT: 2.0}),
"30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}), "30": ("PLOC Supervisor: Run auto EM tests", {OpCodeDictKeys.TIMEOUT: 2.0}),
"31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}), "31": ("PLOC Supervisor: MRAM Wipe", {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -261,24 +378,55 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), "35": ("PLOC Supervisor: Set GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}),
"36": ("PLOC Supervisor: Read GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}), "36": ("PLOC Supervisor: Read GPIO", {OpCodeDictKeys.TIMEOUT: 2.0}),
"37": ("PLOC Supervisor: Restart supervisor", {OpCodeDictKeys.TIMEOUT: 2.0}), "37": ("PLOC Supervisor: Restart supervisor", {OpCodeDictKeys.TIMEOUT: 2.0}),
"38": ("PLOC Supervisor: Factory reset clear all", {OpCodeDictKeys.TIMEOUT: 2.0}), "38": (
"39": ("PLOC Supervisor: Factory reset clear mirror entries", "PLOC Supervisor: Factory reset clear all",
{OpCodeDictKeys.TIMEOUT: 2.0}), {OpCodeDictKeys.TIMEOUT: 2.0},
"40": ("PLOC Supervisor: Factory reset clear circular entries", ),
{OpCodeDictKeys.TIMEOUT: 2.0}), "39": (
"PLOC Supervisor: Factory reset clear mirror entries",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"40": (
"PLOC Supervisor: Factory reset clear circular entries",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"41": ("PLOC Supervisor: CAN loopback test", {OpCodeDictKeys.TIMEOUT: 2.0}), "41": ("PLOC Supervisor: CAN loopback test", {OpCodeDictKeys.TIMEOUT: 2.0}),
} }
service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv) service_ploc_supv_tuple = ("PLOC Supervisor", op_code_dict_srv_ploc_supv)
op_code_dict_srv_ploc_updater = { op_code_dict_srv_ploc_updater = {
"0": ("Ploc Updater: Update uboot on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}), "0": (
"1": ("Ploc Updater: Update bitstream on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}), "Ploc Updater: Update uboot on partition A",
"2": ("Ploc Updater: Update linux on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}), {OpCodeDictKeys.TIMEOUT: 2.0},
"3": ("Ploc Updater: Update application on partition A", {OpCodeDictKeys.TIMEOUT: 2.0}), ),
"4": ("Ploc Updater: Update uboot on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}), "1": (
"5": ("Ploc Updater: Update bitstream on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}), "Ploc Updater: Update bitstream on partition A",
"6": ("Ploc Updater: Update linux on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}), {OpCodeDictKeys.TIMEOUT: 2.0},
"7": ("Ploc Updater: Update application on partition B", {OpCodeDictKeys.TIMEOUT: 2.0}), ),
"2": (
"Ploc Updater: Update linux on partition A",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"3": (
"Ploc Updater: Update application on partition A",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"4": (
"Ploc Updater: Update uboot on partition B",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"5": (
"Ploc Updater: Update bitstream on partition B",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"6": (
"Ploc Updater: Update linux on partition B",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"7": (
"Ploc Updater: Update application on partition B",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
} }
service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater) service_ploc_updater_tuple = ("Ploc Updater", op_code_dict_srv_ploc_updater)
@ -288,13 +436,19 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"2": ("Star Tracker: Mode Off", {OpCodeDictKeys.TIMEOUT: 2.0}), "2": ("Star Tracker: Mode Off", {OpCodeDictKeys.TIMEOUT: 2.0}),
"3": ("Star Tracker: Mode Raw", {OpCodeDictKeys.TIMEOUT: 2.0}), "3": ("Star Tracker: Mode Raw", {OpCodeDictKeys.TIMEOUT: 2.0}),
"4": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 2.0}), "4": ("Star Tracker: Ping", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("Star Tracker: Switch to bootloader program", {OpCodeDictKeys.TIMEOUT: 2.0}), "5": (
"Star Tracker: Switch to bootloader program",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"6": ("Star Tracker: Request temperature", {OpCodeDictKeys.TIMEOUT: 2.0}), "6": ("Star Tracker: Request temperature", {OpCodeDictKeys.TIMEOUT: 2.0}),
"7": ("Star Tracker: Request version", {OpCodeDictKeys.TIMEOUT: 2.0}), "7": ("Star Tracker: Request version", {OpCodeDictKeys.TIMEOUT: 2.0}),
"8": ("Star Tracker: Request interface", {OpCodeDictKeys.TIMEOUT: 2.0}), "8": ("Star Tracker: Request interface", {OpCodeDictKeys.TIMEOUT: 2.0}),
"9": ("Star Tracker: Request power", {OpCodeDictKeys.TIMEOUT: 2.0}), "9": ("Star Tracker: Request power", {OpCodeDictKeys.TIMEOUT: 2.0}),
"10": ("Star Tracker: Subscribe to telemetry", {OpCodeDictKeys.TIMEOUT: 2.0}), "10": ("Star Tracker: Subscribe to telemetry", {OpCodeDictKeys.TIMEOUT: 2.0}),
"11": ("Star Tracker: Boot image (requires bootloader mode)", {OpCodeDictKeys.TIMEOUT: 2.0}), "11": (
"Star Tracker: Boot image (requires bootloader mode)",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"12": ("Star Tracker: Request time", {OpCodeDictKeys.TIMEOUT: 2.0}), "12": ("Star Tracker: Request time", {OpCodeDictKeys.TIMEOUT: 2.0}),
"13": ("Star Tracker: Request solution", {OpCodeDictKeys.TIMEOUT: 2.0}), "13": ("Star Tracker: Request solution", {OpCodeDictKeys.TIMEOUT: 2.0}),
"14": ("Star Tracker: Upload image", {OpCodeDictKeys.TIMEOUT: 2.0}), "14": ("Star Tracker: Upload image", {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -312,7 +466,10 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"26": ("Star Tracker: Take image", {OpCodeDictKeys.TIMEOUT: 2.0}), "26": ("Star Tracker: Take image", {OpCodeDictKeys.TIMEOUT: 2.0}),
"27": ("Star Tracker: Stop str helper", {OpCodeDictKeys.TIMEOUT: 2.0}), "27": ("Star Tracker: Stop str helper", {OpCodeDictKeys.TIMEOUT: 2.0}),
"28": ("Star Tracker: Reset error signal", {OpCodeDictKeys.TIMEOUT: 2.0}), "28": ("Star Tracker: Reset error signal", {OpCodeDictKeys.TIMEOUT: 2.0}),
"29": ("Star Tracker: Set name of download image", {OpCodeDictKeys.TIMEOUT: 2.0}), "29": (
"Star Tracker: Set name of download image",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"30": ("Star Tracker: Request histogram", {OpCodeDictKeys.TIMEOUT: 2.0}), "30": ("Star Tracker: Request histogram", {OpCodeDictKeys.TIMEOUT: 2.0}),
"31": ("Star Tracker: Request contrast", {OpCodeDictKeys.TIMEOUT: 2.0}), "31": ("Star Tracker: Request contrast", {OpCodeDictKeys.TIMEOUT: 2.0}),
"32": ("Star Tracker: Set json filename", {OpCodeDictKeys.TIMEOUT: 2.0}), "32": ("Star Tracker: Set json filename", {OpCodeDictKeys.TIMEOUT: 2.0}),
@ -322,12 +479,18 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"36": ("Star Tracker: Get checksum", {OpCodeDictKeys.TIMEOUT: 2.0}), "36": ("Star Tracker: Get checksum", {OpCodeDictKeys.TIMEOUT: 2.0}),
"37": ("Star Tracker: Set time", {OpCodeDictKeys.TIMEOUT: 2.0}), "37": ("Star Tracker: Set time", {OpCodeDictKeys.TIMEOUT: 2.0}),
"38": ("Star Tracker: Download centroid", {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 by arcsec?)",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"40": ("Star Tracker: Download matched star", {OpCodeDictKeys.TIMEOUT: 2.0}), "40": ("Star Tracker: Download matched star", {OpCodeDictKeys.TIMEOUT: 2.0}),
"41": ("Star Tracker: Download DB Image", {OpCodeDictKeys.TIMEOUT: 2.0}), "41": ("Star Tracker: Download DB Image", {OpCodeDictKeys.TIMEOUT: 2.0}),
"42": ("Star Tracker: Download Blob Pixel", {OpCodeDictKeys.TIMEOUT: 2.0}), "42": ("Star Tracker: Download Blob Pixel", {OpCodeDictKeys.TIMEOUT: 2.0}),
"43": ("Star Tracker: Download FPGA Image", {OpCodeDictKeys.TIMEOUT: 2.0}), "43": ("Star Tracker: Download FPGA Image", {OpCodeDictKeys.TIMEOUT: 2.0}),
"44": ("Star Tracker: Change download FPGA image name", {OpCodeDictKeys.TIMEOUT: 2.0}), "44": (
"Star Tracker: Change download FPGA image name",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"45": ("Star Tracker: Upload FPGA image", {OpCodeDictKeys.TIMEOUT: 2.0}), "45": ("Star Tracker: Upload FPGA image", {OpCodeDictKeys.TIMEOUT: 2.0}),
"46": ("Star Tracker: FPGA action", {OpCodeDictKeys.TIMEOUT: 2.0}), "46": ("Star Tracker: FPGA action", {OpCodeDictKeys.TIMEOUT: 2.0}),
} }
@ -353,14 +516,23 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
"2": ("Syrlinks Handler: Set TX carrier wave", {OpCodeDictKeys.TIMEOUT: 2.0}), "2": ("Syrlinks Handler: Set TX carrier wave", {OpCodeDictKeys.TIMEOUT: 2.0}),
"5": ("Syrlinks Handler: Read TX status", {OpCodeDictKeys.TIMEOUT: 2.0}), "5": ("Syrlinks Handler: Read TX status", {OpCodeDictKeys.TIMEOUT: 2.0}),
"6": ("Syrlinks Handler: Read TX waveform", {OpCodeDictKeys.TIMEOUT: 2.0}), "6": ("Syrlinks Handler: Read TX waveform", {OpCodeDictKeys.TIMEOUT: 2.0}),
"7": ("Syrlinks Handler: Read TX AGC value high byte ", {OpCodeDictKeys.TIMEOUT: 2.0}), "7": (
"8": ("Syrlinks Handler: Read TX AGC value low byte ", {OpCodeDictKeys.TIMEOUT: 2.0}) "Syrlinks Handler: Read TX AGC value high byte ",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
"8": (
"Syrlinks Handler: Read TX AGC value low byte ",
{OpCodeDictKeys.TIMEOUT: 2.0},
),
} }
service_syrlinks_handler_tuple = ("Syrlinks Handler", op_code_dict_srv_syrlinks_handler) service_syrlinks_handler_tuple = (
"Syrlinks Handler",
op_code_dict_srv_syrlinks_handler,
)
service_op_code_dict[CustomServiceList.P60DOCK.value] = service_p60_tuple service_op_code_dict[CustomServiceList.P60DOCK.value] = service_p60_tuple
service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu1_tuple service_op_code_dict[CustomServiceList.PDU1.value] = service_pdu1_tuple
service_op_code_dict[CustomServiceList.PDU2.value] = service_pdu2_tuple # service_op_code_dict[CustomServiceList.PDU2.value] = service_pdu2_tuple
service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple service_op_code_dict[CustomServiceList.HEATER.value] = service_heater_tuple
service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple service_op_code_dict[CustomServiceList.IMTQ.value] = service_imtq_tuple
service_op_code_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple service_op_code_dict[CustomServiceList.REACTION_WHEEL_1.value] = service_rw_tuple
@ -369,9 +541,21 @@ def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):
service_op_code_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple service_op_code_dict[CustomServiceList.REACTION_WHEEL_4.value] = service_rw_tuple
service_op_code_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple service_op_code_dict[CustomServiceList.RAD_SENSOR.value] = service_rad_sensor_tuple
service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple service_op_code_dict[CustomServiceList.PLOC_SUPV.value] = service_ploc_supv_tuple
service_op_code_dict[CustomServiceList.PLOC_UPDATER.value] = service_ploc_updater_tuple service_op_code_dict[
service_op_code_dict[CustomServiceList.STAR_TRACKER.value] = service_star_tracker_tuple CustomServiceList.PLOC_UPDATER.value
service_op_code_dict[CustomServiceList.PLOC_MEMORY_DUMPER.value] = service_ploc_memory_dumper_tuple ] = service_ploc_updater_tuple
service_op_code_dict[CustomServiceList.CCSDS_HANDLER.value] = service_ccsds_handler_tuple service_op_code_dict[
service_op_code_dict[CustomServiceList.PDEC_HANDLER.value] = service_pdec_handler_tuple CustomServiceList.STAR_TRACKER.value
service_op_code_dict[CustomServiceList.SYRLINKS.value] = service_syrlinks_handler_tuple ] = service_star_tracker_tuple
service_op_code_dict[
CustomServiceList.PLOC_MEMORY_DUMPER.value
] = service_ploc_memory_dumper_tuple
service_op_code_dict[
CustomServiceList.CCSDS_HANDLER.value
] = service_ccsds_handler_tuple
service_op_code_dict[
CustomServiceList.PDEC_HANDLER.value
] = service_pdec_handler_tuple
service_op_code_dict[
CustomServiceList.SYRLINKS.value
] = service_syrlinks_handler_tuple

View File

@ -58,30 +58,30 @@ PLOC_MPSOC_ID = bytes([0x44, 0x33, 0x00, 0x15])
def get_object_ids() -> Dict[bytes, list]: def get_object_ids() -> Dict[bytes, list]:
object_id_dict = ({ object_id_dict = {
PUS_SERVICE_17_ID: "PUS Service 17", PUS_SERVICE_17_ID: "PUS Service 17",
TEST_DEVICE_ID: "Test Device", TEST_DEVICE_ID: "Test Device",
P60_DOCK_HANDLER: "P60", P60_DOCK_HANDLER: "P60",
PDU_1_HANDLER_ID: "PCDU PDU1 Handler", PDU_1_HANDLER_ID: "PCDU PDU1 Handler",
PDU_2_HANDLER_ID: "PCDU PDU2 Handler", PDU_2_HANDLER_ID: "PCDU PDU2 Handler",
ACU_HANDLER_ID: "ACU Handler", ACU_HANDLER_ID: "ACU Handler",
TMP_1075_1_HANDLER_ID: "TMP 1075 Handler 1", TMP_1075_1_HANDLER_ID: "TMP 1075 Handler 1",
TMP_1075_2_HANDLER_ID: "TMP 1075 Handler 2", TMP_1075_2_HANDLER_ID: "TMP 1075 Handler 2",
HEATER_ID: "Heater", HEATER_ID: "Heater",
PCDU_HANDLER_ID: "PCDU", PCDU_HANDLER_ID: "PCDU",
SOLAR_ARRAY_DEPLOYMENT_ID: "Solar Array Deployment", SOLAR_ARRAY_DEPLOYMENT_ID: "Solar Array Deployment",
RW1_ID: "Reaction Wheel 1", RW1_ID: "Reaction Wheel 1",
RW2_ID: "Reaction Wheel 2", RW2_ID: "Reaction Wheel 2",
RW3_ID: "Reaction Wheel 3", RW3_ID: "Reaction Wheel 3",
RW4_ID: "Reaction Wheel 4", RW4_ID: "Reaction Wheel 4",
GPS_HANDLER_0_ID: "GPS 0", GPS_HANDLER_0_ID: "GPS 0",
GPS_HANDLER_1_ID: "GPS 1", GPS_HANDLER_1_ID: "GPS 1",
RAD_SENSOR_ID: "Radiation Sensor", RAD_SENSOR_ID: "Radiation Sensor",
PLOC_SUPV_ID: "PLOC Supervisor", PLOC_SUPV_ID: "PLOC Supervisor",
PLOC_MPSOC_ID: "PLOC MPSoC", PLOC_MPSOC_ID: "PLOC MPSoC",
CORE_CONTROLLER_ID: "Core Controller", CORE_CONTROLLER_ID: "Core Controller",
CCSDS_HANDLER_ID: "CCSDS Handler", CCSDS_HANDLER_ID: "CCSDS Handler",
PDEC_HANDLER_ID: "PDEC Handler", PDEC_HANDLER_ID: "PDEC Handler",
STAR_TRACKER_ID: "Star Tracker Handler", STAR_TRACKER_ID: "Star Tracker Handler",
}) }
return object_id_dict return object_id_dict

View File

@ -47,9 +47,9 @@ class Channel:
def pack_get_param_command( def pack_get_param_command(
object_id: bytearray, table_id: int, memory_address: bytearray, parameter_size: int object_id: bytearray, table_id: int, memory_address: bytearray, parameter_size: int
) -> PusTelecommand: ) -> PusTelecommand:
""" Function to generate a command to retrieve parameters like the temperature from a gomspace device. """Function to generate a command to retrieve parameters like the temperature from a gomspace device.
@param object_id: The object id of the gomspace device handler. @param object_id: The object id of the gomspace device handler.
@param table_id: The table id of the gomspace device @param table_id: The table id of the gomspace device
@param memory_address: Address offset within table of the value to read. @param memory_address: Address offset within table of the value to read.
@ -61,15 +61,20 @@ def pack_get_param_command(
app_data.extend(memory_address) app_data.extend(memory_address)
app_data.append(parameter_size) app_data.append(parameter_size)
return generate_action_command( return generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PARAM_GET, app_data=app_data object_id=object_id,
action_id=GomspaceDeviceActionIds.PARAM_GET,
app_data=app_data,
) )
def pack_set_param_command( def pack_set_param_command(
object_id: bytearray, memory_address: bytearray, parameter_size: int, parameter: int, object_id: bytearray,
ssc: int = 0 memory_address: bytearray,
parameter_size: int,
parameter: int,
ssc: int = 0,
) -> PusTelecommand: ) -> PusTelecommand:
""" Function to generate a command to set a parameter """Function to generate a command to set a parameter
:param object_id: The object id of the gomspace device handler. :param object_id: The object id of the gomspace device handler.
:param memory_address: Address offset within table of the value to set. :param memory_address: Address offset within table of the value to set.
:param parameter: The parameter value to set. :param parameter: The parameter value to set.
@ -104,7 +109,7 @@ def pack_set_param_command(
def pack_ping_command(object_id: bytearray, data: bytearray) -> PusTelecommand: def pack_ping_command(object_id: bytearray, data: bytearray) -> PusTelecommand:
"""" Function to generate the command to ping a gomspace device """ " Function to generate the command to ping a gomspace device
@param object_id Object Id of the gomspace device handler. @param object_id Object Id of the gomspace device handler.
@param data Bytearray containing the bytes to send to the gomspace device. For now the on board software @param data Bytearray containing the bytes to send to the gomspace device. For now the on board software
supports only the handling of up to 33 bytes. supports only the handling of up to 33 bytes.
@ -117,21 +122,25 @@ def pack_ping_command(object_id: bytearray, data: bytearray) -> PusTelecommand:
def pack_gnd_wdt_reset_command(object_id: bytearray) -> PusTelecommand: def pack_gnd_wdt_reset_command(object_id: bytearray) -> PusTelecommand:
"""" Function to generate the command to reset the watchdog of a gomspace device. """ " Function to generate the command to reset the watchdog of a gomspace device.
@param object_id Object Id of the gomspace device handler. @param object_id Object Id of the gomspace device handler.
""" """
return generate_action_command(object_id=object_id, action_id=GomspaceDeviceActionIds.WDT_RESET) return generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.WDT_RESET
)
def pack_reboot_command(object_id: bytearray) -> PusTelecommand: def pack_reboot_command(object_id: bytearray) -> PusTelecommand:
""" Function to generate the command which triggers a reboot of a gomspace device """Function to generate the command which triggers a reboot of a gomspace device
@param object_id The object id of the gomspace device handler. @param object_id The object id of the gomspace device handler.
""" """
return generate_action_command(object_id=object_id, action_id=GomspaceDeviceActionIds.REBOOT) return generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.REBOOT
)
def pack_request_full_hk_table_command(object_id: bytearray) -> PusTelecommand: def pack_request_full_hk_table_command(object_id: bytearray) -> PusTelecommand:
""" Function to generate the command to request the full housekeeping table from a gomspace """Function to generate the command to request the full housekeeping table from a gomspace
device. device.
@param object_id The object id of the gomspace device handler. @param object_id The object id of the gomspace device handler.
""" """

16
lint.py
View File

@ -5,18 +5,18 @@ import sys
def main(): def main():
# Ignore folder created by venv # Ignore folder created by venv
exclude_dirs_flag = '--exclude bin,lib' exclude_dirs_flag = "--exclude bin,lib"
additional_flags_both_steps = '--count --statistics' additional_flags_both_steps = "--count --statistics"
additional_flags_first_step = '--select=E9,F63,F7,F82 --show-source' additional_flags_first_step = "--select=E9,F63,F7,F82 --show-source"
flake8_first_step_cmd = \ flake8_first_step_cmd = f"flake8 . {additional_flags_both_steps} {additional_flags_first_step} {exclude_dirs_flag}"
f'flake8 . {additional_flags_both_steps} {additional_flags_first_step} {exclude_dirs_flag}'
status = os.system(flake8_first_step_cmd) status = os.system(flake8_first_step_cmd)
if os.WEXITSTATUS(status) != 0: if os.WEXITSTATUS(status) != 0:
print("Flake8 linter errors") print("Flake8 linter errors")
sys.exit(0) sys.exit(0)
flake8_second_step_cmd = \ flake8_second_step_cmd = (
f'flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 ' \ f"flake8 . {additional_flags_both_steps} --exit-zero --max-complexity=10 "
f'--max-line-length=127 {exclude_dirs_flag}' f"--max-line-length=127 {exclude_dirs_flag}"
)
os.system(flake8_second_step_cmd) os.system(flake8_second_step_cmd)

View File

@ -4,7 +4,12 @@ from spacepackets.ecss.definitions import PusServices
from tmtccmd.tc.service_200_mode import pack_mode_data, Modes from tmtccmd.tc.service_200_mode import pack_mode_data, Modes
from tmtccmd.tc.packer import PusTelecommand from tmtccmd.tc.packer import PusTelecommand
from config.object_ids import MGM_0_HANDLER_ID, MGM_1_HANDLER_ID, MGM_2_HANDLER_ID, MGM_3_HANDLER_ID from config.object_ids import (
MGM_0_HANDLER_ID,
MGM_1_HANDLER_ID,
MGM_2_HANDLER_ID,
MGM_3_HANDLER_ID,
)
from pus_tc.pdu1 import pack_pdu1_commands, Pdu1OpCodes from pus_tc.pdu1 import pack_pdu1_commands, Pdu1OpCodes
from pus_tc.pdu2 import pack_pdu2_commands, Pdu2OpCodes from pus_tc.pdu2 import pack_pdu2_commands, Pdu2OpCodes
@ -30,4 +35,4 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
pass pass
if op_code == AcsOpCodes.ON_MGM_0.value: if op_code == AcsOpCodes.ON_MGM_0.value:
app_data = pack_mode_data(object_id=MGM_0_HANDLER_ID, mode=Modes.ON, submode=0) app_data = pack_mode_data(object_id=MGM_0_HANDLER_ID, mode=Modes.ON, submode=0)
# return PusTelecommand(service=PusServices.SERVICE_200_MODE, subservice=) # return PusTelecommand(service=PusServices.SERVICE_200_MODE, subservice=)

View File

@ -20,6 +20,7 @@ class ACUTestProcedure:
@details Setting all to True will run all tests. @details Setting all to True will run all tests.
Setting all to False will only run the tests set to True. Setting all to False will only run the tests set to True.
""" """
all = False all = False
reboot = False reboot = False
read_gnd_wdt = False read_gnd_wdt = False
@ -56,12 +57,14 @@ class CommandId:
PRINT_CHANNEL_STATS = 51 PRINT_CHANNEL_STATS = 51
def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_acu_test_into(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Testing ACU")) tc_queue.appendleft((QueueCommands.PRINT, "Testing ACU"))
if op_code == "51": if op_code == "51":
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Print channel stats")) tc_queue.appendleft((QueueCommands.PRINT, "ACU: Print channel stats"))
command = object_id + struct.pack('!I', CommandId.PRINT_CHANNEL_STATS) command = object_id + struct.pack("!I", CommandId.PRINT_CHANNEL_STATS)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return return
@ -72,10 +75,14 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_gnd_wdt: if ACUTestProcedure.all or ACUTestProcedure.read_gnd_wdt:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading ground watchdog timer value")) tc_queue.appendleft(
(QueueCommands.PRINT, "ACU: Reading ground watchdog timer value")
)
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.hk, ACUHkTable.wdt_gnd_left.parameter_address, object_id,
ACUHkTable.wdt_gnd_left.parameter_size TableIds.hk,
ACUHkTable.wdt_gnd_left.parameter_address,
ACUHkTable.wdt_gnd_left.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -92,38 +99,62 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_temperature3: if ACUTestProcedure.all or ACUTestProcedure.read_temperature3:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading temperature 3")) tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading temperature 3"))
command = pack_get_param_command(object_id, TableIds.hk, ACUHkTable.temperature3.parameter_address, command = pack_get_param_command(
ACUHkTable.temperature3.parameter_size) object_id,
TableIds.hk,
ACUHkTable.temperature3.parameter_address,
ACUHkTable.temperature3.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vboost: if ACUTestProcedure.all or ACUTestProcedure.read_vboost:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vboost value")) tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vboost value"))
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vboost.parameter_address, command = pack_get_param_command(
ACUConfigTable.vboost.parameter_size) object_id,
TableIds.config,
ACUConfigTable.vboost.parameter_address,
ACUConfigTable.vboost.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_hi: if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_hi:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_hi")) tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_hi"))
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vbat_max_hi.parameter_address, command = pack_get_param_command(
ACUConfigTable.vbat_max_hi.parameter_size) object_id,
TableIds.config,
ACUConfigTable.vbat_max_hi.parameter_address,
ACUConfigTable.vbat_max_hi.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_lo: if ACUTestProcedure.all or ACUTestProcedure.read_vbat_max_lo:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_lo")) tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vbat_max_lo"))
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vbat_max_lo.parameter_address, command = pack_get_param_command(
ACUConfigTable.vbat_max_lo.parameter_size) object_id,
TableIds.config,
ACUConfigTable.vbat_max_lo.parameter_address,
ACUConfigTable.vbat_max_lo.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_ov_mode: if ACUTestProcedure.all or ACUTestProcedure.read_ov_mode:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading ov_mode")) tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading ov_mode"))
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.ov_mode.parameter_address, command = pack_get_param_command(
ACUConfigTable.ov_mode.parameter_size) object_id,
TableIds.config,
ACUConfigTable.ov_mode.parameter_address,
ACUConfigTable.ov_mode.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning off ACU")) tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning off ACU"))
command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address, command = pack_set_param_command(
P60DockConfigTable.out_en_0.parameter_size, Channel.off) p60dock_object_id,
P60DockConfigTable.out_en_0.parameter_address,
P60DockConfigTable.out_en_0.parameter_size,
Channel.off,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -21,10 +21,14 @@ class CommandIds:
DIS_TRANSMITTER = bytearray([0x0, 0x0, 0x0, 0x3]) DIS_TRANSMITTER = bytearray([0x0, 0x0, 0x0, 0x3])
def pack_ccsds_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_ccsds_handler_test(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing ccsds handler with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing ccsds handler with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
@ -40,13 +44,17 @@ def pack_ccsds_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: s
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2": if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "CCSDS Handler: Enables the transmitter")) tc_queue.appendleft(
(QueueCommands.PRINT, "CCSDS Handler: Enables the transmitter")
)
command = object_id + CommandIds.EN_TRANSMITTER command = object_id + CommandIds.EN_TRANSMITTER
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "CCSDS Handler: Disables the transmitter")) tc_queue.appendleft(
(QueueCommands.PRINT, "CCSDS Handler: Disables the transmitter")
)
command = object_id + CommandIds.DIS_TRANSMITTER command = object_id + CommandIds.DIS_TRANSMITTER
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -14,12 +14,12 @@ class ActionIds(enum.IntEnum):
class OpCodes(enum.Enum): class OpCodes(enum.Enum):
REBOOT = 'reboot' REBOOT = "reboot"
REBOOT_SELF = 'reboot_self' REBOOT_SELF = "reboot_self"
REBOOT_0_0 = 'reboot_0_0' REBOOT_0_0 = "reboot_0_0"
REBOOT_0_1 = 'reboot_0_1' REBOOT_0_1 = "reboot_0_1"
REBOOT_1_0 = 'reboot_1_0' REBOOT_1_0 = "reboot_1_0"
REBOOT_1_1 = 'reboot_1_1' REBOOT_1_1 = "reboot_1_1"
class Chip(enum.IntEnum): class Chip(enum.IntEnum):
@ -38,7 +38,10 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
if op_code == OpCodes.REBOOT.value: if op_code == OpCodes.REBOOT.value:
reboot_self, chip_select, copy_select = determine_reboot_params() reboot_self, chip_select, copy_select = determine_reboot_params()
perform_reboot_cmd( perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=reboot_self, chip=chip_select, copy=copy_select tc_queue=tc_queue,
reboot_self=reboot_self,
chip=chip_select,
copy=copy_select,
) )
elif op_code == OpCodes.REBOOT_SELF.value: elif op_code == OpCodes.REBOOT_SELF.value:
perform_reboot_cmd(tc_queue=tc_queue, reboot_self=True) perform_reboot_cmd(tc_queue=tc_queue, reboot_self=True)
@ -48,7 +51,10 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
) )
elif op_code == OpCodes.REBOOT_0_1.value: elif op_code == OpCodes.REBOOT_0_1.value:
perform_reboot_cmd( perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_0, copy=Copy.COPY_1_GOLD tc_queue=tc_queue,
reboot_self=False,
chip=Chip.CHIP_0,
copy=Copy.COPY_1_GOLD,
) )
elif op_code == OpCodes.REBOOT_1_0.value: elif op_code == OpCodes.REBOOT_1_0.value:
perform_reboot_cmd( perform_reboot_cmd(
@ -56,57 +62,70 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
) )
elif op_code == OpCodes.REBOOT_1_1.value: elif op_code == OpCodes.REBOOT_1_1.value:
perform_reboot_cmd( perform_reboot_cmd(
tc_queue=tc_queue, reboot_self=False, chip=Chip.CHIP_1, copy=Copy.COPY_1_GOLD tc_queue=tc_queue,
reboot_self=False,
chip=Chip.CHIP_1,
copy=Copy.COPY_1_GOLD,
) )
def determine_reboot_params() -> (bool, Chip, Copy): def determine_reboot_params() -> (bool, Chip, Copy):
chip_select = -1 chip_select = -1
copy_select = -1 copy_select = -1
reboot_self = input('Reboot self? [y/n]: ') reboot_self = input("Reboot self? [y/n]: ")
if reboot_self in ['y', 'yes', '1']: if reboot_self in ["y", "yes", "1"]:
LOGGER.info('Rebooting currently running image') LOGGER.info("Rebooting currently running image")
return True, chip_select, copy_select return True, chip_select, copy_select
LOGGER.info('Rebooting image specified by chip and copy') LOGGER.info("Rebooting image specified by chip and copy")
while True: while True:
chip_select = input('Chip select [0/1]: ') chip_select = input("Chip select [0/1]: ")
if chip_select in ['0', '1']: if chip_select in ["0", "1"]:
if chip_select == '0': if chip_select == "0":
chip_select = Chip.CHIP_0 chip_select = Chip.CHIP_0
else: else:
chip_select = Chip.CHIP_1 chip_select = Chip.CHIP_1
break break
else: else:
LOGGER.warning('Invalid chip select value. Try again') LOGGER.warning("Invalid chip select value. Try again")
while True: while True:
copy_select = input('Copy select [0/1]: ') copy_select = input("Copy select [0/1]: ")
if copy_select in ['0', '1']: if copy_select in ["0", "1"]:
if copy_select == '0': if copy_select == "0":
copy_select = Copy.COPY_0_NOM copy_select = Copy.COPY_0_NOM
else: else:
copy_select = Copy.COPY_1_GOLD copy_select = Copy.COPY_1_GOLD
break break
else: else:
LOGGER.warning('Invalid copy select value. Try again') LOGGER.warning("Invalid copy select value. Try again")
return False, chip_select, copy_select return False, chip_select, copy_select
def perform_reboot_cmd( def perform_reboot_cmd(
tc_queue: TcQueueT, reboot_self: bool, chip: Chip = Chip.NONE, copy: Copy = Copy.NONE tc_queue: TcQueueT,
reboot_self: bool,
chip: Chip = Chip.NONE,
copy: Copy = Copy.NONE,
): ):
tc_data = bytearray() tc_data = bytearray()
if reboot_self: if reboot_self:
tc_queue.appendleft((QueueCommands.PRINT, 'Packing reboot command for current image')) tc_queue.appendleft(
(QueueCommands.PRINT, "Packing reboot command for current image")
)
tc_data.append(True) tc_data.append(True)
else: else:
tc_data.append(False) tc_data.append(False)
tc_data.append(chip) tc_data.append(chip)
tc_data.append(copy) tc_data.append(copy)
tc_queue.append( tc_queue.append(
(QueueCommands.PRINT, f'Packing reboot command for chip {chip} and copy {copy}') (
QueueCommands.PRINT,
f"Packing reboot command for chip {chip} and copy {copy}",
)
) )
action_cmd = generate_action_command( action_cmd = generate_action_command(
object_id=CORE_CONTROLLER_ID, action_id=ActionIds.REBOOT, app_data=tc_data, ssc=0 object_id=CORE_CONTROLLER_ID,
action_id=ActionIds.REBOOT,
app_data=tc_data,
ssc=0,
) )
tc_queue.appendleft(action_cmd.pack_command_tuple()) tc_queue.appendleft(action_cmd.pack_command_tuple())

View File

@ -43,8 +43,10 @@ def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT):
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
def pack_switch_heater_command(object_id: bytearray, switch_nr: int, switch_action: int) -> bytearray: def pack_switch_heater_command(
""" Function to generate the command switch a heater object_id: bytearray, switch_nr: int, switch_action: int
) -> bytearray:
"""Function to generate the command switch a heater
@param object_id The object id of the HeaterHandler object. @param object_id The object id of the HeaterHandler object.
@param switch_nr The switch number identifying the heater to switch @param switch_nr The switch number identifying the heater to switch
@param switch_action Action to perform. 0 - Sets switch off, 1 - Sets switch on. @param switch_action Action to perform. 0 - Sets switch off, 1 - Sets switch on.

View File

@ -38,10 +38,14 @@ class ImtqActionIds:
read_self_test_results = bytearray([0x0, 0x0, 0x0, 0x0D]) read_self_test_results = bytearray([0x0, 0x0, 0x0, 0x0D])
def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_imtq_test_into(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing ISIS IMTQ handler with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing ISIS IMTQ handler with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0" or op_code == "1": if op_code == "0" or op_code == "1":
@ -50,12 +54,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of positive x self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Initiate reading of positive x self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive x self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with positive x self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.POSITIVE_X_TEST) sid = make_sid(object_id, ImtqSetIds.POSITIVE_X_TEST)
command = generate_one_hk_command(sid, 24) command = generate_one_hk_command(sid, 24)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -66,12 +80,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative x self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Initiate reading of negative x self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative x self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with negative x self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_X_TEST) sid = make_sid(object_id, ImtqSetIds.NEGATIVE_X_TEST)
command = generate_one_hk_command(sid, 27) command = generate_one_hk_command(sid, 27)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -82,12 +106,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of positive y self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Initiate reading of positive y self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive y self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with positive y self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST) sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST)
command = generate_one_hk_command(sid, 30) command = generate_one_hk_command(sid, 30)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -98,12 +132,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative y self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Initiate reading of negative y self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative y self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with negative y self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Y_TEST) sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Y_TEST)
command = generate_one_hk_command(sid, 33) command = generate_one_hk_command(sid, 33)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -114,12 +158,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of positive z self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Initiate reading of positive z self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with positive z self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with positive z self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST) sid = make_sid(object_id, ImtqSetIds.POSITIVE_Y_TEST)
command = generate_one_hk_command(sid, 36) command = generate_one_hk_command(sid, 36)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -130,12 +184,22 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Initiate reading of negative z self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Initiate reading of negative z self test results",
)
)
command = object_id + ImtqActionIds.read_self_test_results command = object_id + ImtqActionIds.read_self_test_results
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "IMTQ: Request dataset with negative z self test results")) tc_queue.appendleft(
(
QueueCommands.PRINT,
"IMTQ: Request dataset with negative z self test results",
)
)
sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Z_TEST) sid = make_sid(object_id, ImtqSetIds.NEGATIVE_Z_TEST)
command = generate_one_hk_command(sid, 37) command = generate_one_hk_command(sid, 37)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -145,7 +209,7 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
x_dipole = 0 x_dipole = 0
y_dipole = 0 y_dipole = 0
z_dipole = 0 z_dipole = 0
duration = 0 # ms duration = 0 # ms
command = pack_dipole_command(object_id, x_dipole, y_dipole, z_dipole, duration) command = pack_dipole_command(object_id, x_dipole, y_dipole, z_dipole, duration)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -159,8 +223,10 @@ def pack_imtq_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str)
return tc_queue return tc_queue
def pack_dipole_command(object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int) -> bytearray: def pack_dipole_command(
""" This function packs the command causing the ISIS IMTQ to generate a dipole. object_id: bytearray, x_dipole: int, y_dipole: int, z_dipole: int, duration: int
) -> bytearray:
"""This function packs the command causing the ISIS IMTQ to generate a dipole.
@param object_id The object id of the IMTQ handler. @param object_id The object id of the IMTQ handler.
@param x_dipole The dipole of the x coil in 10^-4*Am^2 (max. 2000) @param x_dipole The dipole of the x coil in 10^-4*Am^2 (max. 2000)
@param y_dipole The dipole of the y coil in 10^-4*Am^2 (max. 2000) @param y_dipole The dipole of the y coil in 10^-4*Am^2 (max. 2000)
@ -172,8 +238,8 @@ def pack_dipole_command(object_id: bytearray, x_dipole: int, y_dipole: int, z_di
action_id = ImtqActionIds.start_actuation_dipole action_id = ImtqActionIds.start_actuation_dipole
command = bytearray() command = bytearray()
command = object_id + action_id command = object_id + action_id
command.extend(x_dipole.to_bytes(length=2, byteorder='big')) command.extend(x_dipole.to_bytes(length=2, byteorder="big"))
command.extend(y_dipole.to_bytes(length=2, byteorder='big')) command.extend(y_dipole.to_bytes(length=2, byteorder="big"))
command.extend(z_dipole.to_bytes(length=2, byteorder='big')) command.extend(z_dipole.to_bytes(length=2, byteorder="big"))
command.extend(duration.to_bytes(length=2, byteorder='big')) command.extend(duration.to_bytes(length=2, byteorder="big"))
return command return command

View File

@ -22,6 +22,7 @@ class P60DockTestProcedure:
@details Setting all to True will run all tests. @details Setting all to True will run all tests.
Setting all to False will only run the tests set to True. Setting all to False will only run the tests set to True.
""" """
all = False all = False
reboot = False reboot = False
read_gnd_wdt = False read_gnd_wdt = False
@ -32,8 +33,12 @@ class P60DockTestProcedure:
read_channel_3_state = False # pdu2 read_channel_3_state = False # pdu2
read_cur_lu_lim_0 = False read_cur_lu_lim_0 = False
channel_3_on = False # pdu2 channel_3_on = False # pdu2
invalid_table_id_test = False # Test to check if software properly handles invalid table ids invalid_table_id_test = (
invalid_address_test = False # Test to check if software properly handles invalid addresses False # Test to check if software properly handles invalid table ids
)
invalid_address_test = (
False # Test to check if software properly handles invalid addresses
)
invalid_parameter_size_test = False invalid_parameter_size_test = False
@ -49,8 +54,12 @@ class P60DockConfigTable:
out_en_8 = TableEntry(bytearray([0x00, 0x70]), TableEntry.uint8_size) # Stack VBAT out_en_8 = TableEntry(bytearray([0x00, 0x70]), TableEntry.uint8_size) # Stack VBAT
out_en_9 = TableEntry(bytearray([0x00, 0x71]), TableEntry.uint8_size) # Stack 3V3 out_en_9 = TableEntry(bytearray([0x00, 0x71]), TableEntry.uint8_size) # Stack 3V3
out_en_10 = TableEntry(bytearray([0x00, 0x72]), TableEntry.uint8_size) # Stack 5V out_en_10 = TableEntry(bytearray([0x00, 0x72]), TableEntry.uint8_size) # Stack 5V
out_en_11 = TableEntry(bytearray([0x00, 0x73]), TableEntry.uint8_size) # GS 3V3 (unused) out_en_11 = TableEntry(
out_en_12 = TableEntry(bytearray([0x00, 0x74]), TableEntry.uint8_size) # GS 5V (unused) bytearray([0x00, 0x73]), TableEntry.uint8_size
) # GS 3V3 (unused)
out_en_12 = TableEntry(
bytearray([0x00, 0x74]), TableEntry.uint8_size
) # GS 5V (unused)
# When channel consumes more than cur_lu_lim, channel is turned of immediately # When channel consumes more than cur_lu_lim, channel is turned of immediately
cur_lu_lim_0 = TableEntry(bytearray([0x00, 0xF8]), TableEntry.uint16_size) cur_lu_lim_0 = TableEntry(bytearray([0x00, 0xF8]), TableEntry.uint16_size)
@ -66,21 +75,27 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st
if op_code == P60OpCodes.STACK_3V3_ON.value: if op_code == P60OpCodes.STACK_3V3_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 on")) tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 on"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, P60DockConfigTable.out_en_9.parameter_address, object_id,
P60DockConfigTable.out_en_9.parameter_size, Channel.on P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return return
if op_code == P60OpCodes.STACK_3V3_OFF.value: if op_code == P60OpCodes.STACK_3V3_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 off")) tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 off"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, P60DockConfigTable.out_en_9.parameter_address, object_id,
P60DockConfigTable.out_en_9.parameter_size, Channel.off P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return return
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents")) tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents")
)
command = generate_action_command( command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
) )
@ -92,15 +107,21 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.read_gnd_wdt: if P60DockTestProcedure.all or P60DockTestProcedure.read_gnd_wdt:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reading ground watchdog timer value")) tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Reading ground watchdog timer value")
)
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.hk, P60DockHkTable.wdt_gnd_left.parameter_address, object_id,
P60DockHkTable.wdt_gnd_left.parameter_size TableIds.hk,
P60DockHkTable.wdt_gnd_left.parameter_address,
P60DockHkTable.wdt_gnd_left.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.gnd_wdt_reset: if P60DockTestProcedure.all or P60DockTestProcedure.gnd_wdt_reset:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing ground watchdog reset")) tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing ground watchdog reset")
)
command = pack_gnd_wdt_reset_command(object_id) command = pack_gnd_wdt_reset_command(object_id)
# command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -111,86 +132,141 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_off: if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_off:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 off")) tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 off")
)
parameter = 0 # set channel off parameter = 0 # set channel off
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address, command = pack_set_param_command(
P60DockConfigTable.out_en_3.parameter_size, parameter) object_id,
P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size,
parameter,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.read_temperature1: if P60DockTestProcedure.all or P60DockTestProcedure.read_temperature1:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing temperature reading")) tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing temperature reading")
)
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address, object_id,
P60DockHkTable.temperature1.parameter_size TableIds.hk,
P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on: if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
tc_queue.appendleft((QueueCommands.PRINT, tc_queue.appendleft(
"P60 Dock: Testing Output Channel 3 state (PDU2)")) (QueueCommands.PRINT, "P60 Dock: Testing Output Channel 3 state (PDU2)")
command = pack_get_param_command(object_id, TableIds.config, P60DockConfigTable.out_en_3.parameter_address, )
P60DockConfigTable.out_en_3.parameter_size) command = pack_get_param_command(
object_id,
TableIds.config,
P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0: if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0:
tc_queue.appendleft((QueueCommands.PRINT, tc_queue.appendleft(
"P60 Dock: Reading current limit value of output channel 0")) (
QueueCommands.PRINT,
"P60 Dock: Reading current limit value of output channel 0",
)
)
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.config, P60DockConfigTable.cur_lu_lim_0.parameter_address, object_id,
P60DockConfigTable.cur_lu_lim_0.parameter_size TableIds.config,
P60DockConfigTable.cur_lu_lim_0.parameter_address,
P60DockConfigTable.cur_lu_lim_0.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on: if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 on")) tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 on")
)
parameter = 1 # set channel on parameter = 1 # set channel on
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address, command = pack_set_param_command(
P60DockConfigTable.out_en_3.parameter_size, parameter) object_id,
P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size,
parameter,
)
# command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_table_id_test: if P60DockTestProcedure.all or P60DockTestProcedure.invalid_table_id_test:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Testing invalid table id handling")) tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Testing invalid table id handling")
)
table_id_invalid = 5 table_id_invalid = 5
command = pack_get_param_command( command = pack_get_param_command(
object_id, table_id_invalid, P60DockHkTable.temperature1.parameter_address, object_id,
P60DockHkTable.temperature1.parameter_size table_id_invalid,
P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test: if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test:
tc_queue.appendleft((QueueCommands.PRINT, tc_queue.appendleft(
"P60 Dock: Testing invalid address handling in get param command")) (
QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in get param command",
)
)
invalid_address = bytearray([0x01, 0xF4]) invalid_address = bytearray([0x01, 0xF4])
command = pack_get_param_command(object_id, TableIds.hk, invalid_address, command = pack_get_param_command(
P60DockHkTable.temperature1.parameter_size) object_id,
TableIds.hk,
invalid_address,
P60DockHkTable.temperature1.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, tc_queue.appendleft(
"P60 Dock: Testing invalid address handling in set param command")) (
QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in set param command",
)
)
invalid_address = bytearray([0x01, 0xF4]) invalid_address = bytearray([0x01, 0xF4])
parameter_size = 2 parameter_size = 2
parameter = 1 parameter = 1
command = pack_set_param_command(object_id, invalid_address, parameter_size, parameter) command = pack_set_param_command(
object_id, invalid_address, parameter_size, parameter
)
# command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test: if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"P60 Dock: Testing handling of invalid parameter sizes in get-param command") QueueCommands.PRINT,
"P60 Dock: Testing handling of invalid parameter sizes in get-param command",
)
) )
invalid_size = 5 invalid_size = 5
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address, invalid_size object_id,
TableIds.hk,
P60DockHkTable.temperature1.parameter_address,
invalid_size,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"P60 Dock: Testing handling of invalid parameter size in set-param command") QueueCommands.PRINT,
"P60 Dock: Testing handling of invalid parameter size in set-param command",
)
) )
parameter = 1 parameter = 1
command = pack_set_param_command( command = pack_set_param_command(
object_id, P60DockConfigTable.out_en_3.parameter_address, invalid_size, parameter object_id,
P60DockConfigTable.out_en_3.parameter_address,
invalid_size,
parameter,
) )
# command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) # command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -17,10 +17,12 @@ class CommandIds:
PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1]) PRINT_PDEC_MON = bytearray([0x0, 0x0, 0x0, 0x1])
def pack_pdec_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_pdec_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing PDEC handler with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing PDEC handler with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
@ -30,7 +32,9 @@ def pack_pdec_handler_test(object_id: bytearray, tc_queue: TcQueueT, op_code: st
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "PDEC Handler: Print PDEC monitor register")) tc_queue.appendleft(
(QueueCommands.PRINT, "PDEC Handler: Print PDEC monitor register")
)
command = object_id + CommandIds.PRINT_PDEC_MON command = object_id + CommandIds.PRINT_PDEC_MON
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -33,11 +33,12 @@ class PDU1TestProcedure:
@details Setting all to True will run all tests. @details Setting all to True will run all tests.
Setting all to False will only run the tests set to True. Setting all to False will only run the tests set to True.
""" """
all = False all = False
reboot = False reboot = False
ping = False ping = False
read_temperature = False read_temperature = False
turn_channel_2_on = False # Star Tracker connected to this channel (5V) turn_channel_2_on = False # Star Tracker connected to this channel (5V)
turn_channel_2_off = False turn_channel_2_off = False
turn_channel_3_on = False # MTQ connected to this channel (5V) turn_channel_3_on = False # MTQ connected to this channel (5V)
turn_channel_3_off = False turn_channel_3_off = False
@ -49,64 +50,88 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.TCS_BOARD_ON.value: if op_code == Pdu1OpCodes.TCS_BOARD_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board on"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_0.parameter_address, object_id,
PDUConfigTable.out_en_2.parameter_size, Channel.on PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.TCS_BOARD_OFF.value: if op_code == Pdu1OpCodes.TCS_BOARD_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board off"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_0.parameter_address, object_id,
PDUConfigTable.out_en_2.parameter_size, Channel.off PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.STAR_TRACKER_ON.value: if op_code == Pdu1OpCodes.STAR_TRACKER_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker on"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_2.parameter_address, object_id,
PDUConfigTable.out_en_2.parameter_size, Channel.on PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.STAR_TRACKER_OFF.value: if op_code == Pdu1OpCodes.STAR_TRACKER_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address, command = pack_set_param_command(
PDUConfigTable.out_en_2.parameter_size, Channel.off) object_id,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value: if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal on"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address, command = pack_set_param_command(
PDUConfigTable.out_en_4.parameter_size, Channel.on) object_id,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value: if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_4.parameter_address, object_id,
PDUConfigTable.out_en_4.parameter_size, Channel.off PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.ACS_A_SIDE_ON.value: if op_code == Pdu1OpCodes.ACS_A_SIDE_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A on"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_7.parameter_address, object_id,
PDUConfigTable.out_en_7.parameter_size, Channel.on PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.ACS_A_SIDE_OFF.value: if op_code == Pdu1OpCodes.ACS_A_SIDE_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A off"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_7.parameter_address, object_id,
PDUConfigTable.out_en_7.parameter_size, Channel.off PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value: if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_4.parameter_address, object_id,
PDUConfigTable.out_en_4.parameter_size, Channel.off PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")) tc_queue.appendleft(
(QueueCommands.PRINT, "PDU1: Print Switches, Voltages, Currents")
)
command = generate_action_command( command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
) )
@ -114,15 +139,19 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if op_code == Pdu1OpCodes.SYRLINKS_ON.value: if op_code == Pdu1OpCodes.SYRLINKS_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks on"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_1.parameter_address, object_id,
PDUConfigTable.out_en_1.parameter_size, Channel.on PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.SYRLINKS_OFF.value: if op_code == Pdu1OpCodes.SYRLINKS_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks off"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_1.parameter_address, object_id,
PDUConfigTable.out_en_1.parameter_size, Channel.off PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -134,35 +163,49 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature: if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading"))
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.hk, PDUHkTable.temperature.parameter_address, object_id,
PDUHkTable.temperature.parameter_size TableIds.hk,
PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)")) tc_queue.appendleft(
(QueueCommands.PRINT, "PDU1: Turn channel 2 on (Star Tracker)")
)
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_2.parameter_address, object_id,
PDUConfigTable.out_en_2.parameter_size, Channel.on PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_2_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)")) tc_queue.appendleft(
(QueueCommands.PRINT, "PDU1: Turn channel 2 off (Star Tracker)")
)
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_2.parameter_address, object_id,
PDUConfigTable.out_en_2.parameter_size, Channel.off PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_3.parameter_address, object_id,
PDUConfigTable.out_en_3.parameter_size, Channel.on PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off: if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)")) tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_3.parameter_address, object_id,
PDUConfigTable.out_en_3.parameter_size, Channel.off PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -19,6 +19,8 @@ class Pdu2OpCodes(enum.Enum):
SUS_REDUNDANT_OFF = "4" SUS_REDUNDANT_OFF = "4"
RW_ON = "5" RW_ON = "5"
RW_OFF = "6" RW_OFF = "6"
# There is not really a point of the on command, the SW can not be commanded if the OBC is off
Q7S_OFF = "7"
class PDU2TestProcedure: class PDU2TestProcedure:
@ -27,6 +29,7 @@ class PDU2TestProcedure:
@details Setting all to True will run all tests. @details Setting all to True will run all tests.
Setting all to False will only run the tests set to True. Setting all to False will only run the tests set to True.
""" """
all = False all = False
reboot = False reboot = False
read_gnd_wdt = False read_gnd_wdt = False
@ -37,55 +40,88 @@ class PDU2TestProcedure:
read_channel_2_state = False # Reaction wheels 5V read_channel_2_state = False # Reaction wheels 5V
read_cur_lu_lim_0 = False # OBC read_cur_lu_lim_0 = False # OBC
channel_2_on = False # Reaction wheels 5V channel_2_on = False # Reaction wheels 5V
invalid_table_id_test = False # Test to check if software properly handles invalid table ids invalid_table_id_test = (
invalid_address_test = False # Test to check if software properly handles invalid addresses False # Test to check if software properly handles invalid table ids
)
invalid_address_test = (
False # Test to check if software properly handles invalid addresses
)
invalid_parameter_size_test = False invalid_parameter_size_test = False
request_hk_table = False request_hk_table = False
def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2")) tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU2"))
if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value: if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B on"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_7.parameter_address, object_id,
PDUConfigTable.out_en_7.parameter_size, Channel.on PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return tc_queue return tc_queue
if op_code == Pdu2OpCodes.ACS_SIDE_B_OFF.value: if op_code == Pdu2OpCodes.ACS_SIDE_B_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B off"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_7.parameter_address, object_id,
PDUConfigTable.out_en_7.parameter_size, Channel.off PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.off,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return tc_queue return tc_queue
if op_code == Pdu2OpCodes.Q7S_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "Turning off Q7S OBC"))
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_0.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.SUS_REDUNDANT_ON.value: if op_code == Pdu2OpCodes.SUS_REDUNDANT_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant on"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address, command = pack_set_param_command(
PDUConfigTable.out_en_4.parameter_size, Channel.on) object_id,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value: if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address, command = pack_set_param_command(
PDUConfigTable.out_en_4.parameter_size, Channel.off) object_id,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.RW_ON.value: if op_code == Pdu2OpCodes.RW_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels on")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels on"))
command = pack_set_param_command( command = pack_set_param_command(
object_id, PDUConfigTable.out_en_2.parameter_address, object_id,
PDUConfigTable.out_en_2.parameter_size, Channel.on PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.RW_OFF.value: if op_code == Pdu2OpCodes.RW_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels off")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address, command = pack_set_param_command(
PDUConfigTable.out_en_2.parameter_size, Channel.off) object_id,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value: if op_code == GomspaceOpCodes.PRINT_SWITCH_V_I.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes")) tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Print Switches, Currents, Voltahes")
)
command = generate_action_command( command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
) )
@ -96,14 +132,20 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
command = pack_reboot_command(object_id) command = pack_reboot_command(object_id)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt: if PDU2TestProcedure.all or PDU2TestProcedure.read_gnd_wdt:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value")) tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Reading ground watchdog timer value")
)
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.hk, PDUHkTable.wdt_gnd_left.parameter_address, object_id,
PDUHkTable.wdt_gnd_left.parameter_size TableIds.hk,
PDUHkTable.wdt_gnd_left.parameter_address,
PDUHkTable.wdt_gnd_left.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset: if PDU2TestProcedure.all or PDU2TestProcedure.gnd_wdt_reset:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing ground watchdog reset")) tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Testing ground watchdog reset")
)
command = pack_gnd_wdt_reset_command(object_id) command = pack_gnd_wdt_reset_command(object_id)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.ping: if PDU2TestProcedure.all or PDU2TestProcedure.ping:
@ -113,16 +155,25 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on: if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Testing setting output channel 2 on (TCS Heater)") (
QueueCommands.PRINT,
"PDU2: Testing setting output channel 2 on (TCS Heater)",
)
)
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
) )
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature: if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading")) tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading"))
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.hk, PDUHkTable.temperature.parameter_address, object_id,
PDUHkTable.temperature.parameter_size TableIds.hk,
PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state: if PDU2TestProcedure.all or PDU2TestProcedure.read_channel_2_state:
@ -130,27 +181,40 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -
(QueueCommands.PRINT, "PDU2: Reading output channel 2 state (TCS Heater)") (QueueCommands.PRINT, "PDU2: Reading output channel 2 state (TCS Heater)")
) )
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.config, PDUConfigTable.out_en_2.parameter_address, object_id,
PDUConfigTable.out_en_2.parameter_size TableIds.config,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0: if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Reading current limit value of output channel 0 (OBC)") (
QueueCommands.PRINT,
"PDU2: Reading current limit value of output channel 0 (OBC)",
)
) )
command = pack_get_param_command( command = pack_get_param_command(
object_id, TableIds.config, PDUConfigTable.cur_lu_lim_0.parameter_address, object_id,
PDUConfigTable.cur_lu_lim_0.parameter_size TableIds.config,
PDUConfigTable.cur_lu_lim_0.parameter_address,
PDUConfigTable.cur_lu_lim_0.parameter_size,
) )
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off: if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off")) tc_queue.appendleft(
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address, (QueueCommands.PRINT, "PDU2: Testing setting output channel 2 off")
PDUConfigTable.out_en_2.parameter_size, Channel.off) )
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table: if PDU2TestProcedure.all or PDU2TestProcedure.request_hk_table:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Requesting housekeeping table")) tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Requesting housekeeping table")
)
command = pack_request_full_hk_table_command(object_id) command = pack_request_full_hk_table_command(object_id)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return tc_queue

View File

@ -18,10 +18,14 @@ class ActionIds:
DUMP_MRAM = 1 DUMP_MRAM = 1
def pack_ploc_memory_dumper_cmd(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_ploc_memory_dumper_cmd(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing PLOC memory dumper with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing PLOC memory dumper with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
@ -35,7 +39,7 @@ def pack_mram_dump_cmd(object_id: bytearray) -> bytearray:
start = int(input("Start address: 0x"), 16) start = int(input("Start address: 0x"), 16)
end = int(input("End address: 0x"), 16) end = int(input("End address: 0x"), 16)
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', ActionIds.DUMP_MRAM) command = object_id + struct.pack("!I", ActionIds.DUMP_MRAM)
command = command + struct.pack('!I', start) command = command + struct.pack("!I", start)
command = command + struct.pack('!I', end) command = command + struct.pack("!I", end)
return command return command

View File

@ -20,6 +20,7 @@ class PlocTestProcedure:
@details Setting all to True will run all tests. @details Setting all to True will run all tests.
Setting all to False will only run the tests set to True. Setting all to False will only run the tests set to True.
""" """
all = False all = False
test_tc_mem_write = False test_tc_mem_write = False
test_tc_mem_read = True test_tc_mem_read = True
@ -36,33 +37,43 @@ class PlocReplyIds:
def pack_ploc_mpsoc_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: def pack_ploc_mpsoc_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (QueueCommands.PRINT, "Testing PLOC MPSoC with object id: 0x" + object_id.hex())
"Testing PLOC MPSoC with object id: 0x" + object_id.hex())
) )
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_write: if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_write:
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Write Test")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Write Test"))
memory_address = int(input("PLOC Tc Mem Write: Type memory address: 0x"), 16) memory_address = int(input("PLOC Tc Mem Write: Type memory address: 0x"), 16)
memory_data = int(input("PLOC Tc Mem Write: Type memory data: 0x"), 16) memory_data = int(input("PLOC Tc Mem Write: Type memory data: 0x"), 16)
command = generate_write_mem_command(object_id, struct.pack('!I', memory_address), memory_data) command = generate_write_mem_command(
object_id, struct.pack("!I", memory_address), memory_data
)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_read: if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_read:
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Read Test")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Read Test"))
memory_address = int(input("PLOC Tc Mem Read: Type memory address: 0x"), 16) memory_address = int(input("PLOC Tc Mem Read: Type memory address: 0x"), 16)
command = object_id + PlocActionIds.tc_mem_read + struct.pack('!I', memory_address) command = (
object_id + PlocActionIds.tc_mem_read + struct.pack("!I", memory_address)
)
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return tc_queue return tc_queue
def generate_write_mem_command(object_id: bytearray, memory_address: bytearray, memory_data: int) -> bytearray: def generate_write_mem_command(
""" This function generates the command to write to a memory address within the PLOC object_id: bytearray, memory_address: bytearray, memory_data: int
) -> bytearray:
"""This function generates the command to write to a memory address within the PLOC
@param object_id The object id of the PlocHandler @param object_id The object id of the PlocHandler
@param memory_address The PLOC memory address where to write to. @param memory_address The PLOC memory address where to write to.
@param memory_data The data to write to the memory address specified by the bytearray memory_address. @param memory_data The data to write to the memory address specified by the bytearray memory_address.
""" """
command = object_id + PlocActionIds.tc_mem_write + memory_address + struct.pack('!I', memory_data) command = (
object_id
+ PlocActionIds.tc_mem_write
+ memory_address
+ struct.pack("!I", memory_data)
)
return command return command

View File

@ -17,14 +17,15 @@ from tmtccmd.utility.logger import get_console_logger
LOGGER = get_console_logger() LOGGER = get_console_logger()
latchup_id_dict = { latchup_id_dict = {
"0": "0.85V", "0": "0.85V",
"1": "1.8V", "1": "1.8V",
"2": "MISC", "2": "MISC",
"3": "3.3V", "3": "3.3V",
"4": "NVM_4XO", "4": "NVM_4XO",
"5": "MISSION", "5": "MISSION",
"6": "SAFECOTS" "6": "SAFECOTS",
} }
class SupvActionIds: class SupvActionIds:
HK_REPORT = 1 HK_REPORT = 1
@ -75,34 +76,40 @@ class SupvHkIds:
BOOT_STATUS_REPORT = 53 BOOT_STATUS_REPORT = 53
def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_ploc_supv_test_into(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing PLOC Supervisor with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing PLOC Supervisor with object id: 0x" + object_id.hex(),
)
) )
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: TC Get Hk Report")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: TC Get Hk Report"))
command = object_id + struct.pack('!I', SupvActionIds.HK_REPORT) command = object_id + struct.pack("!I", SupvActionIds.HK_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "4": elif op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Restart MPSoC")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Restart MPSoC"))
command = object_id + struct.pack('!I', SupvActionIds.RESTART_MPSOC) command = object_id + struct.pack("!I", SupvActionIds.RESTART_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "5": elif op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Start MPSoC")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Start MPSoC"))
command = object_id + struct.pack('!I', SupvActionIds.START_MPSOC) command = object_id + struct.pack("!I", SupvActionIds.START_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "6": elif op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Shutdown MPSoC")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Shutdown MPSoC"))
command = object_id + struct.pack('!I', SupvActionIds.SHUTWOWN_MPSOC) command = object_id + struct.pack("!I", SupvActionIds.SHUTWOWN_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "7": elif op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Select MPSoC boot image")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Select MPSoC boot image")
)
mem = int(input("MEM (NVM0 - 0 or NVM1 - 1):")) mem = int(input("MEM (NVM0 - 0 or NVM1 - 1):"))
bp0 = int(input("BP0 (0 or 1):")) bp0 = int(input("BP0 (0 or 1):"))
bp1 = int(input("BP1 (0 or 1):")) bp1 = int(input("BP1 (0 or 1):"))
@ -111,35 +118,49 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "8": elif op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set max restart tries")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set max restart tries")
)
restart_tries = int(input("Set maximum restart tries:")) restart_tries = int(input("Set maximum restart tries:"))
command = object_id + struct.pack('!I', SupvActionIds.SET_MAX_RESTART_TRIES) + struct.pack('!B', restart_tries) command = (
object_id
+ struct.pack("!I", SupvActionIds.SET_MAX_RESTART_TRIES)
+ struct.pack("!B", restart_tries)
)
command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "9": elif op_code == "9":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Reset MPSoC")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Reset MPSoC"))
command = object_id + struct.pack('!I', SupvActionIds.RESET_MPSOC) command = object_id + struct.pack("!I", SupvActionIds.RESET_MPSOC)
command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "10": elif op_code == "10":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set time reference")) tc_queue.appendleft(
command = object_id + struct.pack('!I', SupvActionIds.SET_TIME_REF) (QueueCommands.PRINT, "PLOC Supervisor: Set time reference")
)
command = object_id + struct.pack("!I", SupvActionIds.SET_TIME_REF)
command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "11": elif op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set boot timeout")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set boot timeout"))
boot_timeout = int(input("Specify boot timeout [ms]:")) boot_timeout = int(input("Specify boot timeout [ms]:"))
command = object_id + struct.pack('!I', SupvActionIds.SET_BOOT_TIMEOUT) + struct.pack('!I', boot_timeout) command = (
object_id
+ struct.pack("!I", SupvActionIds.SET_BOOT_TIMEOUT)
+ struct.pack("!I", boot_timeout)
)
command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "12": elif op_code == "12":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable HK")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable HK"))
command = object_id + struct.pack('!I', SupvActionIds.DISABLE_HK) command = object_id + struct.pack("!I", SupvActionIds.DISABLE_HK)
command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "13": elif op_code == "13":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Request boot status report")) tc_queue.appendleft(
command = object_id + struct.pack('!I', SupvActionIds.GET_BOOT_STATUS_REPORT) (QueueCommands.PRINT, "PLOC Supervisor: Request boot status report")
)
command = object_id + struct.pack("!I", SupvActionIds.GET_BOOT_STATUS_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "14": elif op_code == "14":
@ -153,22 +174,30 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "16": elif op_code == "16":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Watchdog configure timeout")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Watchdog configure timeout")
)
command = pack_watchdog_config_timeout_cmd(object_id) command = pack_watchdog_config_timeout_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "17": elif op_code == "17":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enable latchup alert")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Enable latchup alert")
)
command = pack_lachtup_alert_cmd(object_id, True) command = pack_lachtup_alert_cmd(object_id, True)
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "18": elif op_code == "18":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Disable latchup alert")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Disable latchup alert")
)
command = pack_lachtup_alert_cmd(object_id, False) command = pack_lachtup_alert_cmd(object_id, False)
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "19": elif op_code == "19":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Auto calibrate alert")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Auto calibrate alert")
)
command = pack_auto_calibrate_alert_cmd(object_id) command = pack_auto_calibrate_alert_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -178,22 +207,30 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "21": elif op_code == "21":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set alert irq filter")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set alert irq filter")
)
command = pack_set_alert_irq_filter_cmd(object_id) command = pack_set_alert_irq_filter_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "22": elif op_code == "22":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set ADC sweep period")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC sweep period")
)
command = pack_set_adc_sweep_period_cmd(object_id) command = pack_set_adc_sweep_period_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "23": elif op_code == "23":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set ADC enabled channels")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC enabled channels")
)
command = pack_set_adc_enabled_channels_cmd(object_id) command = pack_set_adc_enabled_channels_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "24": elif op_code == "24":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set ADC window and stride")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set ADC window and stride")
)
command = pack_set_adc_window_and_stride_cmd(object_id) command = pack_set_adc_window_and_stride_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -203,17 +240,23 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "26": elif op_code == "26":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Request latchup status report")) tc_queue.appendleft(
command = object_id + struct.pack('!I', SupvActionIds.GET_LATCHUP_STATUS_REPORT) (QueueCommands.PRINT, "PLOC Supervisor: Request latchup status report")
)
command = object_id + struct.pack("!I", SupvActionIds.GET_LATCHUP_STATUS_REPORT)
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "27": elif op_code == "27":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Copy ADC data to MRAM")) tc_queue.appendleft(
command = object_id + struct.pack('!I', SupvActionIds.COPY_ADC_DATA_TO_MRAM) (QueueCommands.PRINT, "PLOC Supervisor: Copy ADC data to MRAM")
)
command = object_id + struct.pack("!I", SupvActionIds.COPY_ADC_DATA_TO_MRAM)
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "28": elif op_code == "28":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Enalbe/Disable NVMs")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Enalbe/Disable NVMs")
)
command = pack_enable_nvms_cmd(object_id) command = pack_enable_nvms_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -238,7 +281,9 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "34": elif op_code == "34":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set debug verbosity")) tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Set debug verbosity")
)
command = pack_set_debug_verbosity_cmd(object_id) command = pack_set_debug_verbosity_cmd(object_id)
command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -253,36 +298,59 @@ def pack_ploc_supv_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "37": elif op_code == "37":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Restart supervisor")) tc_queue.appendleft(
command = command = object_id + struct.pack('!I', SupvActionIds.RESTART_SUPERVISOR) (QueueCommands.PRINT, "PLOC Supervisor: Restart supervisor")
)
command = command = object_id + struct.pack(
"!I", SupvActionIds.RESTART_SUPERVISOR
)
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "38": elif op_code == "38":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear all")) tc_queue.appendleft(
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_ALL) (QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear all")
)
command = command = object_id + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_ALL
)
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "39": elif op_code == "39":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear mirror entries")) tc_queue.appendleft(
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_MIRROR) (QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear mirror entries")
)
command = command = object_id + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_MIRROR
)
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "40": elif op_code == "40":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear circular entries")) tc_queue.appendleft(
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR) (
QueueCommands.PRINT,
"PLOC Supervisor: Factory reset clear circular entries",
)
)
command = command = object_id + struct.pack(
"!I", SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR
)
command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "41": elif op_code == "41":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: CAN loopback test")) tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: CAN loopback test"))
command = command = object_id + struct.pack('!I', SupvActionIds.CAN_LOOPBACK_TEST) command = command = object_id + struct.pack(
"!I", SupvActionIds.CAN_LOOPBACK_TEST
)
command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return tc_queue return tc_queue
def pack_sel_boot_image_cmd(object_id: bytearray, mem: int, bp0: int, bp1: int, bp2: int) -> bytearray: def pack_sel_boot_image_cmd(
""" This function can be used to generate the command to select the image from which the MPSoC will boot object_id: bytearray, mem: int, bp0: int, bp1: int, bp2: int
) -> bytearray:
"""This function can be used to generate the command to select the image from which the MPSoC will boot
@param object_id The object id of the PLOC supervisor handler. @param object_id The object id of the PLOC supervisor handler.
@param mem The memory from which the MPSoC shall boot (NVM0 - 0, NVM1 - 1) @param mem The memory from which the MPSoC shall boot (NVM0 - 0, NVM1 - 1)
@param bp0 Partition pin 0 @param bp0 Partition pin 0
@ -290,11 +358,11 @@ def pack_sel_boot_image_cmd(object_id: bytearray, mem: int, bp0: int, bp1: int,
@param bp2 Partition pin 2 @param bp2 Partition pin 2
""" """
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SEL_MPSOC_BOOT_IMAGE) command = object_id + struct.pack("!I", SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
command = command + struct.pack('!B', mem) command = command + struct.pack("!B", mem)
command = command + struct.pack('!B', bp0) command = command + struct.pack("!B", bp0)
command = command + struct.pack('!B', bp1) command = command + struct.pack("!B", bp1)
command = command + struct.pack('!B', bp2) command = command + struct.pack("!B", bp2)
return command return command
@ -309,12 +377,12 @@ def pack_update_available_cmd(object_id: bytearray) -> bytearray:
image_crc = 0x0 image_crc = 0x0
number_of_packets = 150 number_of_packets = 150
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.UPDATE_AVAILABLE) command = object_id + struct.pack("!I", SupvActionIds.UPDATE_AVAILABLE)
command = command + struct.pack('!B', image_select) command = command + struct.pack("!B", image_select)
command = command + struct.pack('!B', image_partition) command = command + struct.pack("!B", image_partition)
command = command + struct.pack('!I', image_size) command = command + struct.pack("!I", image_size)
command = command + struct.pack('!I', image_crc) command = command + struct.pack("!I", image_crc)
command = command + struct.pack('!I', number_of_packets) command = command + struct.pack("!I", number_of_packets)
return command return command
@ -328,10 +396,10 @@ def pack_watchdogs_enable_cmd(object_id: bytearray) -> bytearray:
watchdog_pl = 1 watchdog_pl = 1
watchdog_int = 0 watchdog_int = 0
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.WATCHDOGS_ENABLE) command = object_id + struct.pack("!I", SupvActionIds.WATCHDOGS_ENABLE)
command = command + struct.pack('!B', watchdog_ps) command = command + struct.pack("!B", watchdog_ps)
command = command + struct.pack('!B', watchdog_pl) command = command + struct.pack("!B", watchdog_pl)
command = command + struct.pack('!B', watchdog_int) command = command + struct.pack("!B", watchdog_int)
return command return command
@ -343,9 +411,9 @@ def pack_watchdog_config_timeout_cmd(object_id: bytearray) -> bytearray:
watchdog = int(input("Specify watchdog (0 - PS, 1 - PL, 2 - INT):")) watchdog = int(input("Specify watchdog (0 - PS, 1 - PL, 2 - INT):"))
timeout = int(input("Specify timeout (1000 ms - 360000 ms):")) timeout = int(input("Specify timeout (1000 ms - 360000 ms):"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.WATCHDOGS_CONFIG_TIMEOUT) command = object_id + struct.pack("!I", SupvActionIds.WATCHDOGS_CONFIG_TIMEOUT)
command = command + struct.pack('!B', watchdog) command = command + struct.pack("!B", watchdog)
command = command + struct.pack('!I', timeout) command = command + struct.pack("!I", timeout)
return command return command
@ -358,10 +426,10 @@ def pack_lachtup_alert_cmd(object_id: bytearray, state: bool) -> bytearray:
latchup_id = get_latchup_id() latchup_id = get_latchup_id()
command = bytearray() command = bytearray()
if state: if state:
command = object_id + struct.pack('!I', SupvActionIds.ENABLE_LATCHUP_ALERT) command = object_id + struct.pack("!I", SupvActionIds.ENABLE_LATCHUP_ALERT)
else: else:
command = object_id + struct.pack('!I', SupvActionIds.DISABLE_LATCHUP_ALERT) command = object_id + struct.pack("!I", SupvActionIds.DISABLE_LATCHUP_ALERT)
command = command + struct.pack('!B', latchup_id) command = command + struct.pack("!B", latchup_id)
return command return command
@ -373,9 +441,9 @@ def pack_auto_calibrate_alert_cmd(object_id: bytearray) -> bytearray:
latchup_id = get_latchup_id() latchup_id = get_latchup_id()
mg = int(input("Specify MG:")) mg = int(input("Specify MG:"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.AUTO_CALIBRATE_ALERT) command = object_id + struct.pack("!I", SupvActionIds.AUTO_CALIBRATE_ALERT)
command = command + struct.pack('!B', latchup_id) command = command + struct.pack("!B", latchup_id)
command = command + struct.pack('!I', mg) command = command + struct.pack("!I", mg)
return command return command
@ -403,9 +471,9 @@ def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray:
latchup_id = get_latchup_id() latchup_id = get_latchup_id()
dutycycle = int(input("Specify dutycycle:")) dutycycle = int(input("Specify dutycycle:"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ALERT_LIMIT) command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_LIMIT)
command = command + struct.pack('!B', latchup_id) command = command + struct.pack("!B", latchup_id)
command = command + struct.pack('!I', dutycycle) command = command + struct.pack("!I", dutycycle)
return command return command
@ -418,10 +486,10 @@ def pack_set_alert_irq_filter_cmd(object_id: bytearray) -> bytearray:
tp = int(input("Specify filter type (TP):")) tp = int(input("Specify filter type (TP):"))
div = int(input("Specify clock divider (DIV):")) div = int(input("Specify clock divider (DIV):"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ALERT_IRQ_FILTER) command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_IRQ_FILTER)
command = command + struct.pack('!B', latchup_id) command = command + struct.pack("!B", latchup_id)
command = command + struct.pack('!B', tp) command = command + struct.pack("!B", tp)
command = command + struct.pack('!B', div) command = command + struct.pack("!B", div)
return command return command
@ -432,8 +500,8 @@ def pack_set_adc_sweep_period_cmd(object_id: bytearray) -> bytearray:
""" """
sweep_period = int(input("Specify sweep period (min 21 us):")) sweep_period = int(input("Specify sweep period (min 21 us):"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_SWEEP_PERIOD) command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_SWEEP_PERIOD)
command = command + struct.pack('!I', sweep_period) command = command + struct.pack("!I", sweep_period)
return command return command
@ -444,8 +512,8 @@ def pack_set_adc_enabled_channels_cmd(object_id: bytearray) -> bytearray:
""" """
ch = int(input("Specify ch:")) ch = int(input("Specify ch:"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_ENABLED_CHANNELS) command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS)
command = command + struct.pack('!H', ch) command = command + struct.pack("!H", ch)
return command return command
@ -453,17 +521,17 @@ def pack_set_adc_window_and_stride_cmd(object_id: bytearray) -> bytearray:
window_size = int(input("Specify window size:")) window_size = int(input("Specify window size:"))
striding_step_size = int(input("Specify striding step size:")) striding_step_size = int(input("Specify striding step size:"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_WINDOW_AND_STRIDE) command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
command = command + struct.pack('!H', window_size) command = command + struct.pack("!H", window_size)
command = command + struct.pack('!H', striding_step_size) command = command + struct.pack("!H", striding_step_size)
return command return command
def pack_set_adc_threshold_cmd(object_id: bytearray) -> bytearray: def pack_set_adc_threshold_cmd(object_id: bytearray) -> bytearray:
threshold = int(input("Specify threshold:")) threshold = int(input("Specify threshold:"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_THRESHOLD) command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_THRESHOLD)
command = command + struct.pack('!I', threshold) command = command + struct.pack("!I", threshold)
return command return command
@ -471,25 +539,25 @@ def pack_enable_nvms_cmd(object_id: bytearray) -> bytearray:
n01 = int(input("NVM0/1 (0 - off, 1 - on):")) n01 = int(input("NVM0/1 (0 - off, 1 - on):"))
n3 = int(input("NVM3 (0 - off, 1 - on):")) n3 = int(input("NVM3 (0 - off, 1 - on):"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.ENABLE_NVMS) command = object_id + struct.pack("!I", SupvActionIds.ENABLE_NVMS)
command = command + struct.pack('!B', n01) command = command + struct.pack("!B", n01)
command = command + struct.pack('!B', n3) command = command + struct.pack("!B", n3)
return command return command
def pack_select_nvm_cmd(object_id: bytearray) -> bytearray: def pack_select_nvm_cmd(object_id: bytearray) -> bytearray:
mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1):")) mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1):"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SELECT_NVM) command = object_id + struct.pack("!I", SupvActionIds.SELECT_NVM)
command = command + struct.pack('!B', mem) command = command + struct.pack("!B", mem)
return command return command
def pack_auto_em_tests_cmd(object_id: bytearray) -> bytearray: def pack_auto_em_tests_cmd(object_id: bytearray) -> bytearray:
test = int(input("Specify test (1 - complete, 2 - short):")) test = int(input("Specify test (1 - complete, 2 - short):"))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.RUN_AUTO_EM_TESTS) command = object_id + struct.pack("!I", SupvActionIds.RUN_AUTO_EM_TESTS)
command = command + struct.pack('!B', test) command = command + struct.pack("!B", test)
return command return command
@ -497,25 +565,25 @@ def pack_mram_wipe_cmd(object_id: bytearray) -> bytearray:
start = int(input("Start address: 0x"), 16) start = int(input("Start address: 0x"), 16)
stop = int(input("Stop address: 0x"), 16) stop = int(input("Stop address: 0x"), 16)
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.WIPE_MRAM) command = object_id + struct.pack("!I", SupvActionIds.WIPE_MRAM)
command = command + struct.pack('!I', start) command = command + struct.pack("!I", start)
command = command + struct.pack('!I', stop) command = command + struct.pack("!I", stop)
return command return command
def pack_print_cpu_stats_cmd(object_id: bytearray) -> bytearray: def pack_print_cpu_stats_cmd(object_id: bytearray) -> bytearray:
en = 1 en = 1
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.PRINT_CPU_STATS) command = object_id + struct.pack("!I", SupvActionIds.PRINT_CPU_STATS)
command = command + struct.pack('!B', en) command = command + struct.pack("!B", en)
return command return command
def pack_set_debug_verbosity_cmd(object_id: bytearray) -> bytearray: def pack_set_debug_verbosity_cmd(object_id: bytearray) -> bytearray:
command = bytearray() command = bytearray()
verbosity = get_debug_verbosity() verbosity = get_debug_verbosity()
command = object_id + struct.pack('!I', SupvActionIds.SET_DBG_VERBOSITY) command = object_id + struct.pack("!I", SupvActionIds.SET_DBG_VERBOSITY)
command = command + struct.pack('!B', verbosity) command = command + struct.pack("!B", verbosity)
return command return command
@ -530,7 +598,7 @@ def get_debug_verbosity() -> int:
2: "Warn", 2: "Warn",
3: "Info", 3: "Info",
} }
print("{:<6} | {}".format('Key', 'Description')) print("{:<6} | {}".format("Key", "Description"))
for entry in verbosity_options_dict.items(): for entry in verbosity_options_dict.items():
print("{:<6} | {}".format(entry[0], entry[1])) print("{:<6} | {}".format(entry[0], entry[1]))
verbosity = int(input("Specify verbosity key: ")) verbosity = int(input("Specify verbosity key: "))
@ -549,10 +617,10 @@ def pack_set_gpio_cmd(object_id: bytearray) -> bytearray:
pin = int(input("Specify pin: ")) pin = int(input("Specify pin: "))
val = int(input("Specify val: ")) val = int(input("Specify val: "))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_GPIO) command = object_id + struct.pack("!I", SupvActionIds.SET_GPIO)
command = command + struct.pack('!B', port) command = command + struct.pack("!B", port)
command = command + struct.pack('!B', pin) command = command + struct.pack("!B", pin)
command = command + struct.pack('!B', val) command = command + struct.pack("!B", val)
return command return command
@ -560,9 +628,7 @@ def pack_read_gpio_cmd(object_id: bytearray) -> bytearray:
port = int(input("Specify port: ")) port = int(input("Specify port: "))
pin = int(input("Specify pin: ")) pin = int(input("Specify pin: "))
command = bytearray() command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.READ_GPIO) command = object_id + struct.pack("!I", SupvActionIds.READ_GPIO)
command = command + struct.pack('!B', port) command = command + struct.pack("!B", port)
command = command + struct.pack('!B', pin) command = command + struct.pack("!B", pin)
return command return command

View File

@ -22,7 +22,7 @@ latchup_id_dict = {
"3": "3.3V", "3": "3.3V",
"4": "NVM_4XO", "4": "NVM_4XO",
"5": "MISSION", "5": "MISSION",
"6": "SAFECOTS" "6": "SAFECOTS",
} }
@ -48,57 +48,101 @@ class ImagePathDefs:
imageBappsw = "/mnt/sd0/ploc/updateBappsw.bin" imageBappsw = "/mnt/sd0/ploc/updateBappsw.bin"
def pack_ploc_updater_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_ploc_updater_test_into(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing PLOC updater with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing PLOC updater with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition A")) tc_queue.appendleft(
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_UBOOT) + \ (QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition A")
bytearray(ImagePathDefs.imageAuboot, 'utf-8') )
command = (
object_id
+ struct.pack("!I", UpdaterActionIds.UPDATE_A_UBOOT)
+ bytearray(ImagePathDefs.imageAuboot, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1": if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition A")) tc_queue.appendleft(
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_BITSTREAM) + \ (QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition A")
bytearray(ImagePathDefs.imageAbitsream, 'utf-8') )
command = (
object_id
+ struct.pack("!I", UpdaterActionIds.UPDATE_A_BITSTREAM)
+ bytearray(ImagePathDefs.imageAbitsream, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2": if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition A")) tc_queue.appendleft(
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_LINUX) + \ (QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition A")
bytearray(ImagePathDefs.imageAlinux, 'utf-8') )
command = (
object_id
+ struct.pack("!I", UpdaterActionIds.UPDATE_A_LINUX)
+ bytearray(ImagePathDefs.imageAlinux, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update application on partition A")) tc_queue.appendleft(
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_APP_SW) + \ (QueueCommands.PRINT, "PLOC Supervisor: Update application on partition A")
bytearray(ImagePathDefs.imageAappsw, 'utf-8') )
command = (
object_id
+ struct.pack("!I", UpdaterActionIds.UPDATE_A_APP_SW)
+ bytearray(ImagePathDefs.imageAappsw, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4": if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition B")) tc_queue.appendleft(
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_UBOOT) + \ (QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition B")
bytearray(ImagePathDefs.imageBuboot, 'utf-8') )
command = (
object_id
+ struct.pack("!I", UpdaterActionIds.UPDATE_B_UBOOT)
+ bytearray(ImagePathDefs.imageBuboot, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5": if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition B")) tc_queue.appendleft(
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_BITSTREAM) + \ (QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition B")
bytearray(ImagePathDefs.imageBbitsream, 'utf-8') )
command = (
object_id
+ struct.pack("!I", UpdaterActionIds.UPDATE_B_BITSTREAM)
+ bytearray(ImagePathDefs.imageBbitsream, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6": if op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition B")) tc_queue.appendleft(
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_LINUX) + \ (QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition B")
bytearray(ImagePathDefs.imageBlinux, 'utf-8') )
command = (
object_id
+ struct.pack("!I", UpdaterActionIds.UPDATE_B_LINUX)
+ bytearray(ImagePathDefs.imageBlinux, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7": if op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update application on partition B")) tc_queue.appendleft(
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_APP_SW) + \ (QueueCommands.PRINT, "PLOC Supervisor: Update application on partition B")
bytearray(ImagePathDefs.imageBappsw, 'utf-8') )
command = (
object_id
+ struct.pack("!I", UpdaterActionIds.UPDATE_B_APP_SW)
+ bytearray(ImagePathDefs.imageBappsw, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -13,10 +13,14 @@ from spacepackets.ecss.tc import PusTelecommand
from pus_tc.service_200_mode import pack_mode_data from pus_tc.service_200_mode import pack_mode_data
def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_rad_sensor_test_into(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing radiation sensor handler with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing radiation sensor handler with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
@ -35,4 +39,4 @@ def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode off")) tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Switch to mode off"))
mode_data = pack_mode_data(object_id, 0, 0) mode_data = pack_mode_data(object_id, 0, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data) command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -38,10 +38,14 @@ class RampTime:
MS_1000 = 1000 MS_1000 = 1000
def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_single_rw_test_into(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing reaction wheel handler with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing reaction wheel handler with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0" or op_code == "1": if op_code == "0" or op_code == "1":
@ -59,7 +63,9 @@ def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3": if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Switch to mode normal")) tc_queue.appendleft(
(QueueCommands.PRINT, "Reaction Wheel: Switch to mode normal")
)
mode_data = pack_mode_data(object_id, 2, 0) mode_data = pack_mode_data(object_id, 2, 0)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data) command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -71,15 +77,19 @@ def pack_single_rw_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code:
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5": if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "Reaction Wheel: Send get-telemetry-command")) tc_queue.appendleft(
(QueueCommands.PRINT, "Reaction Wheel: Send get-telemetry-command")
)
command = object_id + RwCommandIds.GET_TM command = object_id + RwCommandIds.GET_TM
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
return tc_queue return tc_queue
def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) -> bytearray: def pack_set_speed_command(
""" With this function a command is packed to set the speed of a reaction wheel object_id: bytearray, speed: int, ramp_time: int
) -> bytearray:
"""With this function a command is packed to set the speed of a reaction wheel
@param object_id The object id of the reaction wheel handler. @param object_id The object id of the reaction wheel handler.
@param speed Valid speeds are [-65000, -1000] and [1000, 65000]. Values are specified in 0.1 * RPM @param speed Valid speeds are [-65000, -1000] and [1000, 65000]. Values are specified in 0.1 * RPM
@param ramp_time The time after which the reaction wheel will reached the commanded speed. Valid times are @param ramp_time The time after which the reaction wheel will reached the commanded speed. Valid times are
@ -88,6 +98,6 @@ def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) ->
command_id = RwCommandIds.SET_SPEED command_id = RwCommandIds.SET_SPEED
command = bytearray() command = bytearray()
command = object_id + command_id command = object_id + command_id
command = command + struct.pack('!i', speed) command = command + struct.pack("!i", speed)
command = command + ramp_time.to_bytes(length=2, byteorder='big') command = command + ramp_time.to_bytes(length=2, byteorder="big")
return command return command

View File

@ -88,10 +88,14 @@ class PartitionSize:
FREE_2 = 896000 FREE_2 = 896000
def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_star_tracker_commands(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Generate command for star tracker with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Generate command for star tracker with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
@ -116,164 +120,224 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4": if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Ping")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Ping"))
command = object_id + struct.pack('!I', StarTrackerActionIds.PING) command = object_id + struct.pack("!I", StarTrackerActionIds.PING)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5": if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Switch to bootloader program")) tc_queue.appendleft(
command = object_id + struct.pack('!I', StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM) (QueueCommands.PRINT, "Star tracker: Switch to bootloader program")
)
command = object_id + struct.pack(
"!I", StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM
)
command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6": if op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Temperature request")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Temperature request"))
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_TEMPERATURE) command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TEMPERATURE)
command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7": if op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request version")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request version"))
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_VERSION) command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_VERSION)
command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8": if op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request interface")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request interface"))
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_INTERFACE) command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_INTERFACE)
command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "9": if op_code == "9":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request power")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request power"))
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_POWER) command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_POWER)
command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "10": if op_code == "10":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Subscribe to telemetry")) tc_queue.appendleft(
(QueueCommands.PRINT, "Star tracker: Subscribe to telemetry")
)
tm_id = int(input("Specify Id of tm: ")) tm_id = int(input("Specify Id of tm: "))
command = object_id + struct.pack('!I', StarTrackerActionIds.SUBSCRIBE_TO_TM) + struct.pack('B', tm_id) command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.SUBSCRIBE_TO_TM)
+ struct.pack("B", tm_id)
)
command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "11": if op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Boot")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Boot"))
command = object_id + struct.pack('!I', StarTrackerActionIds.BOOT) command = object_id + struct.pack("!I", StarTrackerActionIds.BOOT)
command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=37, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "12": if op_code == "12":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request time")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request time"))
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_TIME) command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_TIME)
command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "13": if op_code == "13":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request solution")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request solution"))
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_SOLUTION) command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_SOLUTION)
command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "14": if op_code == "14":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload image")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload image"))
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_IMAGE) + \ command = (
bytearray(ImagePathDefs.uploadFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_IMAGE)
+ bytearray(ImagePathDefs.uploadFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "15": if op_code == "15":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download image")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download image"))
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_IMAGE) + \ command = (
bytearray(ImagePathDefs.downloadPath, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_IMAGE)
+ bytearray(ImagePathDefs.downloadPath, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "16": if op_code == "16":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set limits")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set limits"))
command = object_id + struct.pack('!I', StarTrackerActionIds.LIMITS) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.LIMITS)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "17": if op_code == "17":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set tracking parameters")) tc_queue.appendleft(
command = object_id + struct.pack('!I', StarTrackerActionIds.TRACKING) + \ (QueueCommands.PRINT, "Star tracker: Set tracking parameters")
bytearray(ImagePathDefs.jsonFile, 'utf-8') )
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.TRACKING)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "18": if op_code == "18":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mounting")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mounting"))
command = object_id + struct.pack('!I', StarTrackerActionIds.MOUNTING) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.MOUNTING)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "19": if op_code == "19":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Camera")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Camera"))
command = object_id + struct.pack('!I', StarTrackerActionIds.CAMERA) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "20": if op_code == "20":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Blob")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Blob"))
command = object_id + struct.pack('!I', StarTrackerActionIds.BLOB) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.BLOB)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "21": if op_code == "21":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Centroiding")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Centroiding"))
command = object_id + struct.pack('!I', StarTrackerActionIds.CENTROIDING) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.CENTROIDING)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "22": if op_code == "22":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: LISA")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: LISA"))
command = object_id + struct.pack('!I', StarTrackerActionIds.LISA) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.LISA)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "23": if op_code == "23":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Matching")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Matching"))
command = object_id + struct.pack('!I', StarTrackerActionIds.MATCHING) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.MATCHING)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "24": if op_code == "24":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Validation")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Validation"))
command = object_id + struct.pack('!I', StarTrackerActionIds.VALIDATION) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.VALIDATION)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=50, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=50, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "25": if op_code == "25":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo"))
command = object_id + struct.pack('!I', StarTrackerActionIds.ALGO) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.ALGO)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "26": if op_code == "26":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Take image")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Take image"))
actionid = int(input("Specify parameter ID (nominal - 4): ")) actionid = int(input("Specify parameter ID (nominal - 4): "))
command = object_id + struct.pack('!I', StarTrackerActionIds.TAKE_IMAGE) + struct.pack('!B', actionid) command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.TAKE_IMAGE)
+ struct.pack("!B", actionid)
)
command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=52, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "27": if op_code == "27":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Stop str helper")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Stop str helper"))
command = object_id + struct.pack('!I', StarTrackerActionIds.STOP_STR_HELPER) command = object_id + struct.pack("!I", StarTrackerActionIds.STOP_STR_HELPER)
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "28": if op_code == "28":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Reset error signal")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Reset error signal"))
command = object_id + struct.pack('!I', StarTrackerActionIds.RESET_ERROR) command = object_id + struct.pack("!I", StarTrackerActionIds.RESET_ERROR)
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "29": if op_code == "29":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set name of download image")) tc_queue.appendleft(
(QueueCommands.PRINT, "Star tracker: Set name of download image")
)
filename = input("Specify download image name: ") filename = input("Specify download image name: ")
command = object_id + struct.pack('!I', StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE) + \ command = (
bytearray(filename, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE)
+ bytearray(filename, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "30": if op_code == "30":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request histogram")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request histogram"))
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_HISTOGRAM) command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_HISTOGRAM)
command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=55, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "31": if op_code == "31":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request contrast")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Request contrast"))
command = object_id + struct.pack('!I', StarTrackerActionIds.REQ_CONTRAST) command = object_id + struct.pack("!I", StarTrackerActionIds.REQ_CONTRAST)
command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=56, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "32": if op_code == "32":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set json filename")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set json filename"))
command = object_id + struct.pack('!I', StarTrackerActionIds.SET_JSON_FILE_NAME) + \ command = (
bytearray(ImagePathDefs.jsonFile, 'utf-8') 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) command = PusTelecommand(service=8, subservice=128, ssc=57, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "33": if op_code == "33":
@ -289,7 +353,11 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
if op_code == "35": if op_code == "35":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set read filename")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set read filename"))
filename = input("Specify filename: ") filename = input("Specify filename: ")
command = object_id + StarTrackerActionIds.SET_READ_FILENAME + bytearray(filename, 'utf-8') command = (
object_id
+ StarTrackerActionIds.SET_READ_FILENAME
+ bytearray(filename, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=60, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=60, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "36": if op_code == "36":
@ -300,68 +368,107 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
if op_code == "37": if op_code == "37":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set time")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set time"))
unix_time = 1640783543 unix_time = 1640783543
command = object_id + struct.pack('!I', StarTrackerActionIds.SET_TIME) + struct.pack('!Q', unix_time) 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) command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "38": if op_code == "38":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Centroid")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Centroid"))
id = 0 id = 0
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_CENTROID) + struct.pack('!B', id) command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_CENTROID)
+ struct.pack("!B", id)
)
command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "39": if op_code == "39":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload Centroid")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload Centroid"))
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_CENTROID) + \ command = (
bytearray(ImagePathDefs.uploadCentroidJson, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_CENTROID)
+ bytearray(ImagePathDefs.uploadCentroidJson, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=63, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=63, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "40": if op_code == "40":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download matched star")) tc_queue.appendleft(
(QueueCommands.PRINT, "Star tracker: Download matched star")
)
id = 0 id = 0
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_MATCHED_STAR) + \ command = (
struct.pack('!B', id) object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_MATCHED_STAR)
+ struct.pack("!B", id)
)
command = PusTelecommand(service=8, subservice=128, ssc=64, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=64, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "41": if op_code == "41":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download DB Image")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download DB Image"))
id = 0 id = 0
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_DBIMAGE) + \ command = (
struct.pack('!B', id) object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_DBIMAGE)
+ struct.pack("!B", id)
)
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "42": if op_code == "42":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Blob Pixel")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Blob Pixel"))
id = 0 id = 0
type = 1 # 0 - normal, 1 - fast type = 1 # 0 - normal, 1 - fast
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_BLOBPIXEL) + \ command = (
struct.pack('!B', id) + struct.pack('!B', type) 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) command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "43": if op_code == "43":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download FPGA Image")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download FPGA Image"))
position = 0 position = 0
length = 4100 length = 4100
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE) + \ command = (
struct.pack('!I', position) + struct.pack('!I', length) + bytearray( object_id
ImagePathDefs.downloadFpgaImagePath, 'utf-8') + 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) command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "44": if op_code == "44":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Chnage donwload FPGA image file name")) tc_queue.appendleft(
command = object_id + struct.pack('!I', StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE) + \ (QueueCommands.PRINT, "Star tracker: Chnage donwload FPGA image file name")
bytearray(ImagePathDefs.downloadFpgaImageName, 'utf-8') )
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) command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "45": if op_code == "45":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload FPGA image")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload FPGA image"))
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_FPGA_IMAGE) + \ command = (
bytearray(ImagePathDefs.uploadFpgaImageName, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_FPGA_IMAGE)
+ bytearray(ImagePathDefs.uploadFpgaImageName, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=68, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "46": if op_code == "46":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: FPGA action")) tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: FPGA action"))
id = 3 id = 3
command = object_id + struct.pack('!I', StarTrackerActionIds.FPGA_ACTION) + struct.pack('!B', id) command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.FPGA_ACTION)
+ struct.pack("!B", id)
)
command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=69, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
@ -369,8 +476,13 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
def pack_write_command(object_id: bytearray) -> bytearray: def pack_write_command(object_id: bytearray) -> bytearray:
region = Region.FREE_1 region = Region.FREE_1
address = 0 address = 0
command = object_id + struct.pack('!I', StarTrackerActionIds.WRITE) + struct.pack('!B', region) + \ command = (
struct.pack('!I', address) + bytearray(ImagePathDefs.flashFile, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.WRITE)
+ struct.pack("!B", region)
+ struct.pack("!I", address)
+ bytearray(ImagePathDefs.flashFile, "utf-8")
)
return command return command
@ -378,8 +490,14 @@ def pack_read_command(object_id: bytearray) -> bytearray:
region = Region.STAR_TRACKER_FIRMWARE region = Region.STAR_TRACKER_FIRMWARE
address = 0 address = 0
size = PartitionSize.STAR_TRACKER_FIRMWARE size = PartitionSize.STAR_TRACKER_FIRMWARE
command = object_id + struct.pack('!I', StarTrackerActionIds.READ) + struct.pack('!B', region) + \ command = (
struct.pack('!I', address) + struct.pack('!I', size) + bytearray(ImagePathDefs.flashReadPath, 'utf-8') object_id
+ struct.pack("!I", StarTrackerActionIds.READ)
+ struct.pack("!B", region)
+ struct.pack("!I", address)
+ struct.pack("!I", size)
+ bytearray(ImagePathDefs.flashReadPath, "utf-8")
)
return command return command
@ -387,6 +505,11 @@ def pack_checksum_command(object_id: bytearray) -> bytearray:
region = Region.STAR_TRACKER_FIRMWARE region = Region.STAR_TRACKER_FIRMWARE
address = 0 address = 0
size = PartitionSize.STAR_TRACKER_FIRMWARE size = PartitionSize.STAR_TRACKER_FIRMWARE
command = object_id + struct.pack('!I', StarTrackerActionIds.CHECKSUM) + struct.pack('!B', region) + \ command = (
struct.pack('!I', address) + struct.pack('!I', size) object_id
+ struct.pack("!I", StarTrackerActionIds.CHECKSUM)
+ struct.pack("!B", region)
+ struct.pack("!I", address)
+ struct.pack("!I", size)
)
return command return command

View File

@ -25,14 +25,24 @@ class ImagePathDefs:
uploadFile = "/mnt/sd0/startracker/gemma.bin" uploadFile = "/mnt/sd0/startracker/gemma.bin"
def pack_str_img_helper_command(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_str_img_helper_command(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing star tracker image helper object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing star tracker image helper object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker image helper: Upload image")) tc_queue.appendleft(
command = object_id + struct.pack('!I', Commands.UPLOAD_IMAGE) + bytearray(ImagePathDefs.uploadFile, 'utf-8') (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) command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -27,10 +27,14 @@ class CommandIds:
READ_TX_AGC_VALUE_LOW_BYTE = bytearray([0x0, 0x0, 0x0, 0x9]) READ_TX_AGC_VALUE_LOW_BYTE = bytearray([0x0, 0x0, 0x0, 0x9])
def pack_syrlinks_command(object_id: bytearray, tc_queue: TcQueueT, op_code: str) -> TcQueueT: def pack_syrlinks_command(
object_id: bytearray, tc_queue: TcQueueT, op_code: str
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing PLOC memory dumper with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing PLOC memory dumper with object id: 0x" + object_id.hex(),
)
) )
if op_code == "0": if op_code == "0":
@ -69,12 +73,16 @@ def pack_syrlinks_command(object_id: bytearray, tc_queue: TcQueueT, op_code: str
command = PusTelecommand(service=8, subservice=128, ssc=14, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=14, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7": if op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX AGC value high byte")) tc_queue.appendleft(
(QueueCommands.PRINT, "Syrlinks: Read TX AGC value high byte")
)
command = object_id + CommandIds.READ_TX_AGC_VALUE_HIGH_BYTE command = object_id + CommandIds.READ_TX_AGC_VALUE_HIGH_BYTE
command = PusTelecommand(service=8, subservice=128, ssc=15, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=15, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8": if op_code == "8":
tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read TX AGC value low byte")) tc_queue.appendleft(
(QueueCommands.PRINT, "Syrlinks: Read TX AGC value low byte")
)
command = object_id + CommandIds.READ_TX_AGC_VALUE_LOW_BYTE command = object_id + CommandIds.READ_TX_AGC_VALUE_LOW_BYTE
command = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -32,62 +32,109 @@ from pus_tc.gps import pack_gps_command
from pus_tc.acs import pack_acs_command from pus_tc.acs import pack_acs_command
from pus_tc.str_img_helper import pack_str_img_helper_command from pus_tc.str_img_helper import pack_str_img_helper_command
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, \ from config.object_ids import (
ACU_HANDLER_ID, TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, \ P60_DOCK_HANDLER,
PLOC_MPSOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID, \ PDU_1_HANDLER_ID,
STAR_TRACKER_ID, PLOC_MEMORY_DUMPER_ID, GPS_HANDLER_0_ID, GPS_HANDLER_1_ID, CCSDS_HANDLER_ID, \ PDU_2_HANDLER_ID,
PDEC_HANDLER_ID, STR_IMG_HELPER_ID, SYRLINKS_HANDLER_ID ACU_HANDLER_ID,
TMP_1075_1_HANDLER_ID,
TMP_1075_2_HANDLER_ID,
HEATER_ID,
IMTQ_HANDLER_ID,
PLOC_MPSOC_ID,
RW1_ID,
RW2_ID,
RW3_ID,
RW4_ID,
RAD_SENSOR_ID,
PLOC_SUPV_ID,
PLOC_UPDATER_ID,
STAR_TRACKER_ID,
PLOC_MEMORY_DUMPER_ID,
GPS_HANDLER_0_ID,
GPS_HANDLER_1_ID,
CCSDS_HANDLER_ID,
PDEC_HANDLER_ID,
STR_IMG_HELPER_ID,
SYRLINKS_HANDLER_ID,
)
LOGGER = get_console_logger() LOGGER = get_console_logger()
def pack_service_queue_user(service: Union[str, int], op_code: str, service_queue: TcQueueT): def pack_service_queue_user(
service: Union[str, int], op_code: str, service_queue: TcQueueT
):
if service == CoreServiceList.SERVICE_5.value: if service == CoreServiceList.SERVICE_5.value:
return pack_generic_service5_test_into(tc_queue=service_queue) return pack_generic_service5_test_into(tc_queue=service_queue)
if service == CoreServiceList.SERVICE_17.value: if service == CoreServiceList.SERVICE_17.value:
return service_queue.appendleft(pack_service_17_ping_command(ssc=1700).pack_command_tuple()) return service_queue.appendleft(
pack_service_17_ping_command(ssc=1700).pack_command_tuple()
)
if service == CoreServiceList.SERVICE_200.value: if service == CoreServiceList.SERVICE_200.value:
return pack_service200_test_into(tc_queue=service_queue) return pack_service200_test_into(tc_queue=service_queue)
if service == CustomServiceList.P60DOCK.value: if service == CustomServiceList.P60DOCK.value:
object_id = P60_DOCK_HANDLER object_id = P60_DOCK_HANDLER
return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_p60dock_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PDU1.value: if service == CustomServiceList.PDU1.value:
object_id = PDU_1_HANDLER_ID object_id = PDU_1_HANDLER_ID
return pack_pdu1_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_pdu1_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PDU2.value: if service == CustomServiceList.PDU2.value:
object_id = PDU_2_HANDLER_ID object_id = PDU_2_HANDLER_ID
return pack_pdu2_commands(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_pdu2_commands(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.ACU.value: if service == CustomServiceList.ACU.value:
object_id = ACU_HANDLER_ID object_id = ACU_HANDLER_ID
return pack_acu_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_acu_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.TMP1075_1.value: if service == CustomServiceList.TMP1075_1.value:
object_id = TMP_1075_1_HANDLER_ID object_id = TMP_1075_1_HANDLER_ID
return pack_tmp1075_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_tmp1075_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.TMP1075_2.value: if service == CustomServiceList.TMP1075_2.value:
object_id = TMP_1075_2_HANDLER_ID object_id = TMP_1075_2_HANDLER_ID
return pack_tmp1075_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_tmp1075_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.HEATER.value: if service == CustomServiceList.HEATER.value:
object_id = HEATER_ID object_id = HEATER_ID
return pack_heater_test_into(object_id=object_id, tc_queue=service_queue) return pack_heater_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.IMTQ.value: if service == CustomServiceList.IMTQ.value:
object_id = IMTQ_HANDLER_ID object_id = IMTQ_HANDLER_ID
return pack_imtq_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_imtq_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PLOC.value: if service == CustomServiceList.PLOC.value:
object_id = PLOC_MPSOC_ID object_id = PLOC_MPSOC_ID
return pack_ploc_mpsoc_test_into(object_id=object_id, tc_queue=service_queue) return pack_ploc_mpsoc_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.REACTION_WHEEL_1.value: if service == CustomServiceList.REACTION_WHEEL_1.value:
object_id = RW1_ID object_id = RW1_ID
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_single_rw_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.REACTION_WHEEL_2.value: if service == CustomServiceList.REACTION_WHEEL_2.value:
object_id = RW2_ID object_id = RW2_ID
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_single_rw_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.REACTION_WHEEL_3.value: if service == CustomServiceList.REACTION_WHEEL_3.value:
object_id = RW3_ID object_id = RW3_ID
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_single_rw_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.REACTION_WHEEL_4.value: if service == CustomServiceList.REACTION_WHEEL_4.value:
object_id = RW4_ID object_id = RW4_ID
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code) return pack_single_rw_test_into(
object_id=object_id, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.RAD_SENSOR.value: if service == CustomServiceList.RAD_SENSOR.value:
object_id = RAD_SENSOR_ID object_id = RAD_SENSOR_ID
return pack_rad_sensor_test_into( return pack_rad_sensor_test_into(
@ -123,15 +170,25 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
if service == CustomServiceList.ACS.value: if service == CustomServiceList.ACS.value:
return pack_acs_command(tc_queue=service_queue, op_code=op_code) return pack_acs_command(tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.GPS_0.value: if service == CustomServiceList.GPS_0.value:
return pack_gps_command(object_id=GPS_HANDLER_0_ID, tc_queue=service_queue, op_code=op_code) return pack_gps_command(
object_id=GPS_HANDLER_0_ID, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.GPS_1.value: if service == CustomServiceList.GPS_1.value:
return pack_gps_command(object_id=GPS_HANDLER_1_ID, tc_queue=service_queue, op_code=op_code) return pack_gps_command(
object_id=GPS_HANDLER_1_ID, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.CCSDS_HANDLER.value: if service == CustomServiceList.CCSDS_HANDLER.value:
return pack_ccsds_handler_test(object_id=CCSDS_HANDLER_ID, tc_queue=service_queue, op_code=op_code) return pack_ccsds_handler_test(
object_id=CCSDS_HANDLER_ID, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.PDEC_HANDLER.value: if service == CustomServiceList.PDEC_HANDLER.value:
return pack_ccsds_handler_test(object_id=PDEC_HANDLER_ID, tc_queue=service_queue, op_code=op_code) return pack_ccsds_handler_test(
object_id=PDEC_HANDLER_ID, tc_queue=service_queue, op_code=op_code
)
if service == CustomServiceList.SYRLINKS.value: if service == CustomServiceList.SYRLINKS.value:
return pack_syrlinks_command(object_id=SYRLINKS_HANDLER_ID, tc_queue=service_queue, op_code=op_code) return pack_syrlinks_command(
object_id=SYRLINKS_HANDLER_ID, tc_queue=service_queue, op_code=op_code
)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")

View File

@ -18,10 +18,13 @@ class Tmp1075TestProcedure:
@details Setting all to True will run all tests. @details Setting all to True will run all tests.
Setting all to False will only run the tests set to True. Setting all to False will only run the tests set to True.
""" """
all = False all = False
start_adc_conversion = False start_adc_conversion = False
get_temp = False get_temp = False
set_mode_normal = True # Setting mode to normal starts continuous temperature reading set_mode_normal = (
True # Setting mode to normal starts continuous temperature reading
)
set_mode_on = False # If mode is MODE_ON, temperature will only be read on command set_mode_on = False # If mode is MODE_ON, temperature will only be read on command
@ -30,14 +33,21 @@ class Tmp1075ActionIds:
start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02]) start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02])
def pack_tmp1075_test_into(object_id: bytearray, op_code: str, tc_queue: TcQueueT) -> TcQueueT: def pack_tmp1075_test_into(
object_id: bytearray, op_code: str, tc_queue: TcQueueT
) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (
"Testing Tmp1075 Temperature Sensor Handler with object id: 0x" + object_id.hex()) QueueCommands.PRINT,
"Testing Tmp1075 Temperature Sensor Handler with object id: 0x"
+ object_id.hex(),
)
) )
if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion: if Tmp1075TestProcedure.all or Tmp1075TestProcedure.start_adc_conversion:
tc_queue.appendleft((QueueCommands.PRINT, "TMP1075: Starting new temperature conversion")) tc_queue.appendleft(
(QueueCommands.PRINT, "TMP1075: Starting new temperature conversion")
)
command = object_id + Tmp1075ActionIds.start_adc_conversion command = object_id + Tmp1075ActionIds.start_adc_conversion
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())

View File

@ -11,14 +11,16 @@ from tmtccmd.pus.service_1_verification import Service1TMExtended
from tmtccmd.pus.service_17_test import Service17TMExtended from tmtccmd.pus.service_17_test import Service17TMExtended
from tmtccmd.tm.service_3_housekeeping import Service3TM from tmtccmd.tm.service_3_housekeeping import Service3TM
from tmtccmd.tm.service_5_event import Service5TM from tmtccmd.tm.service_5_event import Service5TM
from tmtccmd.utility.tmtc_printer import TmTcPrinter from tmtccmd.utility.tmtc_printer import TmTcPrinter, PrintFormats
from config.definitions import PUS_APID from config.definitions import PUS_APID
LOGGER = get_console_logger() LOGGER = get_console_logger()
def ccsds_tm_handler(apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter) -> None: def ccsds_tm_handler(
apid: int, raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter
) -> None:
if apid == PUS_APID: if apid == PUS_APID:
pus_factory_hook(raw_tm_packet=raw_tm_packet, tmtc_printer=tmtc_printer) pus_factory_hook(raw_tm_packet=raw_tm_packet, tmtc_printer=tmtc_printer)
@ -33,7 +35,9 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
if service_type == 1: if service_type == 1:
tm_packet = Service1TMExtended.unpack(raw_telemetry=raw_tm_packet) tm_packet = Service1TMExtended.unpack(raw_telemetry=raw_tm_packet)
if service_type == 3: if service_type == 3:
tm_packet = Service3TM.unpack(raw_telemetry=raw_tm_packet, custom_hk_handling=False) tm_packet = Service3TM.unpack(
raw_telemetry=raw_tm_packet, custom_hk_handling=False
)
if service_type == 5: if service_type == 5:
tm_packet = Service5TM.unpack(raw_telemetry=raw_tm_packet) tm_packet = Service5TM.unpack(raw_telemetry=raw_tm_packet)
if service_type == 8: if service_type == 8:
@ -41,9 +45,14 @@ def pus_factory_hook(raw_tm_packet: bytearray, tmtc_printer: TmTcPrinter):
if service_type == 17: if service_type == 17:
tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet) tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet)
if tm_packet is None: if tm_packet is None:
LOGGER.info(f'The service {service_type} is not implemented in Telemetry Factory') LOGGER.info(
f"The service {service_type} is not implemented in Telemetry Factory"
)
tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet) tm_packet = PusTelemetry.unpack(raw_telemetry=raw_tm_packet)
tmtc_printer.print_telemetry(packet_if=tm_packet, info_if=tm_packet, print_raw_tm=False) tm_packet.print_source_data(PrintFormats.HEX)
tmtc_printer.print_telemetry(
packet_if=tm_packet, info_if=tm_packet, print_raw_tm=False
)
except ValueError: except ValueError:
# TODO: Log faulty packet # TODO: Log faulty packet
LOGGER.warning("Invalid packet format detected") LOGGER.warning("Invalid packet format detected")

View File

@ -8,16 +8,20 @@ from tmtccmd.tm.service_3_housekeeping import Service3Base
from tmtccmd.utility.logger import get_console_logger from tmtccmd.utility.logger import get_console_logger
from pus_tc.syrlinks_hk_handler import SetIds from pus_tc.syrlinks_hk_handler import SetIds
from pus_tc.imtq import ImtqSetIds from pus_tc.imtq import ImtqSetIds
from config.object_ids import SYRLINKS_HANDLER_ID, IMTQ_HANDLER_ID, GPS_HANDLER_0_ID, GPS_HANDLER_1_ID from config.object_ids import (
SYRLINKS_HANDLER_ID,
IMTQ_HANDLER_ID,
GPS_HANDLER_0_ID,
GPS_HANDLER_1_ID,
)
LOGGER = get_console_logger() LOGGER = get_console_logger()
def handle_user_hk_packet( def handle_user_hk_packet(
object_id: bytes, set_id: int, hk_data: bytearray, object_id: bytes, set_id: int, hk_data: bytearray, service3_packet: Service3Base
service3_packet: Service3Base
) -> Tuple[list, list, bytearray, int]: ) -> Tuple[list, list, bytearray, int]:
"""This function is called when a Service 3 Housekeeping packet is received. """This function is called when a Service 3 Housekeeping packet is received."""
"""
if object_id == SYRLINKS_HANDLER_ID: if object_id == SYRLINKS_HANDLER_ID:
if set_id == SetIds.RX_REGISTERS_DATASET: if set_id == SetIds.RX_REGISTERS_DATASET:
return handle_syrlinks_rx_registers_dataset(hk_data) return handle_syrlinks_rx_registers_dataset(hk_data)
@ -27,7 +31,9 @@ def handle_user_hk_packet(
LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id") LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id")
return [], [], bytearray(), 0 return [], [], bytearray(), 0
elif object_id == IMTQ_HANDLER_ID: elif object_id == IMTQ_HANDLER_ID:
if (set_id >= ImtqSetIds.POSITIVE_X_TEST) and (set_id <= ImtqSetIds.NEGATIVE_Z_TEST): if (set_id >= ImtqSetIds.POSITIVE_X_TEST) and (
set_id <= ImtqSetIds.NEGATIVE_Z_TEST
):
return handle_self_test_data(hk_data) return handle_self_test_data(hk_data)
else: else:
LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id") LOGGER.info("Serive 3 TM: Syrlinks handler reply with unknown set id")
@ -39,34 +45,54 @@ def handle_user_hk_packet(
return [], [], bytearray(), 0 return [], [], bytearray(), 0
def handle_syrlinks_rx_registers_dataset(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: def handle_syrlinks_rx_registers_dataset(
hk_data: bytearray,
) -> Tuple[list, list, bytearray, int]:
hk_header = [] hk_header = []
hk_content = [] hk_content = []
validity_buffer = bytearray() validity_buffer = bytearray()
hk_header = ["RX Status", "RX Sensitivity", "RX Frequency Shift", "RX IQ Power", "RX AGC Value", "RX Demod Eb", hk_header = [
"RX Demod N0", "RX Datarate"] "RX Status",
"RX Sensitivity",
"RX Frequency Shift",
"RX IQ Power",
"RX AGC Value",
"RX Demod Eb",
"RX Demod N0",
"RX Datarate",
]
rx_status = hk_data[0] rx_status = hk_data[0]
rx_sensitivity = struct.unpack('!I', hk_data[1:5]) rx_sensitivity = struct.unpack("!I", hk_data[1:5])
rx_frequency_shift = struct.unpack('!I', hk_data[5:9]) rx_frequency_shift = struct.unpack("!I", hk_data[5:9])
rx_iq_power = struct.unpack('!H', hk_data[9:11]) rx_iq_power = struct.unpack("!H", hk_data[9:11])
rx_agc_value = struct.unpack('!H', hk_data[11:13]) rx_agc_value = struct.unpack("!H", hk_data[11:13])
rx_demod_eb = struct.unpack('!I', hk_data[13:17]) rx_demod_eb = struct.unpack("!I", hk_data[13:17])
rx_demod_n0 = struct.unpack('!I', hk_data[17:21]) rx_demod_n0 = struct.unpack("!I", hk_data[17:21])
rx_data_rate = hk_data[21] rx_data_rate = hk_data[21]
hk_content = [rx_status, rx_sensitivity, rx_frequency_shift, rx_iq_power, rx_agc_value, rx_demod_eb, rx_demod_n0, hk_content = [
rx_data_rate] rx_status,
rx_sensitivity,
rx_frequency_shift,
rx_iq_power,
rx_agc_value,
rx_demod_eb,
rx_demod_n0,
rx_data_rate,
]
return hk_header, hk_content, validity_buffer, 8 return hk_header, hk_content, validity_buffer, 8
def handle_syrlinks_tx_registers_dataset(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: def handle_syrlinks_tx_registers_dataset(
hk_data: bytearray,
) -> Tuple[list, list, bytearray, int]:
hk_header = [] hk_header = []
hk_content = [] hk_content = []
validity_buffer = bytearray() validity_buffer = bytearray()
hk_header = ["TX Status", "TX Waveform", "TX AGC value"] hk_header = ["TX Status", "TX Waveform", "TX AGC value"]
tx_status = hk_data[0] tx_status = hk_data[0]
tx_waveform = hk_data[1] tx_waveform = hk_data[1]
tx_agc_value = struct.unpack('!H', hk_data[2:4]) tx_agc_value = struct.unpack("!H", hk_data[2:4])
hk_content = [tx_status, tx_waveform, tx_agc_value] hk_content = [tx_status, tx_waveform, tx_agc_value]
return hk_header, hk_content, validity_buffer, 3 return hk_header, hk_content, validity_buffer, 3
@ -75,124 +101,179 @@ def handle_self_test_data(hk_data: bytearray) -> Tuple[list, list, bytearray, in
hk_content = [] hk_content = []
validity_buffer = bytearray() validity_buffer = bytearray()
hk_header = [ hk_header = [
"Init Err", "Init Raw Mag X [nT]", "Init Raw Mag Y [nT]", "Init Raw Mag Z [nT]", "Init Err",
"Init Cal Mag X [nT]", "Init Cal Mag Y [nT]", "Init Cal Mag Z [nT]", "Init Raw Mag X [nT]",
"Init Coil X Current [mA]", "Init Coil Y Current [mA]", "Init Coil Z Current [mA]", "Init Raw Mag Y [nT]",
"Init Coil X Temperature [°C]", "Init Coil Y Temperature [°C]", "Init Raw Mag Z [nT]",
"Init Coil Z Temperature [°C]", "Err", "Raw Mag X [nT]", "Raw Mag Y [nT]", "Raw Mag Z [nT]", "Init Cal Mag X [nT]",
"Cal Mag X [nT]", "Cal Mag Y [nT]", "Cal Mag Z [nT]", "Coil X Current [mA]", "Init Cal Mag Y [nT]",
"Coil Y Current [mA]", "Coil Z Current [mA]", "Init Cal Mag Z [nT]",
"Coil X Temperature [°C]", "Coil Y Temperature [°C]", "Coil Z Temperature [°C]", "Init Coil X Current [mA]",
"Fina Err", "Fina Raw Mag X [nT]", "Fina Raw Mag Y [nT]", "Fina Raw Mag Z [nT]", "Init Coil Y Current [mA]",
"Fina Cal Mag X [nT]", "Fina Cal Mag Y [nT]", "Fina Cal Mag Z [nT]", "Init Coil Z Current [mA]",
"Fina Coil X Current [mA]", "Fina Coil Y Current [mA]", "Fina Coil Z Current [mA]", "Init Coil X Temperature [°C]",
"Fina Coil X Temperature [°C]", "Fina Coil Y Temperature [°C]", "Init Coil Y Temperature [°C]",
"Fina Coil Z Temperature [°C]" "Init Coil Z Temperature [°C]",
"Err",
"Raw Mag X [nT]",
"Raw Mag Y [nT]",
"Raw Mag Z [nT]",
"Cal Mag X [nT]",
"Cal Mag Y [nT]",
"Cal Mag Z [nT]",
"Coil X Current [mA]",
"Coil Y Current [mA]",
"Coil Z Current [mA]",
"Coil X Temperature [°C]",
"Coil Y Temperature [°C]",
"Coil Z Temperature [°C]",
"Fina Err",
"Fina Raw Mag X [nT]",
"Fina Raw Mag Y [nT]",
"Fina Raw Mag Z [nT]",
"Fina Cal Mag X [nT]",
"Fina Cal Mag Y [nT]",
"Fina Cal Mag Z [nT]",
"Fina Coil X Current [mA]",
"Fina Coil Y Current [mA]",
"Fina Coil Z Current [mA]",
"Fina Coil X Temperature [°C]",
"Fina Coil Y Temperature [°C]",
"Fina Coil Z Temperature [°C]",
] ]
# INIT step (no coil actuation) # INIT step (no coil actuation)
init_err = hk_data[0] init_err = hk_data[0]
init_raw_mag_x = struct.unpack('!f', hk_data[1:5])[0] init_raw_mag_x = struct.unpack("!f", hk_data[1:5])[0]
init_raw_mag_y = struct.unpack('!f', hk_data[5:9])[0] init_raw_mag_y = struct.unpack("!f", hk_data[5:9])[0]
init_raw_mag_z = struct.unpack('!f', hk_data[9:13])[0] init_raw_mag_z = struct.unpack("!f", hk_data[9:13])[0]
init_cal_mag_x = struct.unpack('!f', hk_data[13:17])[0] init_cal_mag_x = struct.unpack("!f", hk_data[13:17])[0]
init_cal_mag_y = struct.unpack('!f', hk_data[17:21])[0] init_cal_mag_y = struct.unpack("!f", hk_data[17:21])[0]
init_cal_mag_z = struct.unpack('!f', hk_data[21:25])[0] init_cal_mag_z = struct.unpack("!f", hk_data[21:25])[0]
init_coil_x_current = struct.unpack('!f', hk_data[25:29])[0] init_coil_x_current = struct.unpack("!f", hk_data[25:29])[0]
init_coil_y_current = struct.unpack('!f', hk_data[29:33])[0] init_coil_y_current = struct.unpack("!f", hk_data[29:33])[0]
init_coil_z_current = struct.unpack('!f', hk_data[33:37])[0] init_coil_z_current = struct.unpack("!f", hk_data[33:37])[0]
init_coil_x_temperature = struct.unpack('!H', hk_data[37:39])[0] init_coil_x_temperature = struct.unpack("!H", hk_data[37:39])[0]
init_coil_y_temperature = struct.unpack('!H', hk_data[39:41])[0] init_coil_y_temperature = struct.unpack("!H", hk_data[39:41])[0]
init_coil_z_temperature = struct.unpack('!H', hk_data[41:43])[0] init_coil_z_temperature = struct.unpack("!H", hk_data[41:43])[0]
# Actuation step # Actuation step
err = hk_data[43] err = hk_data[43]
raw_mag_x = struct.unpack('!f', hk_data[44:48])[0] raw_mag_x = struct.unpack("!f", hk_data[44:48])[0]
raw_mag_y = struct.unpack('!f', hk_data[48:52])[0] raw_mag_y = struct.unpack("!f", hk_data[48:52])[0]
raw_mag_z = struct.unpack('!f', hk_data[52:56])[0] raw_mag_z = struct.unpack("!f", hk_data[52:56])[0]
cal_mag_x = struct.unpack('!f', hk_data[56:60])[0] cal_mag_x = struct.unpack("!f", hk_data[56:60])[0]
cal_mag_y = struct.unpack('!f', hk_data[60:64])[0] cal_mag_y = struct.unpack("!f", hk_data[60:64])[0]
cal_mag_z = struct.unpack('!f', hk_data[64:68])[0] cal_mag_z = struct.unpack("!f", hk_data[64:68])[0]
coil_x_current = struct.unpack('!f', hk_data[68:72])[0] coil_x_current = struct.unpack("!f", hk_data[68:72])[0]
coil_y_current = struct.unpack('!f', hk_data[72:76])[0] coil_y_current = struct.unpack("!f", hk_data[72:76])[0]
coil_z_current = struct.unpack('!f', hk_data[76:80])[0] coil_z_current = struct.unpack("!f", hk_data[76:80])[0]
coil_x_temperature = struct.unpack('!H', hk_data[80:82])[0] coil_x_temperature = struct.unpack("!H", hk_data[80:82])[0]
coil_y_temperature = struct.unpack('!H', hk_data[82:84])[0] coil_y_temperature = struct.unpack("!H", hk_data[82:84])[0]
coil_z_temperature = struct.unpack('!H', hk_data[84:86])[0] coil_z_temperature = struct.unpack("!H", hk_data[84:86])[0]
# FINA step (no coil actuation) # FINA step (no coil actuation)
fina_err = hk_data[86] fina_err = hk_data[86]
fina_raw_mag_x = struct.unpack('!f', hk_data[87:91])[0] fina_raw_mag_x = struct.unpack("!f", hk_data[87:91])[0]
fina_raw_mag_y = struct.unpack('!f', hk_data[91:95])[0] fina_raw_mag_y = struct.unpack("!f", hk_data[91:95])[0]
fina_raw_mag_z = struct.unpack('!f', hk_data[95:99])[0] fina_raw_mag_z = struct.unpack("!f", hk_data[95:99])[0]
fina_cal_mag_x = struct.unpack('!f', hk_data[99:103])[0] fina_cal_mag_x = struct.unpack("!f", hk_data[99:103])[0]
fina_cal_mag_y = struct.unpack('!f', hk_data[103:107])[0] fina_cal_mag_y = struct.unpack("!f", hk_data[103:107])[0]
fina_cal_mag_z = struct.unpack('!f', hk_data[107:111])[0] fina_cal_mag_z = struct.unpack("!f", hk_data[107:111])[0]
fina_coil_x_current = struct.unpack('!f', hk_data[111:115])[0] fina_coil_x_current = struct.unpack("!f", hk_data[111:115])[0]
fina_coil_y_current = struct.unpack('!f', hk_data[115:119])[0] fina_coil_y_current = struct.unpack("!f", hk_data[115:119])[0]
fina_coil_z_current = struct.unpack('!f', hk_data[119:123])[0] fina_coil_z_current = struct.unpack("!f", hk_data[119:123])[0]
fina_coil_x_temperature = struct.unpack('!H', hk_data[123:125])[0] fina_coil_x_temperature = struct.unpack("!H", hk_data[123:125])[0]
fina_coil_y_temperature = struct.unpack('!H', hk_data[125:127])[0] fina_coil_y_temperature = struct.unpack("!H", hk_data[125:127])[0]
fina_coil_z_temperature = struct.unpack('!H', hk_data[127:129])[0] fina_coil_z_temperature = struct.unpack("!H", hk_data[127:129])[0]
hk_content = [ hk_content = [
init_err, init_raw_mag_x, init_raw_mag_y, init_raw_mag_z, init_cal_mag_x, init_cal_mag_y, init_err,
init_cal_mag_z, init_coil_x_current, init_coil_y_current, init_coil_z_current, init_raw_mag_x,
init_coil_x_temperature, init_coil_y_temperature, init_coil_z_temperature, err, init_raw_mag_y,
raw_mag_x, init_raw_mag_y, raw_mag_z, cal_mag_x, cal_mag_y, cal_mag_z, init_raw_mag_z,
coil_x_current, coil_y_current, coil_z_current, init_cal_mag_x,
coil_x_temperature, coil_y_temperature, coil_z_temperature, fina_err, init_cal_mag_y,
fina_raw_mag_x, fina_raw_mag_y, fina_raw_mag_z, init_cal_mag_z,
fina_cal_mag_x, fina_cal_mag_y, fina_cal_mag_z, init_coil_x_current,
fina_coil_x_current, fina_coil_y_current, fina_coil_z_current, init_coil_y_current,
fina_coil_x_temperature, fina_coil_y_temperature, fina_coil_z_temperature init_coil_z_current,
init_coil_x_temperature,
init_coil_y_temperature,
init_coil_z_temperature,
err,
raw_mag_x,
init_raw_mag_y,
raw_mag_z,
cal_mag_x,
cal_mag_y,
cal_mag_z,
coil_x_current,
coil_y_current,
coil_z_current,
coil_x_temperature,
coil_y_temperature,
coil_z_temperature,
fina_err,
fina_raw_mag_x,
fina_raw_mag_y,
fina_raw_mag_z,
fina_cal_mag_x,
fina_cal_mag_y,
fina_cal_mag_z,
fina_coil_x_current,
fina_coil_y_current,
fina_coil_z_current,
fina_coil_x_temperature,
fina_coil_y_temperature,
fina_coil_z_temperature,
] ]
return hk_header, hk_content, validity_buffer, len(hk_header) return hk_header, hk_content, validity_buffer, len(hk_header)
def handle_gps_data(hk_data: bytearray) -> Tuple[list, list, bytearray, int]: def handle_gps_data(hk_data: bytearray) -> Tuple[list, list, bytearray, int]:
LOGGER.info(f'Received GPS data, HK data length {len(hk_data)}') LOGGER.info(f"Received GPS data, HK data length {len(hk_data)}")
var_index = 0 var_index = 0
header_array = [] header_array = []
content_array = [] content_array = []
latitude = struct.unpack('!d', hk_data[0:8])[0] latitude = struct.unpack("!d", hk_data[0:8])[0]
header_array.append('Latitude') header_array.append("Latitude")
content_array.append(latitude) content_array.append(latitude)
longitude = struct.unpack('!d', hk_data[8:16])[0] longitude = struct.unpack("!d", hk_data[8:16])[0]
header_array.append('Longitude') header_array.append("Longitude")
content_array.append(longitude) content_array.append(longitude)
altitude = struct.unpack('!d', hk_data[16:24])[0] altitude = struct.unpack("!d", hk_data[16:24])[0]
header_array.append('Altitude') header_array.append("Altitude")
content_array.append(altitude) content_array.append(altitude)
fix_mode = hk_data[24] fix_mode = hk_data[24]
header_array.append('Fix Mode') header_array.append("Fix Mode")
content_array.append(fix_mode) content_array.append(fix_mode)
sat_in_use = hk_data[25] sat_in_use = hk_data[25]
header_array.append('Sats in Use') header_array.append("Sats in Use")
content_array.append(sat_in_use) content_array.append(sat_in_use)
year = struct.unpack('!H', hk_data[26:28])[0] year = struct.unpack("!H", hk_data[26:28])[0]
month = hk_data[28] month = hk_data[28]
day = hk_data[29] day = hk_data[29]
hours = hk_data[30] hours = hk_data[30]
minutes = hk_data[31] minutes = hk_data[31]
seconds = hk_data[32] seconds = hk_data[32]
header_array.append('Date') header_array.append("Date")
date_string = f'{day}.{month}.{year} {hours}:{minutes}:{seconds}' date_string = f"{day}.{month}.{year} {hours}:{minutes}:{seconds}"
content_array.append(date_string) content_array.append(date_string)
unix_seconds = struct.unpack('!I', hk_data[33:37])[0] unix_seconds = struct.unpack("!I", hk_data[33:37])[0]
header_array.append('Unix Seconds') header_array.append("Unix Seconds")
content_array.append(unix_seconds) content_array.append(unix_seconds)
var_index += 13 var_index += 13
if not os.path.isfile('gps_log.txt'): if not os.path.isfile("gps_log.txt"):
with open("gps_log.txt", "w") as gps_file: with open("gps_log.txt", "w") as gps_file:
gps_file.write( gps_file.write(
'Time, Latitude [deg], Longitude [deg], Altitude [m], Fix Mode, Sats in Use, ' "Time, Latitude [deg], Longitude [deg], Altitude [m], Fix Mode, Sats in Use, "
'Date, Unix Seconds\n' "Date, Unix Seconds\n"
) )
with open("gps_log.txt", "a") as gps_file: with open("gps_log.txt", "a") as gps_file:
gps_file.write( gps_file.write(
f'{datetime.datetime.now()}, {latitude}, {longitude}, {altitude}, ' f"{datetime.datetime.now()}, {latitude}, {longitude}, {altitude}, "
f'{fix_mode}, {sat_in_use}, {date_string}, {unix_seconds}\n' f"{fix_mode}, {sat_in_use}, {date_string}, {unix_seconds}\n"
) )
validity_buffer = hk_data[37:39] validity_buffer = hk_data[37:39]
return header_array, content_array, validity_buffer, var_index return header_array, content_array, validity_buffer, var_index

View File

@ -11,7 +11,8 @@ LOGGER = get_console_logger()
def user_analyze_service_8_data( def user_analyze_service_8_data(
object_id: bytes, action_id: int, custom_data: bytearray) -> Tuple[list, list]: object_id: bytes, action_id: int, custom_data: bytearray
) -> Tuple[list, list]:
""" """
This function is called by the TMTC core if a Service 8 data reply (subservice 130) This function is called by the TMTC core if a Service 8 data reply (subservice 130)
is received. The user can return a tuple of two lists, where the first list is received. The user can return a tuple of two lists, where the first list
@ -24,13 +25,13 @@ def user_analyze_service_8_data(
@return: @return:
""" """
if object_id == PDU_2_HANDLER_ID: if object_id == PDU_2_HANDLER_ID:
header_list = ['PDU2 Service 8 Reply'] header_list = ["PDU2 Service 8 Reply"]
data_string = str() data_string = str()
for index in range(len(custom_data)): for index in range(len(custom_data)):
data_string += str(hex(custom_data[index])) + " , " data_string += str(hex(custom_data[index])) + " , "
data_string = data_string.rstrip() data_string = data_string.rstrip()
data_string = data_string.rstrip(',') data_string = data_string.rstrip(",")
data_string = data_string.rstrip() data_string = data_string.rstrip()
content_list = [data_string] content_list = [data_string]
elif object_id == IMTQ_HANDLER_ID: elif object_id == IMTQ_HANDLER_ID:
@ -50,11 +51,11 @@ def user_analyze_service_8_data(
def handle_imtq_replies(action_id: int, custom_data: bytearray) -> Tuple[list, list]: def handle_imtq_replies(action_id: int, custom_data: bytearray) -> Tuple[list, list]:
header_list = [] header_list = []
content_list = [] content_list = []
if action_id == struct.unpack('!I', ImtqActionIds.get_commanded_dipole)[0]: if action_id == struct.unpack("!I", ImtqActionIds.get_commanded_dipole)[0]:
header_list = ['Commanded X-Dipole', 'Commanded Y-Dipole', 'Commanded Z-Dipole'] header_list = ["Commanded X-Dipole", "Commanded Y-Dipole", "Commanded Z-Dipole"]
x_dipole = struct.unpack('!H', custom_data[:2]) x_dipole = struct.unpack("!H", custom_data[:2])
y_dipole = struct.unpack('!H', custom_data[2:4]) y_dipole = struct.unpack("!H", custom_data[2:4])
z_dipole = struct.unpack('!H', custom_data[4:6]) z_dipole = struct.unpack("!H", custom_data[4:6])
content_list = [x_dipole[0], y_dipole[0], z_dipole[0]] content_list = [x_dipole[0], y_dipole[0], z_dipole[0]]
@ -62,29 +63,35 @@ def handle_ploc_replies(action_id: int, custom_data: bytearray) -> Tuple[list, l
header_list = [] header_list = []
content_list = [] content_list = []
if action_id == PlocReplyIds.tm_mem_read_report: if action_id == PlocReplyIds.tm_mem_read_report:
header_list = ['PLOC Memory Address', 'PLOC Mem Len', 'PLOC Read Memory Data'] header_list = ["PLOC Memory Address", "PLOC Mem Len", "PLOC Read Memory Data"]
content_list = [custom_data[:4], custom_data[4:6], custom_data[6:10]] content_list = [custom_data[:4], custom_data[4:6], custom_data[6:10]]
return header_list, content_list return header_list, content_list
def handle_supervisor_replies(action_id: int, custom_data: bytearray) -> Tuple[list, list]: def handle_supervisor_replies(
action_id: int, custom_data: bytearray
) -> Tuple[list, list]:
header_list = [] header_list = []
content_list = [] content_list = []
if action_id == SupvActionIds.DUMP_MRAM: if action_id == SupvActionIds.DUMP_MRAM:
header_list = ['MRAM Dump'] header_list = ["MRAM Dump"]
content_list = [custom_data[:len(custom_data)]] content_list = [custom_data[: len(custom_data)]]
return header_list, content_list return header_list, content_list
def handle_startracker_replies(action_id: int, custom_data: bytearray) -> Tuple[list, list]: def handle_startracker_replies(
action_id: int, custom_data: bytearray
) -> Tuple[list, list]:
header_list = [] header_list = []
content_list = [] content_list = []
if action_id == StarTrackerActionIds.CHECKSUM: if action_id == StarTrackerActionIds.CHECKSUM:
if len(custom_data) != 5: if len(custom_data) != 5:
LOGGER.warning("Star tracker reply has invalid length {0}".format(len(custom_data))) LOGGER.warning(
"Star tracker reply has invalid length {0}".format(len(custom_data))
)
return header_list, content_list return header_list, content_list
header_list = ['Checksum', 'Checksum valid'] header_list = ["Checksum", "Checksum valid"]
print(custom_data[4]) print(custom_data[4])
checksum_valid_flag = custom_data[4] >> 8 checksum_valid_flag = custom_data[4] >> 8
content_list = ['0x' + custom_data[:4].hex(), checksum_valid_flag] content_list = ["0x" + custom_data[:4].hex(), checksum_valid_flag]
return header_list, content_list return header_list, content_list

@ -1 +1 @@
Subproject commit bd2647f19a78b1706f673d6168e8eea62ccdb206 Subproject commit ee22cea62159650397f08844fc92237daf9b8b73

View File

@ -27,18 +27,23 @@ limitations under the License.
@author R. Mueller @author R. Mueller
""" """
import sys import sys
try: try:
from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler from tmtccmd.runner import (
initialize_tmtc_commander,
run_tmtc_commander,
add_ccsds_handler,
)
from tmtccmd.ccsds.handler import CcsdsTmHandler from tmtccmd.ccsds.handler import CcsdsTmHandler
from tmtccmd.utility.logger import TMTC_LOGGER_NAME from tmtccmd.utility.logger import TMTC_LOGGER_NAME
except ImportError as error: except ImportError as error:
run_tmtc_commander = None run_tmtc_commander = None
initialize_tmtc_commander = None initialize_tmtc_commander = None
print(error) print(error)
print('Python tmtccmd submodule could not be imported') print("Python tmtccmd submodule could not be imported")
print( print(
'Install with \"cd tmtccmd && python3 -m pip ' 'Install with "cd tmtccmd && python3 -m pip '
'install -e .[gui]\" for interactive installation' 'install -e .[gui]" for interactive installation'
) )
sys.exit(1) sys.exit(1)
@ -47,9 +52,9 @@ try:
from spacepackets.log import set_custom_console_logger_name from spacepackets.log import set_custom_console_logger_name
except ImportError as error: except ImportError as error:
print(error) print(error)
print('Python spacepackets module could not be imported') print("Python spacepackets module could not be imported")
print( print(
'Install with \"cd spacepackets && python3 -m pip intall -e .\" for interative installation' 'Install with "cd spacepackets && python3 -m pip intall -e ." for interative installation'
) )
sys.exit(1) sys.exit(1)
@ -61,12 +66,14 @@ from pus_tm.factory_hook import ccsds_tm_handler
def main(): def main():
hook_obj = EiveHookObject() hook_obj = EiveHookObject()
print(f'-- eive tmtc version {__version__} --') print(f"-- eive tmtc version {__version__} --")
print(f'-- spacepackets version {spacepackets.__version__} --') print(f"-- spacepackets version {spacepackets.__version__} --")
set_custom_console_logger_name(logger_name=TMTC_LOGGER_NAME) set_custom_console_logger_name(logger_name=TMTC_LOGGER_NAME)
initialize_tmtc_commander(hook_object=hook_obj) initialize_tmtc_commander(hook_object=hook_obj)
ccsds_handler = CcsdsTmHandler() ccsds_handler = CcsdsTmHandler()
ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50) ccsds_handler.add_tm_handler(
apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50
)
add_ccsds_handler(ccsds_handler) add_ccsds_handler(ccsds_handler)
run_tmtc_commander(False) run_tmtc_commander(False)

@ -1 +1 @@
Subproject commit ffb864dd2731af39cf05c91a49e4f4235ba66fba Subproject commit 0e379b00ded7fbe8bd2bfb8d2de76a20c1cf6ebe

View File

@ -32,8 +32,13 @@ from config.hook_implementations import EiveHookObject
from config.version import __version__ from config.version import __version__
from config.definitions import PUS_APID from config.definitions import PUS_APID
from pus_tm.factory_hook import ccsds_tm_handler from pus_tm.factory_hook import ccsds_tm_handler
try: try:
from tmtccmd.runner import initialize_tmtc_commander, run_tmtc_commander, add_ccsds_handler from tmtccmd.runner import (
initialize_tmtc_commander,
run_tmtc_commander,
add_ccsds_handler,
)
from tmtccmd.ccsds.handler import CcsdsTmHandler from tmtccmd.ccsds.handler import CcsdsTmHandler
import spacepackets import spacepackets
except ImportError as error: except ImportError as error:
@ -41,17 +46,21 @@ except ImportError as error:
initialize_tmtc_commander = None initialize_tmtc_commander = None
print(error) print(error)
print("Python tmtccmd submodule could not be imported") print("Python tmtccmd submodule could not be imported")
print("Install with \"cd tmtccmd && python3 -m pip install -e .\" for interactive installation") print(
'Install with "cd tmtccmd && python3 -m pip install -e ." for interactive installation'
)
sys.exit(0) sys.exit(0)
def main(): def main():
hook_obj = EiveHookObject() hook_obj = EiveHookObject()
print(f"-- eive tmtc version {__version__}") print(f"-- eive tmtc version {__version__}")
print(f'-- spacepackets version {spacepackets.__version__} --') print(f"-- spacepackets version {spacepackets.__version__} --")
initialize_tmtc_commander(hook_object=hook_obj) initialize_tmtc_commander(hook_object=hook_obj)
ccsds_handler = CcsdsTmHandler() ccsds_handler = CcsdsTmHandler()
ccsds_handler.add_tm_handler(apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50) ccsds_handler.add_tm_handler(
apid=PUS_APID, pus_tm_handler=ccsds_tm_handler, max_queue_len=50
)
add_ccsds_handler(ccsds_handler) add_ccsds_handler(ccsds_handler)
run_tmtc_commander(use_gui=True) run_tmtc_commander(use_gui=True)

View File

@ -1,11 +1,12 @@
def parse_input_arguments_user(
print_known_args: bool = False, print_unknown_args: bool = False
def parse_input_arguments_user(print_known_args: bool = False, print_unknown_args: bool = False): ):
""" """
This function by default will build the default argument parser. A custom CLI parser can be This function by default will build the default argument parser. A custom CLI parser can be
built in this function if required. built in this function if required.
""" """
from tmtccmd.config.args import parse_default_input_arguments from tmtccmd.config.args import parse_default_input_arguments
parse_default_input_arguments( parse_default_input_arguments(
print_known_args=print_known_args, print_unknown_args=print_unknown_args print_known_args=print_known_args, print_unknown_args=print_unknown_args
) )