applied black formatter

This commit is contained in:
2022-01-18 14:03:56 +01:00
parent 742f4d1873
commit c3a0f31d19
36 changed files with 1762 additions and 782 deletions

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.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.pdu2 import pack_pdu2_commands, Pdu2OpCodes
@ -30,4 +35,4 @@ def pack_acs_command(tc_queue: TcQueueT, op_code: str):
pass
if op_code == AcsOpCodes.ON_MGM_0.value:
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.
Setting all to False will only run the tests set to True.
"""
all = False
reboot = False
read_gnd_wdt = False
@ -56,12 +57,14 @@ class CommandId:
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"))
if op_code == "51":
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)
tc_queue.appendleft(command.pack_command_tuple())
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)
tc_queue.appendleft(command.pack_command_tuple())
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(
object_id, TableIds.hk, ACUHkTable.wdt_gnd_left.parameter_address,
ACUHkTable.wdt_gnd_left.parameter_size
object_id,
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)
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())
if ACUTestProcedure.all or ACUTestProcedure.read_temperature3:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading temperature 3"))
command = pack_get_param_command(object_id, TableIds.hk, ACUHkTable.temperature3.parameter_address,
ACUHkTable.temperature3.parameter_size)
command = pack_get_param_command(
object_id,
TableIds.hk,
ACUHkTable.temperature3.parameter_address,
ACUHkTable.temperature3.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_vboost:
tc_queue.appendleft((QueueCommands.PRINT, "ACU: Reading vboost value"))
command = pack_get_param_command(object_id, TableIds.config, ACUConfigTable.vboost.parameter_address,
ACUConfigTable.vboost.parameter_size)
command = pack_get_param_command(
object_id,
TableIds.config,
ACUConfigTable.vboost.parameter_address,
ACUConfigTable.vboost.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_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,
ACUConfigTable.vbat_max_hi.parameter_size)
command = pack_get_param_command(
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)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_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,
ACUConfigTable.vbat_max_lo.parameter_size)
command = pack_get_param_command(
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)
tc_queue.appendleft(command.pack_command_tuple())
if ACUTestProcedure.all or ACUTestProcedure.read_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,
ACUConfigTable.ov_mode.parameter_size)
command = pack_get_param_command(
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)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning off ACU"))
command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address,
P60DockConfigTable.out_en_0.parameter_size, Channel.off)
command = pack_set_param_command(
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)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -21,10 +21,14 @@ class CommandIds:
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(
(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":
@ -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())
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 = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -14,12 +14,12 @@ class ActionIds(enum.IntEnum):
class OpCodes(enum.Enum):
REBOOT = 'reboot'
REBOOT_SELF = 'reboot_self'
REBOOT_0_0 = 'reboot_0_0'
REBOOT_0_1 = 'reboot_0_1'
REBOOT_1_0 = 'reboot_1_0'
REBOOT_1_1 = 'reboot_1_1'
REBOOT = "reboot"
REBOOT_SELF = "reboot_self"
REBOOT_0_0 = "reboot_0_0"
REBOOT_0_1 = "reboot_0_1"
REBOOT_1_0 = "reboot_1_0"
REBOOT_1_1 = "reboot_1_1"
class Chip(enum.IntEnum):
@ -38,7 +38,10 @@ def pack_core_commands(tc_queue: TcQueueT, op_code: str):
if op_code == OpCodes.REBOOT.value:
reboot_self, chip_select, copy_select = determine_reboot_params()
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:
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:
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:
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:
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):
chip_select = -1
copy_select = -1
reboot_self = input('Reboot self? [y/n]: ')
if reboot_self in ['y', 'yes', '1']:
LOGGER.info('Rebooting currently running image')
reboot_self = input("Reboot self? [y/n]: ")
if reboot_self in ["y", "yes", "1"]:
LOGGER.info("Rebooting currently running image")
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:
chip_select = input('Chip select [0/1]: ')
if chip_select in ['0', '1']:
if chip_select == '0':
chip_select = input("Chip select [0/1]: ")
if chip_select in ["0", "1"]:
if chip_select == "0":
chip_select = Chip.CHIP_0
else:
chip_select = Chip.CHIP_1
break
else:
LOGGER.warning('Invalid chip select value. Try again')
LOGGER.warning("Invalid chip select value. Try again")
while True:
copy_select = input('Copy select [0/1]: ')
if copy_select in ['0', '1']:
if copy_select == '0':
copy_select = input("Copy select [0/1]: ")
if copy_select in ["0", "1"]:
if copy_select == "0":
copy_select = Copy.COPY_0_NOM
else:
copy_select = Copy.COPY_1_GOLD
break
else:
LOGGER.warning('Invalid copy select value. Try again')
LOGGER.warning("Invalid copy select value. Try again")
return False, chip_select, copy_select
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()
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)
else:
tc_data.append(False)
tc_data.append(chip)
tc_data.append(copy)
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(
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())

View File

@ -43,8 +43,10 @@ def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT):
tc_queue.appendleft(command.pack_command_tuple())
def pack_switch_heater_command(object_id: bytearray, switch_nr: int, switch_action: int) -> bytearray:
""" Function to generate the command switch a heater
def pack_switch_heater_command(
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 switch_nr The switch number identifying the heater to switch
@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])
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(
(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":
@ -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)
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 = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
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)
command = generate_one_hk_command(sid, 24)
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)
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 = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
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)
command = generate_one_hk_command(sid, 27)
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)
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 = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
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)
command = generate_one_hk_command(sid, 30)
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)
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 = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
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)
command = generate_one_hk_command(sid, 33)
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)
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 = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
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)
command = generate_one_hk_command(sid, 36)
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)
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 = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
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)
command = generate_one_hk_command(sid, 37)
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
y_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 = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
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
def pack_dipole_command(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.
def pack_dipole_command(
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 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)
@ -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
command = bytearray()
command = object_id + action_id
command.extend(x_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(duration.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(z_dipole.to_bytes(length=2, byteorder="big"))
command.extend(duration.to_bytes(length=2, byteorder="big"))
return command

View File

@ -22,6 +22,7 @@ class P60DockTestProcedure:
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = False
reboot = False
read_gnd_wdt = False
@ -32,8 +33,12 @@ class P60DockTestProcedure:
read_channel_3_state = False # pdu2
read_cur_lu_lim_0 = False
channel_3_on = False # pdu2
invalid_table_id_test = 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_table_id_test = (
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
@ -49,8 +54,12 @@ class P60DockConfigTable:
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_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_12 = TableEntry(bytearray([0x00, 0x74]), TableEntry.uint8_size) # GS 5V (unused)
out_en_11 = TableEntry(
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
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:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 on"))
command = pack_set_param_command(
object_id, P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size, Channel.on
object_id,
P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
return
if op_code == P60OpCodes.STACK_3V3_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Turning stack 3V3 off"))
command = pack_set_param_command(
object_id, P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size, Channel.off
object_id,
P60DockConfigTable.out_en_9.parameter_address,
P60DockConfigTable.out_en_9.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
return
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(
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)
tc_queue.appendleft(command.pack_command_tuple())
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(
object_id, TableIds.hk, P60DockHkTable.wdt_gnd_left.parameter_address,
P60DockHkTable.wdt_gnd_left.parameter_size
object_id,
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)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
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)
tc_queue.appendleft(command.pack_command_tuple())
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
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size, parameter)
command = pack_set_param_command(
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)
tc_queue.appendleft(command.pack_command_tuple())
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(
object_id, TableIds.hk, P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size
object_id,
TableIds.hk,
P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
tc_queue.appendleft((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)
tc_queue.appendleft(
(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 = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0:
tc_queue.appendleft((QueueCommands.PRINT,
"P60 Dock: Reading current limit value of output channel 0"))
tc_queue.appendleft(
(
QueueCommands.PRINT,
"P60 Dock: Reading current limit value of output channel 0",
)
)
command = pack_get_param_command(
object_id, TableIds.config, P60DockConfigTable.cur_lu_lim_0.parameter_address,
P60DockConfigTable.cur_lu_lim_0.parameter_size
object_id,
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)
tc_queue.appendleft(command.pack_command_tuple())
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
command = pack_set_param_command(object_id, P60DockConfigTable.out_en_3.parameter_address,
P60DockConfigTable.out_en_3.parameter_size, parameter)
command = pack_set_param_command(
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)
tc_queue.appendleft(command.pack_command_tuple())
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
command = pack_get_param_command(
object_id, table_id_invalid, P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size
object_id,
table_id_invalid,
P60DockHkTable.temperature1.parameter_address,
P60DockHkTable.temperature1.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test:
tc_queue.appendleft((QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in get param command"))
tc_queue.appendleft(
(
QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in get param command",
)
)
invalid_address = bytearray([0x01, 0xF4])
command = pack_get_param_command(object_id, TableIds.hk, invalid_address,
P60DockHkTable.temperature1.parameter_size)
command = pack_get_param_command(
object_id,
TableIds.hk,
invalid_address,
P60DockHkTable.temperature1.parameter_size,
)
# command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
tc_queue.appendleft((QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in set param command"))
tc_queue.appendleft(
(
QueueCommands.PRINT,
"P60 Dock: Testing invalid address handling in set param command",
)
)
invalid_address = bytearray([0x01, 0xF4])
parameter_size = 2
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)
tc_queue.appendleft(command.pack_command_tuple())
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test:
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
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)
tc_queue.appendleft(command.pack_command_tuple())
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
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)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -17,10 +17,12 @@ class CommandIds:
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(
(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":
@ -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())
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 = 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.
Setting all to False will only run the tests set to True.
"""
all = False
reboot = False
ping = 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_3_on = False # MTQ connected to this channel (5V)
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:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board on"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on
object_id,
PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.TCS_BOARD_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn TCS board off"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.off
object_id,
PDUConfigTable.out_en_0.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.STAR_TRACKER_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker on"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on
object_id,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.STAR_TRACKER_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn star tracker off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
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())
if op_code == Pdu1OpCodes.SUS_NOMINAL_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal on"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.on)
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_4.parameter_address,
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())
if op_code == Pdu1OpCodes.ACS_A_SIDE_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A on"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, Channel.on
object_id,
PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.ACS_A_SIDE_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn ACS Side A off"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, Channel.off
object_id,
PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.SUS_NOMINAL_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn SUS nominal off"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_4.parameter_address,
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())
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(
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:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks on"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size, Channel.on
object_id,
PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu1OpCodes.SYRLINKS_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn Syrlinks off"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size, Channel.off
object_id,
PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.off,
)
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:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading"))
command = pack_get_param_command(
object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size
object_id,
TableIds.hk,
PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size,
)
tc_queue.appendleft(command.pack_command_tuple())
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(
object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on
object_id,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
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(
object_id, PDUConfigTable.out_en_2.parameter_address,
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())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_on:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 on (MTQ)"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, Channel.on
object_id,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if PDU1TestProcedure.all or PDU1TestProcedure.turn_channel_3_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Turn channel 3 off (MTQ)"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size, Channel.off
object_id,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -19,6 +19,8 @@ class Pdu2OpCodes(enum.Enum):
SUS_REDUNDANT_OFF = "4"
RW_ON = "5"
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:
@ -27,6 +29,7 @@ class PDU2TestProcedure:
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = False
reboot = False
read_gnd_wdt = False
@ -37,55 +40,88 @@ class PDU2TestProcedure:
read_channel_2_state = False # Reaction wheels 5V
read_cur_lu_lim_0 = False # OBC
channel_2_on = False # Reaction wheels 5V
invalid_table_id_test = 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_table_id_test = (
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
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"))
if op_code == Pdu2OpCodes.ACS_SIDE_B_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B on"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, Channel.on
object_id,
PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
if op_code == Pdu2OpCodes.ACS_SIDE_B_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn ACS Side B off"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size, Channel.off
object_id,
PDUConfigTable.out_en_7.parameter_address,
PDUConfigTable.out_en_7.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
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:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant on"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.on)
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.SUS_REDUNDANT_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn SUS redundant off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size, Channel.off)
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_4.parameter_address,
PDUConfigTable.out_en_4.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.RW_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels on"))
command = pack_set_param_command(
object_id, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size, Channel.on
object_id,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.RW_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn reaction wheels off"))
command = pack_set_param_command(object_id, PDUConfigTable.out_en_2.parameter_address,
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())
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(
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)
tc_queue.appendleft(command.pack_command_tuple())
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(
object_id, TableIds.hk, PDUHkTable.wdt_gnd_left.parameter_address,
PDUHkTable.wdt_gnd_left.parameter_size
object_id,
TableIds.hk,
PDUHkTable.wdt_gnd_left.parameter_address,
PDUHkTable.wdt_gnd_left.parameter_size,
)
tc_queue.appendleft(command.pack_command_tuple())
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)
tc_queue.appendleft(command.pack_command_tuple())
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())
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_on:
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())
if PDU2TestProcedure.all or PDU2TestProcedure.read_temperature:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing temperature reading"))
command = pack_get_param_command(
object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size
object_id,
TableIds.hk,
PDUHkTable.temperature.parameter_address,
PDUHkTable.temperature.parameter_size,
)
tc_queue.appendleft(command.pack_command_tuple())
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)")
)
command = pack_get_param_command(
object_id, TableIds.config, PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size
object_id,
TableIds.config,
PDUConfigTable.out_en_2.parameter_address,
PDUConfigTable.out_en_2.parameter_size,
)
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.read_cur_lu_lim_0:
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(
object_id, TableIds.config, PDUConfigTable.cur_lu_lim_0.parameter_address,
PDUConfigTable.cur_lu_lim_0.parameter_size
object_id,
TableIds.config,
PDUConfigTable.cur_lu_lim_0.parameter_address,
PDUConfigTable.cur_lu_lim_0.parameter_size,
)
tc_queue.appendleft(command.pack_command_tuple())
if PDU2TestProcedure.all or PDU2TestProcedure.channel_2_off:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Testing setting output channel 2 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(
(QueueCommands.PRINT, "PDU2: Testing setting output channel 2 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())
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)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue

View File

@ -18,10 +18,14 @@ class ActionIds:
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(
(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":
@ -35,7 +39,7 @@ def pack_mram_dump_cmd(object_id: bytearray) -> bytearray:
start = int(input("Start address: 0x"), 16)
end = int(input("End address: 0x"), 16)
command = bytearray()
command = object_id + struct.pack('!I', ActionIds.DUMP_MRAM)
command = command + struct.pack('!I', start)
command = command + struct.pack('!I', end)
command = object_id + struct.pack("!I", ActionIds.DUMP_MRAM)
command = command + struct.pack("!I", start)
command = command + struct.pack("!I", end)
return command

View File

@ -20,6 +20,7 @@ class PlocTestProcedure:
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = False
test_tc_mem_write = False
test_tc_mem_read = True
@ -36,33 +37,43 @@ class PlocReplyIds:
def pack_ploc_mpsoc_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft(
(QueueCommands.PRINT,
"Testing PLOC MPSoC with object id: 0x" + object_id.hex())
(QueueCommands.PRINT, "Testing PLOC MPSoC with object id: 0x" + object_id.hex())
)
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_write:
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Write Test"))
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)
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)
tc_queue.appendleft(command.pack_command_tuple())
if PlocTestProcedure.all or PlocTestProcedure.test_tc_mem_read:
tc_queue.appendleft((QueueCommands.PRINT, "PLOC: TC Mem Read Test"))
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)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
def generate_write_mem_command(object_id: bytearray, memory_address: bytearray, memory_data: int) -> bytearray:
""" This function generates the command to write to a memory address within the PLOC
def generate_write_mem_command(
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 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.
"""
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

View File

@ -17,14 +17,15 @@ from tmtccmd.utility.logger import get_console_logger
LOGGER = get_console_logger()
latchup_id_dict = {
"0": "0.85V",
"1": "1.8V",
"2": "MISC",
"3": "3.3V",
"4": "NVM_4XO",
"5": "MISSION",
"6": "SAFECOTS"
}
"0": "0.85V",
"1": "1.8V",
"2": "MISC",
"3": "3.3V",
"4": "NVM_4XO",
"5": "MISSION",
"6": "SAFECOTS",
}
class SupvActionIds:
HK_REPORT = 1
@ -75,34 +76,40 @@ class SupvHkIds:
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(
(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":
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "4":
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "5":
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "6":
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)
tc_queue.appendleft(command.pack_command_tuple())
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):"))
bp0 = int(input("BP0 (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)
tc_queue.appendleft(command.pack_command_tuple())
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:"))
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "9":
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "10":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set time reference"))
command = object_id + struct.pack('!I', SupvActionIds.SET_TIME_REF)
tc_queue.appendleft(
(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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "11":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Set boot timeout"))
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "12":
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "13":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Request boot status report"))
command = object_id + struct.pack('!I', SupvActionIds.GET_BOOT_STATUS_REPORT)
tc_queue.appendleft(
(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)
tc_queue.appendleft(command.pack_command_tuple())
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)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=33, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=34, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=35, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=36, app_data=command)
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)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=38, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=39, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=41, app_data=command)
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "26":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Request latchup status report"))
command = object_id + struct.pack('!I', SupvActionIds.GET_LATCHUP_STATUS_REPORT)
tc_queue.appendleft(
(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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "27":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Copy ADC data to MRAM"))
command = object_id + struct.pack('!I', SupvActionIds.COPY_ADC_DATA_TO_MRAM)
tc_queue.appendleft(
(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)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
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)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command)
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "37":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Restart supervisor"))
command = command = object_id + struct.pack('!I', SupvActionIds.RESTART_SUPERVISOR)
tc_queue.appendleft(
(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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "38":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear all"))
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_ALL)
tc_queue.appendleft(
(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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "39":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear mirror entries"))
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_MIRROR)
tc_queue.appendleft(
(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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "40":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Factory reset clear circular entries"))
command = command = object_id + struct.pack('!I', SupvActionIds.FACTORY_RESET_CLEAR_CIRCULAR)
tc_queue.appendleft(
(
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)
tc_queue.appendleft(command.pack_command_tuple())
elif op_code == "41":
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)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
def pack_sel_boot_image_cmd(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
def pack_sel_boot_image_cmd(
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 mem The memory from which the MPSoC shall boot (NVM0 - 0, NVM1 - 1)
@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
"""
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
command = command + struct.pack('!B', mem)
command = command + struct.pack('!B', bp0)
command = command + struct.pack('!B', bp1)
command = command + struct.pack('!B', bp2)
command = object_id + struct.pack("!I", SupvActionIds.SEL_MPSOC_BOOT_IMAGE)
command = command + struct.pack("!B", mem)
command = command + struct.pack("!B", bp0)
command = command + struct.pack("!B", bp1)
command = command + struct.pack("!B", bp2)
return command
@ -309,12 +377,12 @@ def pack_update_available_cmd(object_id: bytearray) -> bytearray:
image_crc = 0x0
number_of_packets = 150
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.UPDATE_AVAILABLE)
command = command + struct.pack('!B', image_select)
command = command + struct.pack('!B', image_partition)
command = command + struct.pack('!I', image_size)
command = command + struct.pack('!I', image_crc)
command = command + struct.pack('!I', number_of_packets)
command = object_id + struct.pack("!I", SupvActionIds.UPDATE_AVAILABLE)
command = command + struct.pack("!B", image_select)
command = command + struct.pack("!B", image_partition)
command = command + struct.pack("!I", image_size)
command = command + struct.pack("!I", image_crc)
command = command + struct.pack("!I", number_of_packets)
return command
@ -328,10 +396,10 @@ def pack_watchdogs_enable_cmd(object_id: bytearray) -> bytearray:
watchdog_pl = 1
watchdog_int = 0
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.WATCHDOGS_ENABLE)
command = command + struct.pack('!B', watchdog_ps)
command = command + struct.pack('!B', watchdog_pl)
command = command + struct.pack('!B', watchdog_int)
command = object_id + struct.pack("!I", SupvActionIds.WATCHDOGS_ENABLE)
command = command + struct.pack("!B", watchdog_ps)
command = command + struct.pack("!B", watchdog_pl)
command = command + struct.pack("!B", watchdog_int)
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):"))
timeout = int(input("Specify timeout (1000 ms - 360000 ms):"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.WATCHDOGS_CONFIG_TIMEOUT)
command = command + struct.pack('!B', watchdog)
command = command + struct.pack('!I', timeout)
command = object_id + struct.pack("!I", SupvActionIds.WATCHDOGS_CONFIG_TIMEOUT)
command = command + struct.pack("!B", watchdog)
command = command + struct.pack("!I", timeout)
return command
@ -358,10 +426,10 @@ def pack_lachtup_alert_cmd(object_id: bytearray, state: bool) -> bytearray:
latchup_id = get_latchup_id()
command = bytearray()
if state:
command = object_id + struct.pack('!I', SupvActionIds.ENABLE_LATCHUP_ALERT)
command = object_id + struct.pack("!I", SupvActionIds.ENABLE_LATCHUP_ALERT)
else:
command = object_id + struct.pack('!I', SupvActionIds.DISABLE_LATCHUP_ALERT)
command = command + struct.pack('!B', latchup_id)
command = object_id + struct.pack("!I", SupvActionIds.DISABLE_LATCHUP_ALERT)
command = command + struct.pack("!B", latchup_id)
return command
@ -373,9 +441,9 @@ def pack_auto_calibrate_alert_cmd(object_id: bytearray) -> bytearray:
latchup_id = get_latchup_id()
mg = int(input("Specify MG:"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.AUTO_CALIBRATE_ALERT)
command = command + struct.pack('!B', latchup_id)
command = command + struct.pack('!I', mg)
command = object_id + struct.pack("!I", SupvActionIds.AUTO_CALIBRATE_ALERT)
command = command + struct.pack("!B", latchup_id)
command = command + struct.pack("!I", mg)
return command
@ -403,9 +471,9 @@ def pack_set_alert_limit_cmd(object_id: bytearray) -> bytearray:
latchup_id = get_latchup_id()
dutycycle = int(input("Specify dutycycle:"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ALERT_LIMIT)
command = command + struct.pack('!B', latchup_id)
command = command + struct.pack('!I', dutycycle)
command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_LIMIT)
command = command + struct.pack("!B", latchup_id)
command = command + struct.pack("!I", dutycycle)
return command
@ -418,10 +486,10 @@ def pack_set_alert_irq_filter_cmd(object_id: bytearray) -> bytearray:
tp = int(input("Specify filter type (TP):"))
div = int(input("Specify clock divider (DIV):"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ALERT_IRQ_FILTER)
command = command + struct.pack('!B', latchup_id)
command = command + struct.pack('!B', tp)
command = command + struct.pack('!B', div)
command = object_id + struct.pack("!I", SupvActionIds.SET_ALERT_IRQ_FILTER)
command = command + struct.pack("!B", latchup_id)
command = command + struct.pack("!B", tp)
command = command + struct.pack("!B", div)
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):"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_SWEEP_PERIOD)
command = command + struct.pack('!I', sweep_period)
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_SWEEP_PERIOD)
command = command + struct.pack("!I", sweep_period)
return command
@ -444,8 +512,8 @@ def pack_set_adc_enabled_channels_cmd(object_id: bytearray) -> bytearray:
"""
ch = int(input("Specify ch:"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_ENABLED_CHANNELS)
command = command + struct.pack('!H', ch)
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_ENABLED_CHANNELS)
command = command + struct.pack("!H", ch)
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:"))
striding_step_size = int(input("Specify striding step size:"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
command = command + struct.pack('!H', window_size)
command = command + struct.pack('!H', striding_step_size)
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_WINDOW_AND_STRIDE)
command = command + struct.pack("!H", window_size)
command = command + struct.pack("!H", striding_step_size)
return command
def pack_set_adc_threshold_cmd(object_id: bytearray) -> bytearray:
threshold = int(input("Specify threshold:"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_ADC_THRESHOLD)
command = command + struct.pack('!I', threshold)
command = object_id + struct.pack("!I", SupvActionIds.SET_ADC_THRESHOLD)
command = command + struct.pack("!I", threshold)
return command
@ -471,25 +539,25 @@ def pack_enable_nvms_cmd(object_id: bytearray) -> bytearray:
n01 = int(input("NVM0/1 (0 - off, 1 - on):"))
n3 = int(input("NVM3 (0 - off, 1 - on):"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.ENABLE_NVMS)
command = command + struct.pack('!B', n01)
command = command + struct.pack('!B', n3)
command = object_id + struct.pack("!I", SupvActionIds.ENABLE_NVMS)
command = command + struct.pack("!B", n01)
command = command + struct.pack("!B", n3)
return command
def pack_select_nvm_cmd(object_id: bytearray) -> bytearray:
mem = int(input("Specify NVM (0 - NVM0, 1 - MVM1):"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SELECT_NVM)
command = command + struct.pack('!B', mem)
command = object_id + struct.pack("!I", SupvActionIds.SELECT_NVM)
command = command + struct.pack("!B", mem)
return command
def pack_auto_em_tests_cmd(object_id: bytearray) -> bytearray:
test = int(input("Specify test (1 - complete, 2 - short):"))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.RUN_AUTO_EM_TESTS)
command = command + struct.pack('!B', test)
command = object_id + struct.pack("!I", SupvActionIds.RUN_AUTO_EM_TESTS)
command = command + struct.pack("!B", test)
return command
@ -497,25 +565,25 @@ def pack_mram_wipe_cmd(object_id: bytearray) -> bytearray:
start = int(input("Start address: 0x"), 16)
stop = int(input("Stop address: 0x"), 16)
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.WIPE_MRAM)
command = command + struct.pack('!I', start)
command = command + struct.pack('!I', stop)
command = object_id + struct.pack("!I", SupvActionIds.WIPE_MRAM)
command = command + struct.pack("!I", start)
command = command + struct.pack("!I", stop)
return command
def pack_print_cpu_stats_cmd(object_id: bytearray) -> bytearray:
en = 1
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.PRINT_CPU_STATS)
command = command + struct.pack('!B', en)
command = object_id + struct.pack("!I", SupvActionIds.PRINT_CPU_STATS)
command = command + struct.pack("!B", en)
return command
def pack_set_debug_verbosity_cmd(object_id: bytearray) -> bytearray:
command = bytearray()
verbosity = get_debug_verbosity()
command = object_id + struct.pack('!I', SupvActionIds.SET_DBG_VERBOSITY)
command = command + struct.pack('!B', verbosity)
command = object_id + struct.pack("!I", SupvActionIds.SET_DBG_VERBOSITY)
command = command + struct.pack("!B", verbosity)
return command
@ -530,7 +598,7 @@ def get_debug_verbosity() -> int:
2: "Warn",
3: "Info",
}
print("{:<6} | {}".format('Key', 'Description'))
print("{:<6} | {}".format("Key", "Description"))
for entry in verbosity_options_dict.items():
print("{:<6} | {}".format(entry[0], entry[1]))
verbosity = int(input("Specify verbosity key: "))
@ -549,10 +617,10 @@ def pack_set_gpio_cmd(object_id: bytearray) -> bytearray:
pin = int(input("Specify pin: "))
val = int(input("Specify val: "))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.SET_GPIO)
command = command + struct.pack('!B', port)
command = command + struct.pack('!B', pin)
command = command + struct.pack('!B', val)
command = object_id + struct.pack("!I", SupvActionIds.SET_GPIO)
command = command + struct.pack("!B", port)
command = command + struct.pack("!B", pin)
command = command + struct.pack("!B", val)
return command
@ -560,9 +628,7 @@ def pack_read_gpio_cmd(object_id: bytearray) -> bytearray:
port = int(input("Specify port: "))
pin = int(input("Specify pin: "))
command = bytearray()
command = object_id + struct.pack('!I', SupvActionIds.READ_GPIO)
command = command + struct.pack('!B', port)
command = command + struct.pack('!B', pin)
command = object_id + struct.pack("!I", SupvActionIds.READ_GPIO)
command = command + struct.pack("!B", port)
command = command + struct.pack("!B", pin)
return command

View File

@ -22,7 +22,7 @@ latchup_id_dict = {
"3": "3.3V",
"4": "NVM_4XO",
"5": "MISSION",
"6": "SAFECOTS"
"6": "SAFECOTS",
}
@ -48,57 +48,101 @@ class ImagePathDefs:
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(
(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":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition A"))
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_UBOOT) + \
bytearray(ImagePathDefs.imageAuboot, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition A")
)
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "1":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition A"))
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_BITSTREAM) + \
bytearray(ImagePathDefs.imageAbitsream, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition A")
)
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "2":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition A"))
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_LINUX) + \
bytearray(ImagePathDefs.imageAlinux, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition A")
)
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "3":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update application on partition A"))
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_A_APP_SW) + \
bytearray(ImagePathDefs.imageAappsw, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Update application on partition A")
)
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition B"))
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_UBOOT) + \
bytearray(ImagePathDefs.imageBuboot, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Update uboot on partition B")
)
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition B"))
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_BITSTREAM) + \
bytearray(ImagePathDefs.imageBbitsream, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Update bitstream on parition B")
)
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition B"))
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_LINUX) + \
bytearray(ImagePathDefs.imageBlinux, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Update linux on partition B")
)
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7":
tc_queue.appendleft((QueueCommands.PRINT, "PLOC Supervisor: Update application on partition B"))
command = object_id + struct.pack('!I', UpdaterActionIds.UPDATE_B_APP_SW) + \
bytearray(ImagePathDefs.imageBappsw, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "PLOC Supervisor: Update application on partition B")
)
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)
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
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(
(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":
@ -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"))
mode_data = pack_mode_data(object_id, 0, 0)
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
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(
(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":
@ -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())
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)
command = PusTelecommand(service=200, subservice=1, ssc=42, app_data=mode_data)
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())
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 = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
return tc_queue
def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) -> bytearray:
""" With this function a command is packed to set the speed of a reaction wheel
def pack_set_speed_command(
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 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
@ -88,6 +98,6 @@ def pack_set_speed_command(object_id: bytearray, speed: int, ramp_time: int) ->
command_id = RwCommandIds.SET_SPEED
command = bytearray()
command = object_id + command_id
command = command + struct.pack('!i', speed)
command = command + ramp_time.to_bytes(length=2, byteorder='big')
command = command + struct.pack("!i", speed)
command = command + ramp_time.to_bytes(length=2, byteorder="big")
return command

View File

@ -88,10 +88,14 @@ class PartitionSize:
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(
(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":
@ -116,164 +120,224 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "4":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "5":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Switch to bootloader program"))
command = object_id + struct.pack('!I', StarTrackerActionIds.SWITCH_TO_BOOTLOADER_PROGRAM)
tc_queue.appendleft(
(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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "6":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "7":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "8":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "9":
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)
tc_queue.appendleft(command.pack_command_tuple())
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: "))
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "11":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "12":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "13":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "14":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload image"))
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_IMAGE) + \
bytearray(ImagePathDefs.uploadFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_IMAGE)
+ bytearray(ImagePathDefs.uploadFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=40, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "15":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download image"))
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_IMAGE) + \
bytearray(ImagePathDefs.downloadPath, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_IMAGE)
+ bytearray(ImagePathDefs.downloadPath, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=53, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "16":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set limits"))
command = object_id + struct.pack('!I', StarTrackerActionIds.LIMITS) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.LIMITS)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=42, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "17":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set tracking parameters"))
command = object_id + struct.pack('!I', StarTrackerActionIds.TRACKING) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "Star tracker: Set tracking parameters")
)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.TRACKING)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "18":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Mounting"))
command = object_id + struct.pack('!I', StarTrackerActionIds.MOUNTING) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.MOUNTING)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "19":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Camera"))
command = object_id + struct.pack('!I', StarTrackerActionIds.CAMERA) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.CAMERA)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "20":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Blob"))
command = object_id + struct.pack('!I', StarTrackerActionIds.BLOB) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.BLOB)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=46, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "21":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Centroiding"))
command = object_id + struct.pack('!I', StarTrackerActionIds.CENTROIDING) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.CENTROIDING)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=47, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "22":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: LISA"))
command = object_id + struct.pack('!I', StarTrackerActionIds.LISA) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.LISA)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=48, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "23":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Matching"))
command = object_id + struct.pack('!I', StarTrackerActionIds.MATCHING) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.MATCHING)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=49, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "24":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Validation"))
command = object_id + struct.pack('!I', StarTrackerActionIds.VALIDATION) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.VALIDATION)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=50, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "25":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Algo"))
command = object_id + struct.pack('!I', StarTrackerActionIds.ALGO) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.ALGO)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=51, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "26":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Take image"))
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "27":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "28":
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)
tc_queue.appendleft(command.pack_command_tuple())
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: ")
command = object_id + struct.pack('!I', StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE) + \
bytearray(filename, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.CHANGE_DOWNLOAD_IMAGE)
+ bytearray(filename, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=54, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "30":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "31":
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "32":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set json filename"))
command = object_id + struct.pack('!I', StarTrackerActionIds.SET_JSON_FILE_NAME) + \
bytearray(ImagePathDefs.jsonFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.SET_JSON_FILE_NAME)
+ bytearray(ImagePathDefs.jsonFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=57, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "33":
@ -289,7 +353,11 @@ def pack_star_tracker_commands(object_id: bytearray, tc_queue: TcQueueT, op_code
if op_code == "35":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set read 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)
tc_queue.appendleft(command.pack_command_tuple())
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":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Set time"))
unix_time = 1640783543
command = object_id + struct.pack('!I', StarTrackerActionIds.SET_TIME) + struct.pack('!Q', unix_time)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.SET_TIME)
+ struct.pack("!Q", unix_time)
)
command = PusTelecommand(service=8, subservice=128, ssc=61, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "38":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Centroid"))
id = 0
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_CENTROID) + struct.pack('!B', id)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_CENTROID)
+ struct.pack("!B", id)
)
command = PusTelecommand(service=8, subservice=128, ssc=62, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "39":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload Centroid"))
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_CENTROID) + \
bytearray(ImagePathDefs.uploadCentroidJson, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.UPLOAD_CENTROID)
+ bytearray(ImagePathDefs.uploadCentroidJson, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=63, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "40":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download matched star"))
tc_queue.appendleft(
(QueueCommands.PRINT, "Star tracker: Download matched star")
)
id = 0
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_MATCHED_STAR) + \
struct.pack('!B', id)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_MATCHED_STAR)
+ struct.pack("!B", id)
)
command = PusTelecommand(service=8, subservice=128, ssc=64, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "41":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download DB Image"))
id = 0
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_DBIMAGE) + \
struct.pack('!B', id)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_DBIMAGE)
+ struct.pack("!B", id)
)
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "42":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download Blob Pixel"))
id = 0
type = 1 # 0 - normal, 1 - fast
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_BLOBPIXEL) + \
struct.pack('!B', id) + struct.pack('!B', type)
type = 1 # 0 - normal, 1 - fast
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_BLOBPIXEL)
+ struct.pack("!B", id)
+ struct.pack("!B", type)
)
command = PusTelecommand(service=8, subservice=128, ssc=65, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "43":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Download FPGA Image"))
position = 0
length = 4100
command = object_id + struct.pack('!I', StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE) + \
struct.pack('!I', position) + struct.pack('!I', length) + bytearray(
ImagePathDefs.downloadFpgaImagePath, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.DOWNLOAD_FPGA_IMAGE)
+ struct.pack("!I", position)
+ struct.pack("!I", length)
+ bytearray(ImagePathDefs.downloadFpgaImagePath, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=66, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "44":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Chnage donwload FPGA image file name"))
command = object_id + struct.pack('!I', StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE) + \
bytearray(ImagePathDefs.downloadFpgaImageName, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "Star tracker: Chnage donwload FPGA image file name")
)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.CHANGE_FPGA_DOWNLOAD_FILE)
+ bytearray(ImagePathDefs.downloadFpgaImageName, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=67, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "45":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: Upload FPGA image"))
command = object_id + struct.pack('!I', StarTrackerActionIds.UPLOAD_FPGA_IMAGE) + \
bytearray(ImagePathDefs.uploadFpgaImageName, 'utf-8')
command = (
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)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == "46":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker: FPGA action"))
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)
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:
region = Region.FREE_1
address = 0
command = object_id + struct.pack('!I', StarTrackerActionIds.WRITE) + struct.pack('!B', region) + \
struct.pack('!I', address) + bytearray(ImagePathDefs.flashFile, 'utf-8')
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.WRITE)
+ struct.pack("!B", region)
+ struct.pack("!I", address)
+ bytearray(ImagePathDefs.flashFile, "utf-8")
)
return command
@ -378,8 +490,14 @@ def pack_read_command(object_id: bytearray) -> bytearray:
region = Region.STAR_TRACKER_FIRMWARE
address = 0
size = PartitionSize.STAR_TRACKER_FIRMWARE
command = object_id + struct.pack('!I', StarTrackerActionIds.READ) + struct.pack('!B', region) + \
struct.pack('!I', address) + struct.pack('!I', size) + bytearray(ImagePathDefs.flashReadPath, 'utf-8')
command = (
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
@ -387,6 +505,11 @@ def pack_checksum_command(object_id: bytearray) -> bytearray:
region = Region.STAR_TRACKER_FIRMWARE
address = 0
size = PartitionSize.STAR_TRACKER_FIRMWARE
command = object_id + struct.pack('!I', StarTrackerActionIds.CHECKSUM) + struct.pack('!B', region) + \
struct.pack('!I', address) + struct.pack('!I', size)
command = (
object_id
+ struct.pack("!I", StarTrackerActionIds.CHECKSUM)
+ struct.pack("!B", region)
+ struct.pack("!I", address)
+ struct.pack("!I", size)
)
return command

View File

@ -25,14 +25,24 @@ class ImagePathDefs:
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(
(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":
tc_queue.appendleft((QueueCommands.PRINT, "Star tracker image helper: Upload image"))
command = object_id + struct.pack('!I', Commands.UPLOAD_IMAGE) + bytearray(ImagePathDefs.uploadFile, 'utf-8')
tc_queue.appendleft(
(QueueCommands.PRINT, "Star tracker image helper: Upload image")
)
command = (
object_id
+ struct.pack("!I", Commands.UPLOAD_IMAGE)
+ bytearray(ImagePathDefs.uploadFile, "utf-8")
)
command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())

View File

@ -27,10 +27,14 @@ class CommandIds:
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(
(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":
@ -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)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=15, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
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 = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command)
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.str_img_helper import pack_str_img_helper_command
from config.definitions import CustomServiceList
from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_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
from config.object_ids import (
P60_DOCK_HANDLER,
PDU_1_HANDLER_ID,
PDU_2_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()
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:
return pack_generic_service5_test_into(tc_queue=service_queue)
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:
return pack_service200_test_into(tc_queue=service_queue)
if service == CustomServiceList.P60DOCK.value:
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:
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:
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:
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:
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:
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:
object_id = HEATER_ID
return pack_heater_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.IMTQ.value:
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:
object_id = PLOC_MPSOC_ID
return pack_ploc_mpsoc_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.REACTION_WHEEL_1.value:
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:
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:
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:
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:
object_id = RAD_SENSOR_ID
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:
return pack_acs_command(tc_queue=service_queue, op_code=op_code)
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:
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:
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:
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:
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 !")

View File

@ -18,10 +18,13 @@ class Tmp1075TestProcedure:
@details Setting all to True will run all tests.
Setting all to False will only run the tests set to True.
"""
all = False
start_adc_conversion = 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
@ -30,14 +33,21 @@ class Tmp1075ActionIds:
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(
(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:
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 = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())