2020-12-29 11:29:03 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
@file tmtcc_tc_pdu1.py
|
|
|
|
@brief PDU2 tests
|
|
|
|
@author J. Meier
|
|
|
|
@date 17.12.2020
|
|
|
|
"""
|
|
|
|
|
|
|
|
from tmtc_core.pus_tc.tmtcc_pus_tc_packer import TcQueueT
|
|
|
|
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
|
2021-02-03 14:14:54 +01:00
|
|
|
from tmtc_core.core.tmtcc_object_id_manager import get_object_id
|
|
|
|
from tmtc_core.core.tmtc_core_definitions import QueueCommands
|
|
|
|
|
2020-12-29 11:29:03 +01:00
|
|
|
from pus_tc.tmtcc_tc_p60dock import P60DockConfigTable
|
2021-02-03 14:14:54 +01:00
|
|
|
from config.tmtcc_object_ids import ObjectIds
|
|
|
|
from gomspace.gomspace_common import *
|
2020-12-29 11:29:03 +01:00
|
|
|
from gomspace.gomspace_pdu_definitions import *
|
|
|
|
|
|
|
|
|
2021-02-03 14:14:54 +01:00
|
|
|
P60DOCK_HANDLER_ID = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
|
|
|
|
|
|
|
|
|
2020-12-29 11:29:03 +01:00
|
|
|
class PDU1TestProcedure:
|
|
|
|
"""
|
|
|
|
@brief Use this class to define the tests to perform for the PDU2.
|
|
|
|
@details Setting all to True will run all tests.
|
|
|
|
Setting all to False will only run the tests set to True.
|
|
|
|
"""
|
|
|
|
all = True
|
|
|
|
reboot = False
|
|
|
|
ping = False
|
|
|
|
read_temperature = False
|
|
|
|
|
|
|
|
|
2021-02-03 14:14:54 +01:00
|
|
|
def pack_pdu1_test_into(object_id: bytearray, tc_queue: TcQueueT):
|
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "Testing PDU1"))
|
2020-12-29 11:29:03 +01:00
|
|
|
|
2021-02-03 14:14:54 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Enabling PDU1"))
|
|
|
|
command = pack_set_param_command(
|
|
|
|
P60DOCK_HANDLER_ID, P60DockConfigTable.out_en_1.parameter_address,
|
|
|
|
P60DockConfigTable.out_en_1.parameter_size, Channel.on
|
|
|
|
)
|
2020-12-29 11:29:03 +01:00
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
|
|
|
|
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
|
2021-02-03 14:14:54 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Ping Test"))
|
2020-12-29 11:29:03 +01:00
|
|
|
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
|
|
|
command = pack_ping_command(object_id, ping_data)
|
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|
|
|
|
if PDU1TestProcedure.all or PDU1TestProcedure.read_temperature:
|
2021-02-03 14:14:54 +01:00
|
|
|
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Testing temperature reading"))
|
2020-12-29 11:29:03 +01:00
|
|
|
command = pack_get_param_command(object_id, TableIds.hk, PDUHkTable.temperature.parameter_address,
|
|
|
|
PDUHkTable.temperature.parameter_size)
|
|
|
|
command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
|
|
|
tc_queue.appendleft(command.pack_command_tuple())
|